# How to compute conditional density function in this particular case?

Suppose we have two random variables $$\xi,\eta$$, which are defined on the same probability space and $$\xi \sim \mathcal{U}[0,1]$$. Moreover, $$\forall \lambda\in[0,1]:(\eta|\xi=\lambda)\sim \mathcal{Be}(\lambda)$$.

I need to find the distribution of $$\eta$$. In order to do so, I need to calculate $$f_{\xi}(\lambda|\eta=t)$$, but how does one compute it? In the question conditional probability combining discrete and continous random variables user Wio computes it using joint probability density, but is it really possible, given that one of the variables is absolutely continuous and the other is discrete?

\begin{aligned}P(\eta \leq t)&=E[P(\eta\leq t|\xi)]=\\ &=\int_0^1P(\eta\leq t|\xi=y)dy=\\ &=\int_0^1(y \mathbf{1}_{\{0\leq t<1\}}(t)+\mathbf{1}_{\{t\geq 1\}}(t))dy=\\ &=\frac{1}{2}\mathbf{1}_{\{0\leq t<1\}}(t)+\mathbf{1}_{\{t\geq 1\}}(t)\end{aligned} We may conclude $$\eta \sim \textrm{Bernoulli}(1/2)$$.
• Why $\mathbb{P}[\eta\leq t] = \mathbb{E}[\mathbb{P}[\eta\leq t|\xi]]$? Is this some kind of generalization of the total probability formula? Oct 31, 2022 at 14:16
• @Egor Total expectation: $P(\eta \leq t)=E[\mathbf{1}_{\{\eta \leq t\}}]=E[E[\mathbf{1}_{\{\eta \leq t\}}|\xi]]=E[P(\eta\leq t|\xi)]$ Oct 31, 2022 at 14:18
• So we didn't use the distribution of $\xi$ in this solution? It seems that the only relevant thing was $(\eta|\xi = \lambda)\sim \mathrm{Be}(\lambda)$... Oct 31, 2022 at 18:25
• Oh, it seems like we used it to argue that $dF_{\xi} = f_{\xi}dy = dy?$ Oct 31, 2022 at 18:35
• @Egor, indeed, we took the expectation wrt to the law of $\xi$, which is just uniform over the unit interval. Oct 31, 2022 at 18:36