# PDF of cosine of a uniform random variable

There is a formula for the density of the cosine of random variable that's a uniform on $(-\pi,\pi)$ as discussed in this page: $f_{Y}(y) = \dfrac{1}{\pi \sin(\cos^{-1}y)}, y \in\ [-1,1]$

Can anyone please show how this formula is derived in detail.

First note that $$\cos$$ is an even function; $$\cos(-X)=\cos(X)$$. Consequently it's the same as taking $$\cos(W)$$ where $$W=|X|$$ (or indeed you could work instead with $$\cos(-W)$$). Now $$W$$ is uniform on $$[0,\pi)$$. This is easier because the $$\cos$$ function is now monotonic over the values taken by the new variable and is now invertible.

Let $$Y=\cos(W)$$. Note that $$P(W\leq w) = w/\pi$$

$$\begin{eqnarray} F_Y(y)&=&P(Y\leq y)\\ &=&P(\cos(W)\leq y) \\ &=& P(W\geq \cos^{-1}(y)) \\ &=& P(W\leq \cos^{-1}(-y)) \\ &=&\cos^{-1}(-y)/\pi \\[20pt] f_Y(y)&=&\frac{d}{dy}F_Y(y)\\ &=&\frac{1}{\pi}\frac{d}{dy}\cos^{-1}(-y) \end{eqnarray}$$

Now $$\frac{d}{dx} g^{-1}(x) = \frac{1}{g'(g^{-1}(x))}$$, so

$$\begin{eqnarray} \frac{1}{\pi}\frac{d}{dy}\cos^{-1}(-y)&=& -\frac{1}{\pi}\frac{d}{dy}\cos^{-1}(y)\\ &=& \frac{1}{\pi}\cdot\frac{1}{\sin(\cos^{-1}(y))}\,,\:-1

Or, using the fact that $$\frac{d}{dx}\cos^{-1}(x)=-\frac{1}{\sqrt{1-x^2}}$$,

$$\begin{eqnarray} -\frac{1}{\pi}\frac{d}{dy}\cos^{-1}(-y)&=&\frac{1}{\pi}\cdot \frac{1}{\sqrt{1-y^2}}\,,\:-1

• Thank you very much. Your quick and detailed response was very helpful. – M.H Oct 23 '17 at 9:59