# random variables with uniform probability and expectancy

Suppose we choose a random number n from 0..100.Y and X are discrete random independent variables that have uniform distribution with 0...n.If Y+X equals to 15 what is expectancy of n?

-
Only integer values allowed, I suppose? –  Raskolnikov Feb 12 '11 at 12:56
yes it is a discrete distribution –  Yakov Feb 12 '11 at 13:00
add comment

## 2 Answers

Following up Henry's answer and comment, if we assume than $n$ is a fixed but unknown number and $X$ and $Y$ are independent discrete random variables uniformly distributed on $\{0, 1, \ldots, n\}$, then $$P\{X + Y = i\} = \begin{cases} (i+1)/(n+1)^2, & 0 \leq i \leq n,\\ (2n+1-i)/(n+1)^2, & n+1 \leq i \leq 2n,\end{cases}$$ with a maximum value of $(n+1)^{-1}$ at $i = n$. Given $X + Y = 15$, we know that $n$ must be at least $8$. Furthermore, the likelihood of the observation $X + Y = 15$ is $0$ for $0 \leq n < 8$,$2/9^2$ when $n = 8$, $4/10^2$ when $n = 9$, etc., peaking at $1/16$ when $n = 15$/ Thus, as Henry suspected, the maximum-likelihood estimate of $n$ is $15. But the question asked by the OP is If$Y+X = 15$, what is expectancy of n? which seems to imply that the OP wants the conditional expected value of$n$given$X + Y = 15$, presumably under the assumption that the prior distribution of$n$is uniform on$\{0, 1, \ldots, 100\}$. So now we need to compute $$P\{n = m \mid X+Y = 15\} = \frac{\frac{1}{101}P\{X+Y = 15 \mid n = m\}}{ \frac{1}{101}\sum_{i = 0}^{100}P\{X+Y = 15 \mid n = i\} }$$ which presumably leads to the conditional median of$n$being 32 and the conditional mean being over 39.5. I wonder what the Bayesian or maximum aposteriori probability estimate of$n$is? - add comment It is probably worth starting by working out the answer to: If$Y$and$X$are discrete random independent variables that have uniform distribution on the integers$0,\ldots...n$, then what is the probability that$Y+X=15$. You could then use these probabilities as likelihoods in your original question. - I did it.E(X+Y)=n==>n=15? (the answer for the question is 14) – Yakov Feb 12 '11 at 14:56 It is true that$E[X+Y] = n$but that does not help with your original question as stated. Given that$X+Y=15$, I suspect the maximum likelihood estimate of$n$is$15$, the median estimate is$32$and the expectation of$n$is over$39.5\$. If the answer is 14, then you may have misstated the question. –  Henry Feb 12 '11 at 15:12
add comment