# Cosine of a uniform random variable

I have to find pdf of $Y = \cos(X)$ where $X$ is a random variable distributed uniformly in $[-\pi,\pi]$. I solved this using distribution function method, and the result was:

$f_{Y}(y) = \dfrac{1}{\pi \sin(\cos^{-1}y)}, y \in\ [-1,1]$

I am not able to understand this result intuitively. At first thought, it occurred that $\cos(X)$ should be distributed uniformly as well, but that is clearly wrong. I completely fail to understand why the pdf of $\cos(X)$ goes to $\infty$ at $-1$ and $1$ as well.

Please help me form an intuitive understanding of this result, I am not from a statistics background.

Here's a mostly intuitive explanation of the general appearance of the result. Consider just the right half of the original $y$ range (the other half is symmetric about zero to what happens here).

Where do the values end up? Which values go close to 1? To 0?

Clearly, from inspection of the $\cos$ function, small $y$ values will become values close to $1$, while values of $y$ near $\pi$ are mapped to near $-1$ and values near $\pi/2$ are mapped to near $0$.

Near $y=\pi/2$ the $\cos$ function is almost linear, and so uniformly distributed $Y$ values will remain nearly uniform after transformation (just rescaled almost-linearly - in this case, the linear transform that it's close to in this vicinity flips values around and shifts them along).

Near $y=0$ the $\cos$ function is almost quadratic, $\text{cos}\, y \approx 1-y^2/2$. So what happens to $y$ values between 0 and $\varepsilon$ for small $\varepsilon$?

They get mapped to values between $1-\varepsilon^2/2$ and $1$. So they're bunched into a space that is about $\varepsilon/2$ as large as where they came from. So it has to get (on average) $2/\varepsilon$ times as dense in there - a big number.

e.g. values between 0 and 0.01 roughly go to between 1-0.00005 and 1. So they're squeezed into one two-hundredth the space and so need to average 200 times the density in there, and it gets bigger the closer in you go.

There's a similar effect on $y$ values close to $\pi$ but they map to near $-1$.

So the overall appearance is intuitively clear - the density should look flat near zero and increase dramatically - indeed, without bound, near the endpoints.

(Note that $\text{sin}(\text{cos}^{−1}y) = \sqrt{1-y^2}$ here. This doesn't affect the above intuitive explanation for why it must look like this, but is useful if you're trying to use the usual algebraic methods for calculation of the density of the transformed variable.)