The continuous random variable [tex]X[/tex] has density [tex]f(x)=a|\cos x|[/tex] for [tex]-\pi\le x\le\pi[/tex] and [tex]f(x)=0[/tex] for [tex]|x|\gt\pi[/tex], where [tex]a[/tex] is a constant. Find the density of the random variable [tex]Y=\sin X[/tex].
Solution:
The function [tex]|\cos x|[/tex] is even, and on [tex][0, \pi][/tex] its graph is symmetric about [tex]x=\frac{\pi}{2}[/tex]. From the normalization condition
[tex]1=a\int_{-\pi}^{\pi}|\cos x|\,dx=4a\int_0^{\pi/2}\cos x\,dx=4a\Rightarrow a=\frac{1}{4}[/tex]
The function [tex]\sin x[/tex] is not monotonic on [tex][-\pi, \pi][/tex], so we work with the distribution function [tex]F_Y(y)=P(\sin X\le y)[/tex], [tex]-1\le y\le 1[/tex].
Case [tex]0\le y\le 1[/tex]. Put [tex]\alpha=\arcsin y\in\left[0, \frac{\pi}{2}\right][/tex]. On [tex][-\pi, \pi][/tex] we have [tex]\sin x\le y[/tex] exactly for [tex]x\in[-\pi, \alpha]\cup[\pi-\alpha, \pi][/tex]. By symmetry [tex]P(-\pi\le X\le 0)=\frac{1}{2}[/tex], and
[tex]P(0\le X\le\alpha)=\frac{1}{4}\int_0^{\alpha}\cos x\,dx=\frac{y}{4},\qquad P(\pi-\alpha\le X\le\pi)=\frac{1}{4}\int_{\pi-\alpha}^{\pi}(-\cos x)\,dx=\frac{\sin \alpha}{4}=\frac{y}{4}[/tex]
hence
[tex]F_Y(y)=\frac{1}{2}+\frac{y}{4}+\frac{y}{4}=\frac{1+y}{2}[/tex]
Case [tex]-1\le y\lt 0[/tex]. Put [tex]\beta=-\arcsin y\in\left(0, \frac{\pi}{2}\right][/tex], so [tex]\sin \beta=-y[/tex]. Then [tex]\sin x\le y[/tex] exactly for [tex]x\in[-\pi+\beta, -\beta][/tex], and since [tex]f[/tex] is even,
[tex]F_Y(y)=P(\beta\le X\le\pi-\beta)=\frac{1}{4}\left(\int_{\beta}^{\pi/2}\cos x\,dx+\int_{\pi/2}^{\pi-\beta}(-\cos x)\,dx\right)=\frac{2(1-\sin \beta)}{4}=\frac{1+y}{2}[/tex]
Thus [tex]F_Y(y)=\frac{1+y}{2}[/tex] on [tex][-1, 1][/tex] (with [tex]F_Y(y)=0[/tex] for [tex]y\lt -1[/tex] and [tex]F_Y(y)=1[/tex] for [tex]y\gt 1[/tex]), i.e. [tex]Y[/tex] is uniformly distributed on [tex](-1, 1)[/tex]. Differentiating, we get
[tex]f_Y(y)=\begin{cases}\frac{1}{2}, & |y|\lt 1\\ 0, & |y|\ge 1\end{cases}[/tex]
The same result follows from the formula for non-monotonic transformations: each [tex]y\in(-1, 0)\cup(0, 1)[/tex] has two preimages [tex]x_1, x_2[/tex] in [tex][-\pi, \pi][/tex], and [tex]f_Y(y)=\frac{f(x_1)}{|\cos x_1|}+\frac{f(x_2)}{|\cos x_2|}=2\times \frac{1}{4}=\frac{1}{2}[/tex].