# Probability density function of $Z = X \sin Y$

The probability density function of a random variable $X$ is a uniform distribution $U(a,b)$. Likewise, the probability density function of a random variable $Y$ is a uniform distribution $U(0, 2\pi)$. $X$ and $Y$ are independent of each other.

What is the probability density function of $Z = X \: \sin{Y}$ ?

Recall that a general procedure to compute the distribution of $Z=X\sin Y$ when $(X,Y)$ are independent with densities $f_X$ and $f_Y$ is to compute $E[u(Z)]$ for every bounded measurable function $u$. If it happens that $$E[u(Z)]=\int_\mathbb Ru(z)g(z)\mathrm dz,$$ then $g$ is the density of $Z$. Here, $$E[u(Z)]=\iint u(x\sin y)f_X(x)f_Y(y)\mathrm dx\mathrm dy,$$ hence the job is to transform this double integral into the simple integral above. The way to do that is rather clear: change of variables.

Consider $(z,t)=(x\sin y,x\cos y)$ and assume for example that $X$ is uniform on $(0,1)$ and $Y$ uniform on $(0,2\pi)$, then $\mathrm dz\mathrm dt=x\mathrm dx\mathrm dy$ and $x^2=z^2+t^2$ hence $$E[u(Z)]=\iint_{z^2+t^2\leqslant1} u(z)\frac{\mathrm dz\mathrm dt}{2\pi\sqrt{t^2+z^2}},$$ and one sees that $$g(z)=\mathbf 1_{|z|\leqslant1}\int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}}\frac{\mathrm dt}{2\pi\sqrt{t^2+z^2}}=\frac1\pi\mathbf 1_{|z|\leqslant1}\int_0^{\sqrt{1-z^2}/z}\frac{\mathrm dt}{\sqrt{t^2+1}},$$ that is, $$g(z)=\frac1\pi\cosh^{-1}\left(\frac1z\right)\mathbf 1_{|z|\leqslant1}.$$

• Thank you for your great answer, but I prefer the one of @wolfies because it is more complete. Nov 29, 2013 at 13:36
• @Medicalphysicist No problem (and thanks for the accompanying comment). Are you able to derive the formulas stated in the accepted post?
– Did
Nov 29, 2013 at 13:38
• You are right, this is a big plus of your answer. Maybe I'm more prone to accept the @wolfies answer because as a physicist I've difficulties to understand your answer. It's a pity that I can't choose both. Nov 29, 2013 at 13:41
• @Medicalphysicist Difficulties to understand an answer are a parameter you had not mentioned yet. Sorry to hear that. You might want to expand on said "difficulties" (that is, if the learning process of overcoming them interests you--by contrast with, say, simply getting an answer).
– Did
Nov 29, 2013 at 13:46
• @wolfies: You might want to remove your comment since it does not apply at all. To Did: +1 for the "let us calculate ${\rm E}[u(Z)]$ for bounded measurable $u$" approach. Nov 29, 2013 at 15:01

Case 1: $$(0 < a < b)$$ To proceed, let $$X$$ have pdf $$f(x)$$: where I am initially assuming parameter $$a$$ is positive. I will consider the alternative cases later. Second, let $$W = sin(Y)$$ with pdf $$\phi(w)$$: The latter is relatively straightforwards to derive.

Next, we seek the pdf of the product of two random variables, namely $$Z = X * W$$. This can be cumbersome to do by hand, but can be derived easily using the TransformProduct function in the mathStatica suite. In particular, the pdf of $$Z$$, say $$g(z)$$ is: All done. (I should add I am one of the authors of the software.)

Here is a plot of the theoretical pdf derived $$g(z)$$ (in red) when $$a = 2$$ and $$b = 5$$, and superimposed on top a Monte Carlo check (in blue). The other 2 cases (with parameter $$a< 0$$) are derived in identical fashion ... just change the assumptions on parameters $$a$$ and $$b$$ in the first input. Doing so yields:

Case 2: $$(a < 0, b > 0)$$

The solution pdf is $$g(z)$$: Here is a plot of the solution pdf $$g(z)$$ when $$a = -3, b = 2$$: Case 3: $$(a < b < 0)$$

The solution pdf is $$g(z)$$: Here is a plot of the solution pdf $$g(z)$$ when $$a = -4, b = -2$$: Remember that c. d. f. of $Z$ is $$P\{Z<z\}=P\{X\sin Y<z\}=\iint\limits_{x\sin y<z} p_{XY}(x,y)dxdy=\int\limits_{-\infty}^{+\infty}dx\int\limits_{-\infty}^{z/x}p_{XY}(x,y)dy=\\=\int\limits_a^{b}dx\int\limits_{0}^{z/x}p_{XY}(x,y)dy$$

The probability density function will then be $$\frac{d}{dz}\left(\int\limits_a^{b}dx\int\limits_{0}^{z/x}p_{XY}(x,y)dy\right)$$