I am trying to solve the following.
$X$ is an exponential random variable with mean $\theta$ while $Y$ is a Bernoulli random variable with probability of success $p$. Find the $Var[XY]$
I have no idea what to do here, because one is continuous while the other is discrete. All I know is that I am trying to add all the $xy P[X=x,Y=y]$ but how do we work on this case?
The probability distribution of variable $z = XY$ is $$ f(z) = (1-p)\delta(z) + p \theta e^{-\theta z} \Theta(z) $$ where $\delta(z)$ is the usual Heaviside delta function and $\Theta (z)$ is a step function keeping the exponential only for positive $z$.
The expectation is $$ \int_{-\infty}^{+\infty} z (1-p)\delta(z) dz + \int_{-\infty}^{+\infty} z p \theta e^{-\theta z} \Theta(z)dz = (1-p)\cdot 0 + p \theta \int_{0}^{+\infty} z e^{-\theta z} dz = p/\theta $$
The second moment about zero is $$ \int_{-\infty}^{+\infty} z^2 (1-p)\delta(z) dz + \int_{-\infty}^{+\infty} z^2 p \theta e^{-\theta z} \Theta(z)dz = (1-p)\cdot 0 + p \theta \int_{0}^{+\infty} z^2 e^{-\theta z} dz = 2p/\theta^2 $$
The variance is thus $$ \sigma^2 = \left( 2p/\theta^2 \right) - \left( p/\theta \right)^2 = \frac{p(2-p)}{\theta^2} $$