[Math] Change of variable on a probability density function – $\sin(x)$

probabilityprobability theory

Problem:
Let $y = \sin{X}$, where $X$ is a uniformly distributed over $(0, 2 \pi)$. Find the pdf of $Y$.
Answer:
In this case we have:
\begin{eqnarray*}
f_x(x) &=& \frac{1}{2 \pi} \\
h(x) &=& \sin(x) \\
\end{eqnarray*}
We know that:
\begin{eqnarray*}
f_y(y) &=& f_y(x) \Big| \frac{dx}{dy} \Big| \\
\end{eqnarray*}
\begin{eqnarray*}
\sin^{-1}y &=& x \\
\frac{dx}{dy} &=& \frac{1}{\sqrt{1 – y^2}} \\
f_y(y) &=& \frac{1}{2 \pi} \Big| \frac{1}{\sqrt{1 – y^2}} \Big| \\
\end{eqnarray*}
Now we have to consider the limits. The maximum value of $\sin(x)$ is $1$. The minimum value of $\sin(x)$ is $-1$.
\begin{eqnarray*}
f_y(y) = \begin{cases}
\frac{1}{2 \pi \sqrt{1 – y^2}} & -1< y < 1 \\
0 & otherwise \\
\end{cases}
\end{eqnarray*}
However, the book gets:
\begin{eqnarray*}
f_y(y) &=& \begin{cases}
\frac{1}{\pi \sqrt{1 – y^2}} & -1 < y < 1 \\
0 & otherwise \\
\end{cases}
\end{eqnarray*}
What am I missing?
Thanks,
Bob

Best Answer

We know that: $$f_y(y) = f_y(x) \left| \frac{dx}{dy} \right|$$

This part is wrong. This holds only when the change of variables is invertible. And your function $x \mapsto \sin x$ is definitely not invertible on $(0,2\pi)$.

In this case you may want to get into the basic principles. The p.d.f. of a continuous random variable is defined as the derivative of the c.d.f. of $X$

$$ f_X(x) = \frac{d}{dx}\mathbb{P}(X \leq x) $$

and we know how to deal with c.d.f. In our case, $Y$ can take values in $[-1,1]$ so it is only meaningful to investigate the range $y \in [-1, 1]$. Then

$$\mathbb{P}(Y \leq y) = \mathbb{P}(\sin X \leq y) = \frac{2\pi - 2\arccos y}{2\pi}. $$

(If you can't see this easily, consider two cases $y \in [0, 1]$ and $y \in [-1, 0]$ separately and try to read out the above probability from the graph of the sine function.) So we have

$$ f_Y(y) = \frac{d}{dy}\mathbb{P}(Y \leq y) = \frac{1}{\pi\sqrt{1-y^2}} $$

when $y \in [-1, 1]$ and $f_Y(y) = 0$ outside $[-1, 1]$.

Related Question