How to find the probability density function of the random variable $\frac{1}{X}$? How to find the probability density function of the random variable $\frac{1}{X}$?
Let $X$ be a random variable with pdf
$f_X(x)= \begin{cases} 0 ; x \le 0 \\ \frac{1}{2} ; 0 < x \le 1 \\ \frac{1}{2x^2} ; 1 < x < \infty \end{cases}$
I was trying to avoid using  formula. So we see that
$P(Y \le y) = 1 - P(X \le y)$
Case$1$: if $y \le 0$
Then $F(y) = 1 - P[X \le y] = 1$
Case $2:$ if $0 < y \le 1$
Then $F(y) = 1 - P(X \le y) =  1 - (0 + \int_{0}^{y}\frac{1}{2}dy) = 1-\frac{y}{2}$
Case $3:$ if $1 < y < \infty$
Then $F(y) = 1 - P(X \le y) =  1 - (\frac{1}{2} + \int_{1}^{y}\frac{1}{y^2}dy) = \frac{1}{2}+\frac{1}{y}-1$
Then on differentiating we can get the probability density function.
I thibk that the distribution function that i got is not correct . Can someone help me out please

The PDF of $X$ is given by
$$
f_X(x) = \left\{ \begin{array}{ccc}
 0 & \mbox{if} & x \leq 0 \\[2mm]
 {1 \over 2} & \mbox{if} & 0 < x < 1 \\[2mm]
{1 \over 2 x^2} & \mbox{if} & 1 < x < \infty \\[2mm]
\end{array} \right. \tag{1}
$$
Thus, $X$ is a positive random variable.
Since $Y = {1 \over X}$, it is immediate that $Y$ is also a positive random variable.
Hence,
$$
F_Y(y)= P(Y \leq y) = 0 \ \ \mbox{for} \ \ y < 0. \tag{2}
$$
Fix $y$ in the interval $0 < y < 1$.
Then ${1 \over y} > 1$.
Now, we find that
$$
F_Y(y) = P(Y \leq y) = P\left( {1 \over X} \leq y \right) =
P\left( X \geq {1 \over y} \right)
$$
which can be evaluated using (1) as
$$
F_Y(y) = \int\limits_{1 \over y}^\infty \ {1 \over 2 x^2} \ dx =
{1 \over 2} \ \left[ - {1 \over x} \right]_{1 \over y}^\infty 
$$
or
$$
F_Y(y) = {1 \over 2} \ \left[ 0 + y \right] = {y \over 2} 
$$
Thus,
$$
F_Y(y) = {y \over 2} \ \ \mbox{for} \ \ 0 < y < 1. \tag{3}
$$
Next, we fix in the interval $y > 1$.
Then it follows that $0 < {1 \over y} < 1$.
Now,
$$
F_Y(y) = P(Y \leq y) = P\left( {1 \over X} \leq y \right) =
P\left( X \geq {1 \over y} \right) = 1 - P\left( X \leq {1 \over y} \right)
$$
which can be evaluated using (1) as
$$
F_Y(y) = 1 - \int\limits_{0}^{1 \over y} \ {1 \over 2} \ dx = 
1 - {1 \over 2} \left[ {1 \over y} - 0 \right] = 1 - {1 \over 2 y}.
$$
Thus,
$$
F_Y(y) = 1 - {1 \over 2 y} \ \ \mbox{for} \ \ y > 1 \tag{4}
$$
Combining the three cases, we find that
$$
F_Y(y) = \left\{ \begin{array}{ccc}
0 & \mbox{if} & y \leq 0 \\[2mm]
{y \over 2} & \mbox{if} & 0 < y < 1 \\[2mm]
1 - {1 \over 2 y} & \mbox{if} & y > 1 \\[2mm]
\end{array} \right. \tag{5}
$$
From (5), we find the PDF of $Y = {1 \over X}$ as
$$
f_Y(y) = F_Y'(y) = \left\{ \begin{array}{ccc}
0 & \mbox{if} & y \leq 0 \\[2mm]
{1 \over 2} & \mbox{if} & 0 < y < 1 \\[2mm]
 {1 \over 2 y^2} & \mbox{if} & y > 1 \\[2mm]
\end{array} \right. \tag{6}
$$
