# Probability density of analytical function on 3 random variables

I know some methods to obtain the probability distribution of functions on a random variable:

CDF method: If $$X$$ is a random variable and $$Y=f(X)$$, then computing the cumulative distribution function $$F(Y)=P(Y\leq y)=P(f(X)\leq y)=\int_{x=x_0}^{f^{-1}(y)} f(x)dx$$, and $$F'(y)=f_Y(y)$$

Product of 2 probability distributions: X and Y are RV with $$f_X(x)$$, $$f_Y(y)$$ PDF, Z=XY, $$f_Z(z) = \int_{-\infty}^{\infty}f_X(x) f_Y(z/x)\frac{1}{|x|} dx$$

Sum of 2 probability distributions: X and Y are RV with $$f_X(x)$$, $$f_Y(y)$$ PDF,$$Z=X+Y$$, $$f(z)=f_X*f_Y$$ is the convolution of the two PDF.

I'm trying to obtain the probability density function of the function on 3 random variables $$\theta$$, $$G_1$$ and $$G_2$$:

$$\cos(\theta)G_1-\sin(\theta)G_2$$,

$$\theta$$ uniformly distributed in $$\theta\in[0,2\pi]$$. $$G_1$$ and $$G_2$$ are independent Gaussians. I think that I can not apply the multiplication rule at both sides of the substraction and then the convolution of both just because of $$\cos(\theta)$$ and $$\sin(\theta)$$ are 2 functions on the same random variable, they are correlated...

Thanks!

One way is to use conditional distributions.

Assuming $$G_1 \sim N(0,1), G_2 \sim N(0,1) , \theta \sim Uniform(0,2\pi)$$ and that all variables are independent we can use the useful rule, that $$\cos(\theta)G_1 - \sin(\theta)G_2 \: | \: \theta =x \sim \cos(x)G_1-\sin(x)G_2$$ Now for any $$x\in[0,2\pi]$$ we have by properties of the normal distribution, that $$\cos(x)G_1 - \sin(x)G_2 \sim N(0,\cos^2(x)+\sin^2(x)) = N(0,1).$$ But this means that the conditional distribution of $$\cos(\theta)G_1 - \sin(\theta)G_2$$ given $$\theta$$ does not depend on the value of $$\theta$$ and we can thereby conclude, that $$\cos(\theta)G_1-\sin(\theta)G_2 \sim N(0,1)$$ and also that $$\cos(\theta)G_1-\sin(\theta)G_2$$ is independent of $$\theta$$.

Edit: More generally, if we are able to find the conditional pdf $$f_{Y|X}(y \: | \: x)$$, where $$X$$ is a $$k$$-dimensional vector, then we can find the joint pdf as $$f_{X,Y}(x_1,x_2,...,x_k,y)=f_{Y|X}(y|x_1,x_2,\dots,x_k)f_X(x_1,\dots,x_k)$$ and from here we can find the marginal pdf of $$Y$$ as $$f_Y(y) = \int_{\mathbb{R}^k} f_{X,Y}(x_1,x_2,...,x_k,y) \: d(x_1,x_2,\dots , x_k)$$

Now suppose $$Y= \frac{\cos(\theta_1)+\cos(\theta_2)}{2}G_1 - \frac{\sin(\theta_1)+\sin(\theta_2)}{2}G_2$$ and $$X=(\theta_1,\theta_2)$$. We can again use the useful rule to conclude, that \begin{align*} Y|X=(x_1,x_2) &\sim N(0,(\frac{\cos(x_1)+\cos(x_2)}{2})^2 + (\frac{\sin(x_1)+\sin(x_2)}{2})^2 ) \\ &= N(0,\cos^2(\frac{x_1-x_2}{2})) \end{align*} This distribution is degenerate if $$\cos^2(\frac{x_1-x_2}{2})=0$$, but if $$X$$ is assumed continuous, then we can ignore this case, since it will happen with probability $$0$$. From here you can compute \begin{align*} f_Y(y) &= \int_{-\infty}^\infty \int_{-\infty}^\infty f_{Y|X}(y \: | \: x_1,x_2)f_{\theta_1,\theta_2}(x_1,x_2) \: dx_1 dx_2 \\ &= \int_{0}^{2\pi} \int_{0}^{2\pi} \frac{1}{\sqrt{2\pi}\cos(\frac{x_1-x_2}{2})}\exp(-\frac{y^2}{2\cos^2(\frac{x_1-x_2}{2})}) f_{\theta_1,\theta_2}(x_1,x_2) dx_1 dx_2 \end{align*} assuming that angles are in $$(0,2\pi)$$.

Thanks Kristensen!

Damn, maybe I shown the worst example, I understood that you reduced the problem to a linear combination of Normal distributions due to the relations $$\sin(x)^2 + \cos(x)^2 = 1$$, $$aN(0,1) = N(0,a^2)$$ and $$N(0,b)+N(0,c) = N(0,b+c)$$.

What if I have some distribution in $$\theta$$ ($$\theta_1$$, $$\theta_2$$) which not reduces the problem in this way?

For instance:

$$\frac{\cos(\theta_1) + \cos(\theta_2)}{2}G_1 - \frac{\sin(\theta_1) + \sin(\theta_2)}{2}G_2$$

Doing simulations I know that the PDF must have a shape similar to $$e^{-|x|}$$ but I'm not able to obtain the pdf.

Thanks a lot!

• I made an edit to the answer that handles the more general case. I do not believe that it was a bad example. Simple examples often improve understanding much more than complicated examples. May 17, 2020 at 14:52