Probability Problem - Finding a pdf Below is a problem I did. However, I did not come up with the answer in book.
I am thinking that I might have the wrong limits for the integral. I am hoping
somebody can point out what I did wrong.
Bob
Problem
Let $Y = \sin X$, where $X$ is uniformly distributed over $(0, 2 \pi)$. Find
the pdf of $Y$.
Answer:
\begin{eqnarray*}
P(Y<=y_0) &=& P( \sin x <= y_0 ) = P( x <= \arcsin( y_0) ) \\
P(Y<=y_0) &=& \int_0^{\arcsin(y_0)} \frac{1}{2 \pi} dx =
    \frac{x}{2 \pi} \Big|_0^{\arcsin(y_0)} =
    \frac{\arcsin(y_0)}{2 \pi} - \frac{0}{2 \pi} \\
P(Y<=y_0) &=& \frac{\arcsin(y_0)}{2 \pi} \\
F(Y) &=& \frac{\arcsin(Y)}{2 \pi} \\
f(y) &=& \frac{1}{2 \pi \sqrt{1 - y^2}} \\
\end{eqnarray*}
However, the book gets:
\begin{eqnarray*}
f(y) &=& \frac{1}{\pi \sqrt{1 - y^2}} \\
\end{eqnarray*}
I believe that book is right because
\begin{eqnarray*}
\int_{-1}^{1} \frac{1}{\pi \sqrt{1 - y^2} } dy &=&
    \frac{\arcsin{y}}{\pi} \Big|_{-1}^{1} =
    \frac{\frac{\pi}{2}}{\pi} - \frac{-\frac{\pi}{2}}{\pi}  \\
\int_{-1}^{1} \frac{1}{\pi \sqrt{1 - y^2} } dy &=& 1 \\
\end{eqnarray*}
 A: If $X$ is uniform in $(0,2\pi)$, then has cdf 
$$
F_X(x)=\begin{cases}
0 & x\le 0\\
\frac{x}{2\pi} & x\in (0,2\pi)\\
1 & x\ge 2\pi
\end{cases}
$$
The  random  variable $Y=\sin (X)$ takes  values  on $(-1,1)$. Hence, $\Bbb P(Y\le y) = 0$ for $y \le -1$ and $\Bbb P(Y\le y) = 1$ for $y \ge 1$. Let now $y \in (-1, 1)$. We have
$$
F_Y(y)=\Bbb P(Y\le y)=\Bbb P(\sin (X)\le y)
$$
The equation $\sin(x) = y$ has two solutions in the interval $(0, 2\pi)$: 


*

*$x = \arcsin(y)$ and $\pi-\arcsin(y)$ for $y > 0$ 

*$x = \pi-\arcsin(y)$ and $2\pi + \arcsin(y)$ for $y < 0$. 


Hence, $Y$ has positive values if $X$ takes values in $A_1=(0,\arcsin y)$ or $A_2=(\pi-\arcsin y,2\pi)$; $Y$ has negative values if $X$ takes values in $B=(\pi-\arcsin y,2\pi + \arcsin y)$. 

So we have for $-1<y<1$, 
$$
\Bbb P(Y\le y)=\begin{cases}
\Bbb P(X\in B)& -1<y< 0\\
\Bbb P(X\in A_1\cup A_2)=\Bbb P(X\in A_1)+\Bbb P(X\in A_2)& 0<y< 1\\
\end{cases}
$$
that is
$$
F_Y(y)=\begin{cases}
F_X(2\pi + \arcsin y) -F_X(\pi-\arcsin y)& -1<y< 0\\
F_X(\arcsin y) +1-F_X(\pi-\arcsin y)& 0<y< 1\\
\end{cases}
$$
and then
$$
F_Y(y)=\frac{\pi + 2 \arcsin(y)}{2\pi},\qquad y\in (-1,1)
$$
The distribution function of $Y$ is
$$
F_Y(y)=\begin{cases}
0 & y\le 0\\
\frac{\pi + 2 \arcsin(y)}{2\pi} & y\in (-1,1)\\
1 & y\ge 1
\end{cases}
$$
We differentiate the above expression to obtain the probability density:
$$
f_Y(y)=\begin{cases}
\frac{1}{\pi\sqrt{1-y^2}} & y\in (-1,1)\\
0 & y\notin (-1,1)
\end{cases}
$$
A: your answer is correct indeed just a little mistake. in the first step:
$$P(Y \le y) = P( \sin x \le y ) \Rightarrow P(x_1 \le x \le x_2  )$$ as shown in figure below (sorry figure is for $y=\sin(x+\theta)$ but still is useful .just draw the figure for $\sin(x)$ in your imagination. also figure is from "Probability, Random Variables and Stochastic Processes" by Papoulis A. chapter 5 example 7. which is very similar to your problem).

since $\sin(x)$ intersects with each horizontal line two times. so we can now write the right answer as below:
$$P(Y \le y)= \frac{1}{2\pi} \int_0^{x_{1}}dx+\frac{1}{2\pi} \int_{x_{2}}^{2\pi}dx$$
and we have in mind that $x_2=\pi-\arcsin(y)=\pi-x_1$ so we get:
$$P(Y \le y)= \frac{1}{2\pi} \int_0^{x_{1}}dx+\frac{1}{2\pi} \int_{x_{2}}^{2\pi}dx = \frac{1}{2\pi}\times (x_{1}+2\pi-x_{2})=\frac{1}{2\pi}\times (x_{1}+\pi+x_{1}) \\ = \frac{1}{2\pi}\times (2x_{1}+\pi)=\frac{1}{2}+\frac{1}{\pi}\arcsin(y)$$
now by taking derivative with respect to $y$ we get:
$$f(y) = \frac{1}{\pi \sqrt{1 - y^2}}$$
EDIT
To answer the question in comments, when $y=a\sin(x+\theta)$ and $x$ is uniform on $(0,2\pi)$ and we want to find $F(y),f(y)$ i.e. CDF and PDF of $y$. We want to find $F(y)=P(Y\le y)$. To find where $Y\le y$ notice that according to the figure above, this happens in two intervals (when the sine figure is less than the $y$ line) which is $x\in (-\pi,x_0)$ and when $x \in (x_1,\pi)$. Therefore
$$P(Y \le y) = P((-\pi,x_0) \cup (x_1,\pi)) = P((-\pi,x_0)) + P((x_1,\pi))$$
The total length of this interval is $(x_0 - (-\pi)) + (\pi-x_1) = 2\pi + x_0 - x_1$ and $x_0 = \text{Arcsin}\left(\frac{y}{a}\right)-\theta , x_1 = \pi - \text{Arcsin}\left(\frac{y}{a}\right) - \theta $ which results from solving $y = a\sin(x+\theta)$. Substituting these in
$$P(Y \le y) = \frac{1}{2\pi}(2\pi + x_0 - x_1) = \frac{1}{2} + \frac{1}{\pi}\text{Arcsin}\left(\frac{y}{a}\right)$$.
Also please notice that since $x_1 = \pi - x_0 - 2\theta$ the length of the interval can also be written as $L = 2\pi + x_0 - x_1 = \pi + 2x_0 + 2\theta$ which results in the same solution.
