# PDF for a transformed variable

Let $Y$ have the probability density $f_Y(x)$ and let $X$ have the PDF $f_X(x)$. $X$ and $Y$ are continuous and independent from each other. If $f_Y$ and $f_X$ are known and $Z=g(X,Y)$ where $g$ is known;

How can one derive the PDF for $Z$, $f_z$?

If the general case is difficult to show, then let $g(x,y)=x+y$ for simplicity so $Z=X+Y$

• While there a number of alternative methods, in practise, some work better than others (or not at all), depending on the functional form of the distributions. The best way to go unfortunately is not known, until the problem is more specific. – wolfies Apr 30 '18 at 6:03

Let $Z = X+Y$. Then, for any fixed value of $z$, $$F_Z(z) = P\{Z \leq z\} = P\{X+Y \leq z\} = \int_{-\infty}^{\infty}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right]\,\mathrm dx$$ and so, using the rule for differentiating under the integral sign (see the comments following this answer over on math.SE if you have forgotten this) \begin{align*} f_Z(z) &= \frac{\partial}{\partial z}F_Z(z)\\ &= \frac{\partial}{\partial z}\int_{-\infty}^{\infty}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right] \,\mathrm dx\\ &= \int_{-\infty}^{\infty}\frac{\partial}{\partial z}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right]\,\mathrm dx\\ &= \int_{-\infty}^{\infty} f_{X,Y}(x,z-x)\,\mathrm dx \end{align*} When $X$ and $Y$ are independent random variables, the joint density is the product of the marginal densities and we get the convolution formula $$f_{X+Y}(z) = \int_{-\infty}^{\infty} f_{X}(x)f_Y(z-x)\,\mathrm dx ~~ \text{for independent random variables} ~X~\text{and}~Y.$$

This is a common question in basic probability. To get more details, look up Jacobian, convolution etc. Otherwise, for your question this is the answer. You can see the proof here

If $Z=X+y$, then $f_Z(z)=\int_{-\inf}^{\inf} f_X(z-y)f_Y(y) dy$

For a general $g$ it becomes a bit more complicated as you would have to simplify the following:

$f_Z(z) = \frac{\delta}{\delta z } F_Z(z)= \frac{\delta}{\delta z } \left[\int_{\mathbb{R}^2 \cap \{(x,y): g(x,y)\leq z\}} f_X(x) f_Y(y) dydx \right]$

[Note that integral gives you the CDF of $Z$ and you would need to differentiate $F_Z$ to get $f_Z$]

• For most functions $g,$ your final integral is always zero (because it integrates an area element $dxdy$ over a region of measure zero). – whuber Apr 28 '18 at 19:06
• You are right. That expression was a bit incorrect. I updated it. – Santy.8128 Apr 28 '18 at 19:56
• You are still missing a $\frac{\partial}{\partial z }$ in front of the integral $\int_{\mathbb{R}^2 \cap \{(x,y): g(x,y)\leq z\}} f_X(x) f_Y(y) dydx$. Note that the integral gives the CDF $F_Z(z)$ (e.g it converges to $1$ as $z \to \infty$) and not the pdf $f_Z(z)$. – Dilip Sarwate Apr 29 '18 at 18:15