Fnd the pdf of $\cos(X)$ when $X$ has pdf $f(x)=\frac{x}{2\pi^2}$ for $0<x<2\pi$

change-of-variabledensity functionprobability distributions

$X$ is continuous random variable with PDF

$$f(x) = \begin{cases} \dfrac{x}{2\pi^2}, & 0<x<2\pi \\ 0, & \text{otherwise} \end{cases} $$

Find the PDF of $Y = \cos(X)$

Now $g(x) = \cos(x)$ is monotone on $[0, \frac{3\pi}{2}]$ and $[\frac{3\pi}{2}, 2\pi]$.

Let $Y = \cos(X)$ then the support of $Y$ is $S_Y = [-1,1]$.

For $0\leq y < 1$

\begin{align*}
f_Y(y)
&= f_X(g^{-1}(y))\left|\frac{dx}{dy}\right|_{x\in[0, \frac{\pi}{2}]} + f_X(g^{-1}(y))\left|\frac{dx}{dy}\right|_{x\in[\frac{3\pi}{2}, 2\pi ]} \\
&= \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot2\pi^2} + \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot2\pi^2} \\
&= \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot\pi^2},
\end{align*}

and for $-1<y\leq 0$

\begin{align*}
f_Y(y)
&= f_X(g^{-1}(y))\left|\frac{dx}{dy}\right|_{x\in[\frac{\pi}{2}, \pi]} + f_X(g^{-1}(y))\left|\frac{dx}{dy}\right|_{x\in[\pi, \frac{3\pi}{2}]} \\
&= \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot2\pi^2} + \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot2\pi^2} \\
&= \frac{\cos^{-1}(y)}{\sqrt{1-y^2}\cdot\pi^2},
\end{align*}

and $0$ otherwise.

Is this correct?

Best Answer

First, $\cos(\cdot)$ is monotone on $[0, \pi]$ and on $[\pi, 2\pi]$. But I guess it is a typo. A more serious problem is that the inverse function of $\cos(\cdot)$ over $[\pi, 2\pi]$ is not $\arccos(\cdot)$, but rather $2\pi-\arccos(\cdot)$. A correct solution would look like this:

Let $g_1 : [0, \pi] \to [-1, 1]$ and $g_2: [\pi, 2\pi] \to [-1, 1]$ be the restrictions of $\cos(\cdot)$. Then

$$ g_1^{-1}(y) = \arccos(y) \qquad \text{and} \qquad g_2^{-1}(y) = 2\pi - \arccos(y). $$

So, for each $-1 < y < 1$,

\begin{align*} f_Y(y) &= f_X(g_1^{-1}(y)) \cdot |(g_1^{-1})'(y)| + f_X(g_2^{-1}(y)) \cdot |(g_2^{-1})'(y)| \\ &= \frac{\arccos(y)}{2\pi^2} \cdot \frac{1}{\sqrt{1-y^2}} + \frac{2\pi - \arccos(y)}{2\pi^2} \cdot \frac{1}{\sqrt{1-y^2}} \\ &= \frac{1}{\pi\sqrt{1-y^2}}. \end{align*}