# Distribution of Functions of One or Two Random Variables

I just wanted to confirm my understanding related to the distributions of functions of random variables. Can someone please tell me if all of my points are correct and make sense? I also have an example that I can't grasp yet. As a convention, I use $$v(y)$$ as an inverse function of $$x$$

1. For the discrete r.v $$X$$, we can find the pdf of $$Y=U(X)$$ by: $$P(Y=y)=P(U(X)=y)=P(X=v(y)), y\in S_Y$$. where $$\forall y \in S_y \ \forall x \in S_x \ y=u(x)$$(my notation here might be slightly incorrect, but I imply that we can simply find the Support of $$Y$$ by applying the $$u(x)$$ on every $$x$$)

2. For the continuous r.v there are 2 ways to do that: either through the distribution function technique or through the change of variable technique.

For the distribution function technique, we make use of the fact that $$F'_Y(y)=f_y(y)$$ ,so we simply express the probability $$P(Y\le y)=P(X\le v(y))$$, solve the integral, and differentiate the result to obtain $$f_y(y)$$

For the change of variable technique, we take into account that $$f_Y(y)=f(v(y))|v'(y)|$$ for one-to-one function and $$f_Y(y)=f(v(y1))|v'(y1)|+f(v(y2))|v'(y2)|$$ for a two-to-one function and do the same steps as for one-to-one function.

3)For the joint probability distribution of functions of r.v, $$Y1=g1(X1,X2)$$ and $$Y2=g2(X1,X2)$$ we use the following formula: $$f_{Y_1Y_2}(y1,y2)=f_{X_1,X_2}(x_1,x_2)|J(x_1,x_2)|^{-1}$$, where $$x_1=h_1(y_1,y_2)$$ and $$x_2=h_2(y_1,y_2)$$ , $$J$$ is a Jacobian determinant.

If everything so far is correct and I haven't made a single mistake, there's an example related to this topic I don't seem to understand.

## Example

Let $$X_1\sim \chi^2(2),X_2\sim \chi^2(2)$$ , $$X_1,X_2$$ are independent. Find the pdf of $$Y=X_1+X_2$$. My main issue with this question is that it doesn't seem to be one of the cases I discussed above. How would you approach this problem? Also, how would your approach change if $$X_1, X_2$$ were actually not independent?

P.S. Sorry for the lengthy question but I felt that the problem I am having with the given example is related to my understanding, so I included my explanation as well.

You are on the right lines. You have assumed that the inverse function $$v$$ exists and that $$u$$ is increasing.
If $$u$$ is not increasing then your distribution function equation $$P(Y\le y)=P(X\le v(y))$$ won't hold. Instead, $$P(Y\le y)=\int_{u^{-1}((-\infty,y])}f_X(x)dx$$, where $$u^{-1}(S)$$ is the pre-image of the set $$S$$ under $$u$$.
And if $$u$$ is not invertible, then your change of variable equation doesn't hold because $$v$$ doesn't exist. Instead you would need: $$f_Y(y) = \sum_{x \in u^{-1}(\{y\})}\frac{f_X(x)}{|u'(x)|}$$.