Let the joint PDF of $(X, Y)$ be given by
$$f(x, y) = \frac{2}{x} e^{-2x}, \hspace{1cm} x>0, 0 \leq y< x. $$
a) Find the marginal PDF of $X$ and find $\mathbb{E}[X]$
b) Find the conditional pdf of $Y$ given $X = x$
c) Compute $\text{Cov}(X, Y)$.
MY try:
a)
$$f_{X}(x) = \int_{-\infty}^{\infty} f(x, y) \mathop{dy} = \int_{0}^{x} \frac{2}{x}e^{-2x} \mathop{dy}$$
$$ = \boxed{2e^{-2x} \hspace{1cm} \text{ for } x > 0}$$
Also, $$\mathbb{E}[X] = \int_{-\infty}^{\infty} x \cdot f_{X}(x) \mathop{dx} = \int_{0}^{\infty} 2xe^{-2x} \mathop{dx} = \boxed{\frac{1}{2}}$$
b)
$$f_{Y \mid X}(y \mid x) = \frac{f(x, y)}{f_{X}(x)} = \boxed{\frac{1}{x} \text{ for } x > 0, x \neq 0}$$
c)
$$\text{Cov}(X,Y) = \mathbb{E}[XY] - \mathbb{E}[X]\cdot \mathbb{E}[Y]. $$
First, compute $\mathbb{E}[Y]$ as follows:
$$\mathbb{E}[Y] = \mathbb{E}[\mathbb{E}[Y \mid X]] = \mathbb{E}[\frac{X}{2}] = \frac{1}{2} \cdot \mathbb{E}[X] = \frac{1}{4}$$
Now compute $\mathbb{E}[XY]$:
$$\mathbb{E}[XY] = \int_{0}^{\infty} \int_{0}^{x} 2ye^{-2x} \mathop{dy} \mathop{dx} $$
$$ = \int_{0}^{\infty} x^{2}e^{-2x} \mathop{dx}$$
$$= \mathbb{E}[X^{2}]/2.$$
Recall we have $\text{Var}(X) = 1/\lambda^{2}$, which means $\mathbb{E}[X^{2}] = \mathbb{E}[X]^{2} + \text{Var}(X) = \frac{2}{\lambda^{2}}$. Therefore,
$$\text{Cov}(X, Y) = \frac{1}{4} - \frac{1}{8} = \boxed{\frac{1}{8}} $$
Are all of these answers correct? I'm unsure about the domains to be honest for (a) and (b).
Guide:
$E[X], E[Y], E[XY]$ should all be just numbers.
$X$ follows an exponential distribution, the expectation is $\frac12$.
\begin{align} E[XY] &= \int_0^\infty \int_0^x 2y e^{-2x} \, dy \, dx \\ &=\frac12\int_0^\infty 2x^2 e^{-2x}\, dx \\ &= \frac12 E[X^2] \end{align}