# finding PDF of Y, given Y|X [closed]

$$Y|X\sim Bin(X,n)$$ $$X\sim U([0,1])$$

How can I find the PDF of Y?

I know that:

$$\Bbb P(Y=k)=E_X[\Bbb P(Y=k)|X]$$

• Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. – Stephan Kolassa Jun 17 at 12:37
• Hint: this is a compound distribution, which is sometimes also called a mixture distribution. – Stephan Kolassa Jun 17 at 12:38
• @Xi'an, Did you just give a curt "Wrong" to someone for omitting a notational convention? Great way to welcome a new user. While we're at it--you're wrong. The correct answer is actually $$P(Y = k) = \mathbb{E}_X [P(Y=k|X)]$$ – Do not reinstate Monica Jun 17 at 12:39
• hint: beta-binomial distribution – Christoph Hanck Jun 17 at 13:51

$$p(y=k) = \int_0^1 p(y=k|x)p(x)dx = \binom ny \int_0^1 x^y (1-x)^{n-y} dx.$$
Since $$y$$ and $$n$$ are integers, we know via standard properties of the Beta function that $$B(\alpha, \gamma) = \int_0^1 t^{\alpha-1} (1-t)^{\gamma-1} dt = \frac{\alpha!\gamma!}{(\alpha+\gamma-1)!}$$. Then by letting $$\alpha = y + 1$$ and $$\gamma = n-y+1$$ we deduce that
$$\binom ny \int_0^1 x^y (1-x)^{n-y} dx = \binom ny B(\alpha, \gamma) = \binom nyB(y + 1, n-y+1) = \frac{n!}{y!(n-y)!}\frac{y!(n-y)!}{(n+1)!} = \frac{1}{n+1},$$
$$p(y=k) = \frac{1}{n+1},$$ a uniform distribution over the (n+1) outcomes, interestingly enough.
• why is it $$\binom ny$$ and not $$\binom Xk$$ – MC1325 Jun 17 at 13:13