# Can you find ... random variable edition

Can you create random variables satisfying certain conditions?

## Problem

Can you find a discrete random variable $X$ which only takes integer values for which...

(a) ... the mean (expectation) is 2, the variance is 1, and $X$ takes only positive (integer) values? Can you find another? And a very different example?

(b) ... the mean is 2, the variance is 1, and $X$ takes negative or zero values in addition to positive values? Can you find another? And a very different example?

(c) ... $X$ takes only positive values, but its mean is infinite? Can you find another?

(d) ... the mean is 0 and the variance is as large as possible?

(a) ... the mean (expectation) is 2, the variance is 1, and $X$ takes only positive (integer) values? Can you find another? And a very different example?

(b) ... the mean is 2, the variance is 1, and $X$ takes negative or zero values in addition to positive values? Can you find another? And a very different example?

*The next two parts are significantly more challenging. You might find it helpful to look at A Swiss Sum if you are stuck.*(c) ... $X$ takes only positive values, but its mean is infinite? Can you find another?

(d) ... the mean is 0 and the variance is as large as possible?

You could give your answers in the form of a probability distribution table for $X$, or as a rule such as "$\mathrm{P}(X=r)=\cdots$ for $r=1$, $2$, $3$, ...".

*This resource is part of the collection Statistics - Maths of Real Life*## Getting Started

You might find it useful to start with a specific example of a random variable, with its probability distribution written out explicitly, for example:

$r$ | $1$ | $2$ | $3$ | $4$ |

$\mathrm{P}(X=r)$ | $0.2$ | $0.3$ | $0.2$ | $0.3$ |

and then modify it until it meets the conditions.

Alternatively, what standard distributions do you know that might provide an example, or be close enough to an example, that they can be modified to make them work for this case?

## Student Solutions

*(a) ... the mean (expectation) is 2, the variance is 1, and $X$ takes only positive (integer) values? Can you find another? And a very different example?*

- $\mathrm{P}(X=1)=\mathrm{P}(X=3)=\frac{1}{2}$, for example.
- If $Y$ has Poisson distribution with parameter 1, so $\mathrm{E}(Y)=\mathrm{Var}(Y)=1$, then $X=Y+1$ does what we want.
- If $Y$ has a geometric distribution with $p=\frac{1}{2}$ (so $Y$ can take values 1, 2, 3, ...), then $\mathrm{E}(Y)=\mathrm{Var}(Y)=2$. We can then modify this by increasing the probability of getting 2 itself to reduce the variance. So define $X$ by $$\mathrm{P}(X=x) = \begin{cases} \tfrac{1}{2}+\tfrac{1}{2}\mathrm{P}(Y=2) & \text{if $x=2$} \\ \tfrac{1}{2}\mathrm{P}(Y=x) & \text{otherwise} \end{cases}$$ and this can be calculated to work.

*(b) ... the mean is 2, the variance is 1, and $X$ takes negative or zero values in addition to positive values? Can you find another? And a very different example?*

- $\mathrm{P}(X=0)=\mathrm{P}(X=4)=\frac{1}{4}$, $\mathrm{P}(X=2)=\tfrac{1}{2}$ for example; this can be generalised to $\mathrm{P}(X=2-k)=\mathrm{P}(X=2+k)=\frac{1}{k^2}$, $\mathrm{P}(X=2)=1-\tfrac{1}{k^2}$
- If $Y$ has a binomial distribution, $Y\sim \mathrm{B}(n,p)$, so that $Y$ takes the value 0, we can mix this with an increased probability for 2 as follows (this was found by playing around with possibilities): take $n\ge 4$, $p=\frac{2}{n}$ and $p'=\frac{1}{2(1-p)}=\frac{n}{2n-4}$. Then if we define $X$ by $$\mathrm{P}(X=x) = \begin{cases} (1-p')+p'\mathrm{P}(Y=2) & \text{if $x=2$} \\ p'\mathrm{P}(Y=x) & \text{otherwise,} \end{cases}$$ we find that $X$ has the required properties. In the case that $n=4$, we get $Y=X$, as this binomial distribution works.

*(c) ... $X$ takes only positive values, but its mean is infinite? Can you find another?*

- The mean of $X$ is $$\mathrm{E}(X)=\sum_{n=1}^\infty n.\mathrm{P}(X=n).$$ So we need a sum which is infinite. But we also require $\sum_{n=1}^\infty \mathrm{P}(X=n)=1$, so the sum can't be too "dramatically" infinite. If we, for example, took $\mathrm{P}(X=n)$ for each $n$, then the sum for $\mathrm{E}(X)$ would indeed sum to infinity, but the sum of the probabilities would also be infinite. If we took $n.\mathrm{P}(X=n)=1$ for each $n$, then the sum for $\mathrm{E}(X)$ would be infinite, but the sum of probabilities is $\sum_{n=1}^\infty \frac{1}{n}$. In Harmonically, we discovered that this sum is also infinite (though - in some sense - only just so: it grows towards infinity really really slowly). So this won't work either. But what about taking $n.\mathrm{P}(X=n)=\frac{1}{n}$? Then the sum for $\mathrm{E}(X)$ is infinite, but the sum of probabilities is $\sum_{n=1}^\infty\frac{1}{n^2}$. This is finite (see A Swiss Sum) so we are almost done: if this finite sum is $k$, then we can take $\mathrm{P}(X=n)=\frac{1}{kn}$ so that the probabilities sum to 1 but the mean is infinite.
- We can extend this idea by taking $\mathrm{P}(X=n)=\dfrac{1}{kn^s}$ for any $s$ with $1< s\le 2$, where $k$ is chosen to make the sum of probabilities equal 1; then the expectation will again be infinite. We don't even need to use the same value of $s$ for each $n$, though there are some restrictions on how quickly $s$ can approach 1 in such a case.

- The idea is the same as the previous part. If we choose $\mathrm{P}(X=n)=\dfrac{1}{kn^3}$, then the mean will be finite but the variance will be infinite. Now modifying it slightly by setting $\mathrm{P}(X=-1)=p$ and $\mathrm{P}(X=n)=\dfrac{1-p}{kn^3}$ for $n\ge1$, by choosing $p$ appropriately, we will end up with a mean of 0 but an infinite variance.

## Teachers' Resources

### Why do this problem?

Random variables are a critical idea in the development of probability: they take us from just describing probabilities of things happening to assigning numerical values to outcomes and asking about the probabilities of obtaining a particular outcome. This is an example of a "can you construct..." problem: rather than giving students a set of random variables and asking them to calculate their means and variances, we ask students to construct random variables having various properties. This is likely to lead to a deeper appreciation for aspects of random variables and the building of connections between different examples of random variables they have already seen.

This problem has been framed in the context of discrete random variables. It could equally well be posed for continuous random variables, making the obvious changes.

### Possible approach

This could be used as a consolidation activity once students have already seen a variety of random variables. For example, they may wish to make use of properties of standard distributions such as the binomial, Poisson or geometric distributions when constructing examples. Alternatively, it could be used earlier on once students have a basic competence at calculating means and variances of random variables, in order to widen their conception of what a random variable could look like.

The questions ask for several examples of random variables which satisfy the conditions, so that students are encouraged to think beyond their first answer. There are several ways of approaching the problems. For example, students might start with the values that $X$ can take, and then try to assign probabilities to them so that the conditions are fulfilled. Alternatively, they may start with a random variable they already know and consider how they might modify it.

Sharing ideas for part (a) with the whole class after students have had some time to think about it on their own is likely to lead to more creative solutions for the subsequent parts.

For part (c), students may well find it hard to find such an example; the question does suggest that such an example exists, so students will have to think about what they know about infinite series. Whether or not they succeed, the thought processes will expand their thinking: they will have to consider random variables which can take infinitely many values and consider how probabilities and means will work in this context. (Note that this part excludes the possibility of random variables taking both positive and negative values. Otherwise one could have a random variable $X$ which is symmetrical about $X=0$, but for which $\mathrm{E}(|X|)=\infty$. In such a case, we say that $X$ does not have a mean: the sum $\sum_{n=-\infty}^\infty n.\mathrm{P}(X=n)$ is not well defined, but that is another story.) Part (c) may well give ideas for how to tackle part (d).

### Key questions

- What possible strategies are there for finding such a random variable?
- If you restrict $X$ to only taking certain values, does that help?
- Can you make use of familiar random variables to solve this problem?

### Possible extension

- For the first parts, can you find random variables satisfying the conditions for which $\mathrm{P}(X=2)=0$?
- For the first parts, can you find a random variable $X$ which takes the smallest possible number of values and still satisfies the conditions?

### Possible support

- If you restrict the random variable to a small number of possible values, can you write down explicit equations relating the probabilities of $X$ taking these values and the mean and variance of $X$?