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

If you expand the definition of expectation, you get $$\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)$$ You can use a similar "return to the definition" to write the conditional expectations as well.

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.

• Sorry I would like to ask another question please concerning the same topic, I am trying to apply the above : to get the conditional density of X (continuous) given Y (discrete) I would have to differentiate the above CDF with respect to X, right? and $P(X \leq x , Y \leq y) = \int_{s= - \infty}^{x} \sum_{t \leq y}^{} f_{X,Y} (s,t) ds$. I am precisely having trouble expressing $f_{X,Y} (s,t)$ for X uniformly distributed over [0,1] and Y discrete taking the value $y_1$ with probability $\lambda$ and $y_1$ with probability $1- \lambda$. Thank you @Liron – Sha Apr 9 '15 at 19:24
• They do not have a joint density, because $Y$ is discrete. That is why we had to define the joint CDF. In your case $X$ and $Y$ are independent and therefore $F_{XY}(x,y)=P(X\leq x)P(Y\leq y)$. The conditional CDF of $X$ is $P(X\leq x|Y=y)=P(X\leq x)P(Y=y)/P(Y=y)=P(X\leq x)$ (and the conditional density is then equal to the marginal $f_X(x)$). But that should have been obvious from the start because they are independent. There is not much interest in the joint CDF of independent random variables. My answer was for the general part of your question, it is not needed for the specific example. – QQQ Apr 10 '15 at 6:01
• Thank you for your reply, but why are they independent? Y can take two values and for each value we can have an X uniformly distributed ( like two separate lines , one for each of the values of Y). I am actually seeking to compute E ( U(X,Y) | Y ) where U(.,.) is just a function of both random variables. – Sha Apr 10 '15 at 9:12
• To do that you already have an answer by Clement, which uses the fact they are independent by multiplying the probabilities in the integral. The way you defined it in your initial post, $X$ is uniform on $(0,1)$ regardless of the value of $Y$ and is therefore independent of $Y$. – QQQ Apr 10 '15 at 9:27