Say that X has an exponential distribution with unknown lambda. Then I'm told that lambda has a gamma distribution. Now I'm asked to find the density of X. How do I approach this problem?
It's called a mixture of distributions, and you solve it using integrals
so we know $\displaystyle f(X| \lambda) = \lambda e^{-\lambda x}$ and $\displaystyle f(\lambda) = \frac{1}{\Gamma(\alpha) B^{\alpha}}x^{\alpha - 1} e^{-x/B}$ (assuming the parameters are alpha and beta).
$\displaystyle f(x) = \int^{\infty}_0 f(X| \lambda) f(\lambda) d \lambda$