Given $X \sim \text{exp}(1)$ find the probability density function of the derived RV $Y = g(X)$ where $Y$ is:
$$ Y = \begin{cases} X & \text{when } X \leq 1 \\ \displaystyle \frac {1} {X} & \text{when } X > 1 \end{cases} $$
here1 is my attempt of the problem however i really doubt that it is correct especially because the range of the PDF overlaps as I got $y \leq 1$ when $x \leq 1$ as well as $1/y > 1 \iff y < 1$ when $x > 1$. If it is correct how do i handle it?
The easiest way to solve the problem is to do a drawing of the transformation function and realize that
$$\mathbb{P}[Y>y]=F_X\left(\frac{1}{y}\right)-F_X(y)=e^{-y}-e^{-1/y}$$
thus
$$F_Y(y)=1+e^{-1/y}-e^{-y}$$
derivating you get your density...and observe that $y \in(0;1]$
$$f_Y(y)=\left[\frac{e^{-1/y}}{y^2}+e^{-y}\right]\cdot\mathbb{1}_{(0;1]}(y)$$
this is the drawing of your pdf