Let $\theta$ is a random variable which uniform distributed $(-\pi,\pi)$, with probability density function
$$f(\theta)=\begin{cases}\dfrac{1}{2\pi}, -\pi<\theta<\pi\\
0, \text{otherwise}\end{cases}.$$
Let $Y=\cos\theta $. Find the probability density function of $Y$.
To answer this question I'm using Jacobian transformation like this.
$Y=\cos\theta$ imply $\theta=\arccos Y$.
The Jacobian is
$$\vert J\vert = \left\vert\dfrac{d\theta}{dy}\right\vert= \left\vert-\dfrac{1}{\sqrt{1-y^2}}\right\vert=\dfrac{1}{\sqrt{1-y^2}}.$$
So I have
$$g_Y(y)=f(\theta)\vert J\vert=f(\arccos Y)\vert J\vert=\dfrac{1}{2\pi\sqrt{1-y^2}}.$$
To find the range of $y$, I try to plot the cosine graphics from $\theta=-\pi$ to $\theta=\pi$ like this.
We can see that the range of $y$ is $-1<y<1$. So I have
$$
g_Y(y)=\begin{cases}\dfrac{1}{2\pi\sqrt{1-y^2}}, -1<y<1\\
0, \text{otherwise}\end{cases}.
$$
Now I want to check that $g(y)$ is a probability density function with the property of pdf.
\begin{eqnarray}
\int\limits_{-1}^{1} \dfrac{1}{2\pi\sqrt{1-y^2}} dy
&=& \left[-\dfrac{1}{2\pi} \arccos y\right]_{-1}^1\\
&=& -\dfrac{1}{2\pi} \arccos (1)+\dfrac{1}{2\pi} \arccos (-1)\\
&=& -\dfrac{1}{2\pi} (0)+\dfrac{1}{2\pi} (\pi)\\
&=& \dfrac{1}{2}.
\end{eqnarray}
If $g(y)$ is p.d.f. the integral should be $1$.
What is my mistake in my work? Did I make a mistake in determining the range of $y$ or the transformation?
Best Answer
The reason for the discrepancy is the following: The connection between the $\theta$-domain and the $y$-domain is not bijective, but $2:1$.
I'd argue as follows: When $Y=\cos\Theta$ then we know that $-1\leq Y\leq 1$. Let $G$ be the cumulative distribution function of $Y$. Then $$G(y)=P(Y\leq y)=P(\cos\Theta\leq y)=P(\arccos y\leq|\Theta|\leq\pi)=2{\pi-\arccos y\over2\pi}\ .$$ This gives $$g_Y(y)=G'(y)={1\over\pi\sqrt{1-y^2}}\qquad(-1\leq y\leq1)\ .$$