Transformation on a random variable

We want $f_Z(z)$, the density function of $z$. We will first look for the cdf of $Z$.

When $z\gt 0$, we have $\Pr(Z\le z)=\Pr(Y\ge -z)=1$. So for $z\gt 0$, we have $F_z(z)=1$, and therefore $f_Z(z)=0$.

Now let $z\lt 0$. Then $$F_Z(z)=\Pr(Z\le z)=\Pr(Y\ge -z)=1-F_Y(-z).$$ Differentiate with respect to $z$, using the Chain Rule, and the fact that the derivative of $F_Y(y)$ with respect to $y$ is $e^{-y}$. We get $$f_Z(z)=-(-1)e^{-(-z)}=e^z.$$

Remark: It may be a little clearer to note that $F_Y(y)=1-e^{-y}$, so if $z\lt 0$ then $$F_Z(z)=1-F_Y(-z)=1-(1-e^{-(-z)})=e^z,$$ and therefore $f_Z(z)=e^z$.


Using theorem of transformation variables: $$ g_Z(z)=f_Y(y)\ |J|=f_Y(y)\ \left|\frac{dy}{dz}\right|, $$ where $J$ is Jacobian. We have $$ f_Y(y)=\lambda e^{-\lambda y}=e^{- y}\quad;\text{ since $\lambda=1$ and for }y\ge0 $$ and $y=-z$. Therefore $$ g_Z(z)=e^{- y} \left|\frac{dy}{dz}\right|=e^{-(-z)} \left|\frac{d}{dz}(-z)\right|=e^z\ |-1|=\Large\color{blue}{e^z}\quad;\text{ for }z\le0. $$ It can also be done as follows $$ \begin{align} \Pr[Z\le z]&=\Pr[-Y\le z]\\ &=\Pr[Y> -z]\\ &=1-\Pr[Y\le -z]\\ &=1-\left(1-e^{-(-z)}\right)\\ \Pr[Z\le z]&=e^{z}\\ \end{align} $$ and $$ \begin{align} f_Z(z)&= \frac{d}{dz}\Pr[Z\le z]\\ &=\frac{d}{dz}e^{z}\\ &=\Large\color{blue}{e^z} \end{align} $$