joint distribution, discrete and continuous random variables

This may be trivial, but if X is a random variable uniformly distributed over $[0,1]$ and Y is a discrete random variable such that $\mathbb{P} (Y=y_1) = \lambda \in (0,1]$ and $\mathbb{P} (Y=y_2) = 1 - \lambda$. Now I am seeking to compute the expectation of (a linear function) of the random variable X conditional on Y. Is this possible? Can we think of a "joint distribution" of two random variables where one random variable has a continuous density function and the other is discrete?

Thank you


Solution 1:

If you expand the definition of expectation, you get

\begin{align*} \mathbb{E} f(X,Y) &= \int_{[0,1]} \sum_{y\in\{y_1,y_2\}} f(x,y)\mathbb{P}\{x\in dx\}\mathbb{P}\{Y=y\} \\ &= \int_{[0,1]} dx \left( f(x,y_1)\lambda + f(x,y_2)(1-\lambda) \right) \end{align*} You can use a similar "return to the definition" to write the conditional expectations as well.

Solution 2:

You already got a good answer to your specific question, but I would like to add a general remark. Yes, you can consider the joint distribution of a continuous r.v. $X$ and a discrete r.v. $Y$. One way to do it is to consider the joint CDF: $$ F_{XY}(x,y)=P(X\leq x,Y\leq y). $$ This is well defined for any two r.v. and you can compute marginal and conditional probabilites and densities from it.