Find a pdf of a function of a random variable

Let $Y$ be an exponential random variable with parameter $\frac12$. Let $X=e^{-Y/2}$. Determine the pdf of $X$.

$$f(t)=\frac{d}{dt}P(X\le t)=\frac{d}{dt}P(e^{-Y/2}\le t)\\=\frac{d}{dt}P(Y\ge-2\ln t)=\frac{d}{dt}(1-P(Y<-2\ln t))=-\frac12e^{\ln t}=-\frac{t}2$$

How come I end up with a negative value? What's wrong?

-
NB: This is probability not probability-theory. – cardinal Apr 19 '12 at 10:44

You need to distinguish between different values of $t$. First let $t\leq 0$. Then using that $P(Y\geq 0)=1$ we get $$P(X\leq t)\leq P(X\leq 0)=0.$$ If $t\geq 1$ then $$P(X\leq t)=P(X\leq 1)=1.$$ If $t\in (0,1)$ then $\exp(z)\leq t$ if and only if $z\leq \log(t)$, $z\in\mathbb{R}$, and $$P(X\leq t)=P(\exp(-Y/2)\leq t)=\cdots = 1-P(Y\leq -2\log(t))=t.$$ Now you can differentiate and obtain the density/pdf and we get $f(t)=1$ for $t\in (0,1)$ and $f(t)=0$ elsewhere; it's the pdf for a uniform distribution on $(0,1)$.
$$\Pr(Y>y) = e^{-(1/2)y}.$$ $$\Pr(Y>-2\ln t) = e^{-(1/2)(-2)\ln t} = t.$$
(This assumes of course that $t$ is between $0$ and $1$, since $e^{-Y/2}$ is always in that interval, so otherwise the probability is trivially $0$ or $1$.)