transformation of uniformly distributed random variable f(x)=1/2pi into Y=cosx Let $X$ be a uniformly distributed function over $[-\pi;\pi]$.  That is
$
f(x)=\left\{\begin{matrix}
\frac{1}{2 \pi}  & -\pi\leq x\leq \pi  \\ 
0 & otherwise
\end{matrix}\right.\\
$
Find the probability density function of  $Y = \cos X$.
I figured out how to derive the final result using the change of variable method, but don't quite get why it needs to be multiplied by $2$.
I cannot get the result using the other cdf method at all.
Would you please help and clarify the steps of the both methods (variable change and cdf) for this type of the problem?
$$f(x)=y=cos(x) $$
$$f^{-1} (y) = \arccos(y)$$
$$f^{-1} (y)'= 1 /  \sqrt{1-y^2}$$
$$fy(y)= \mathbf 2 \cdot \left(\frac{1}{2\pi}\right) \cdot \left|-1/\sqrt{1-y^2}\right| 
= \frac 1\pi \cdot \sqrt{1-y^2}$$

 
using cdf method
\begin{align}
Fy(y) &= P(Y \leq y) = P(\cos x \leq y) = P(x \leq -\arccos y) + P(x \geq \arccos y) \\ \\
&= \int_{-\pi}^{-\arccos(y)} \frac{1}{2 \pi} \; dx + \int_{\arccos(y)}^{\pi} \frac{1}{2 \pi} dx
  = \left[\frac{x}{2 \pi}\right]_{-\pi}^{-\arccos(y)}
    + \left[\frac{x}{2 \pi}\right]_{\arccos(y)}^{\pi} \\ \\
&= \frac{-\arccos(y)}{2 \pi} - \frac{-\pi}{2 \pi} + \frac{\pi}{2 \pi} -\frac{\arccos(y)}{2 \pi} \\ \\
&= \frac{-\arccos(y)}{2 \pi} + \frac{\pi}{2 \pi} - \frac{arccos(y)}{2 \pi} + \frac{\pi}{2 \pi} = 1- \frac{\arccos(y)}{ \pi} \\ \\
f(y) &= F'(y) = \left(1- \frac{\arccos(y)}{ \pi}\right)' = \frac{1}{\pi \sqrt{1-y^2}}
\end{align}
 A: We deal with your question about why we multiply by $2$.  We are interested in finding the cumulative distribution function $F(y)$ of $Y$. The only interesting part is when $-1\lt y\lt 1$, because $F(y)=1$ if $y\ge 1$ and $F(y)=0$ when $y\le -1$.
It is geometrically perhaps a little easier to find $G(y)=\Pr(Y\gt y)$. Then the probability that $Y\le y$ is $1-G(y)$.  For $y$ between $-1$ and $1$, $Y\gt y)$ when $-\arccos y\lt X\lt \arccos y$.  This interval has length $2\arccos y$, and therefore for $y$ between $-1$ and $1$ we have $F(y)=1-\frac{2\arccos y}{2\pi}$. 
If we deal with $F(y)$ directly, note that there are two intervals (of equal length) in which $\cos x\le y$. 
A: since we have $x$ belongs to $[-\pi,\pi]$ the $\arccos(x)$ can be written with two signs ($-$ & $+$) , that's why we have:
$$fy(y)=\frac 1{ 2\pi}  |\frac{-1} {\sqrt{1-x^2}}|  +  \frac 1 {2\pi}   |\frac 1 {\sqrt{1-x^2}}|$$
So
$$fy(y)=2* \frac 1 {2\pi} *  |\frac 1 {\sqrt{1-x^2}}|$$
Finally,
$$fy(y)= \frac 1 \pi \frac 1 {\sqrt{1-x^2}}$$
That's it
Best regards
