I have the following homework assignment: the life expectancy $X$ of a lamp has exponential distribution with rate $\lambda$. The rate depends on the production proccess, such that its population can be described by the uniform distribution $\lambda \sim U[0,1]$. (I'm sorry if the translation is bad, I hope it is understandable).
- Describe the joint density of the lamp life $X$ and rate $\lambda$.
This one is just $f_{X \mid\lambda}(x\mid\lambda)f_{\lambda}(\lambda) = \lambda e^{-\lambda x}$ for $x \geq 0$ and $\lambda \in [0,1]$ or $0$ elsewhere.
- Find $X$ distribution.
First I tried to find the marginal density of $X$ by integrating the joint density over $\lambda$: $$ f_{X}(x) = \int_{0}^{1} \lambda e^{-\lambda x} \,d\lambda = -\frac{e^{-x}}{x} - \frac{e^{-x}}{x^{2}} + \frac{1}{x^{2}} \quad \text{if $x \geq 0$ and $0$ otherwise}$$ I am already in trouble, somewhere along the way I lost the ability to compute the marginal density for $X = 0$, which was fine for the joint density, I don't know what happened (the integral is correct) nor do I know why was this information lost. It gets even uglier when I try to find the distribution of $X$: $$F(X \leq x) = \int_{0}^{x} -\frac{e^{-x}}{x} - \frac{e^{-x}}{x^{2}} + \frac{1}{x^{2}} \,dx = (-\frac{1}{x} + \frac{e^{-x}}{x})\Big|_{0}^{x} $$ Once again the integral is correct but now I can't even evaluate it because of the lower limit being $0$. So my question is what am I doing wrong? And why did I lose the information on $X = 0$? I know I can just calculate $F(X \leq x \mid \lambda)$ and get some nice results after integrating over $\lambda$ but I really don't know why this straight forward way doesn't really work here...
Thank you for your attention.