Expected value of a random number from another random number

29 Views Asked by At

I am trying to prepare for an interview for a statistics-heavy position, and I always get stuck at probability questions. I made up this interesting question, and I realized I'm not sure I 100% know how to answer it.

I play a game with you where I pick a random number, $x$, between 1 and $n$ (inclusive), we call this number $x$. Then I pick a number, $y$, between $x$ and $n$, inclusive. I will then pay you \$$y$, depending on how much y is. How much are you willing to pay to play this game?

I think this is a cool question. Using capital letters for $X$, being the random variable which denotes the first pick and $Y$ being the second pick. PMF of $X$ can be modeled as: $P(X = x) = \frac{1}{n}$. PMF of $Y$ can be modeled as: $P(y|x) = \frac{1}{n-x}$. So summing up $P(y|x)$ for all $x$, we get the formula:

$$P(Y = y) = \frac{1}{n} \sum_{i=1}^n \frac{1}{n-i} $$

Now, first question, is this right? If so, then the next step is to find the expected value of $Y$, which is an easy jump:

$$E[Y] = \sum_{y=1}^n y * P(y) = \sum_{y=1}^n y * \frac{1}{n} \sum_{i=1}^n \frac{1}{n-i} $$

Second question: Can this be simplified? My math expertise is still being built, but this looks like a harmonic series. Is there any way we can use that knowledge to get a closed form solution?

1

There are 1 best solutions below

0
On BEST ANSWER

The mean of a uniform distribution (discrete or continuous) is the average of its endpoints $E[X]=\frac{1+n}{2}$ so with iterated expectation $E[Y]=\frac{\frac{1+n}{2}+n}{2} = \frac{1+3n}{4}$


In your formulation,

  • $P(X = x)=\frac1n$ for $x \in \{1,2,\ldots,n\}$
  • $P(Y=y \mid X = x)=\frac1{n-x+1}$ for $y \in \{x,x+1,\ldots,n\}$
  • $E[Y] = \sum\limits_{x=1}^n \sum\limits_{y=x}^n y \frac1{n-x+1} \frac1n = \sum\limits_{x=1}^n \frac{x+n}{2} \frac1n = \frac{n(n+1)/2}{2n}+\frac{n^2}{2n}= \frac{1+3n}{4}$