The PDF of a Function of Two Random Variables
Shoichi Midorikawa
General Formula
Let \(X\) and \(Y\) be two independent continuous random variables. Suppose \(Z\) is a function of \(X\) and \(Y\), i.e., \(z = \varphi(x, y)\), then the pdf of \(z\) is \[ f_Z(z) = \int \delta \left(z-\varphi(x, y) \right) f_X(x) f_Y(y) \, dx \, dy \] where \( \delta \left(z-\varphi(x, y) \right) \) is the Dirac delta function.
To evaluate the integral, it is convenient to use the formula \[ \delta\left( g(x) \right) = \sum_i \frac{1}{|g'(\alpha_i)|}\delta(x-\alpha_i) \] where \(\alpha_i\) is a solution of \( g(x)=0 \), namely, \( g(\alpha_i)=0 \) .
The following are representative examples.
1. \(\bf Z=X+Y\)
\begin{eqnarray*} f_Z(z) &=& \int \delta(z-x-y)f_X(x)f_Y(y)\, dx\, dy \\ &=& \int f_X(z-y) f_Y(y)\, dy \end{eqnarray*}2. \(\bf Z=X-Y\)
\begin{eqnarray*} f_Z(z) &=& \int \delta(z-x+y)f_X(x)f_Y(y)\, dx\, dy \\ &=& \int f_X(z+y) f_Y(y)\, dy \end{eqnarray*}3. \(\bf Z=XY\)
\[ f_Z(z) = \int \delta(z-xy)f_X(x)f_Y(y)\, dx\, dy \\ \]4. \(\bf Z=X/Y\)
\[ f_Z(z) = \int \delta\left(z-\frac{x}{y}\right)f_X(x)f_Y(y)\, dx\, dy \\ \]5. \(\bf Z=X^Y\)
\[ f_Z(z) = \int \delta(z-x^y)f_X(x)f_Y(y)\, dx\, dy \\ \] \[ {\rm Let} \ \ g(x) = z-x^y. \] \[ {\rm Then, \ \ from}\ \ g(x)= 0, \ \ x = z^{1/y} . \] \[ {\rm From}\ \ g'(x) = -yx^{y-1}, \] \[ g'(z^{1/y}) = - y z^{1-1/y}. \]For more details, see PDFs of X + Y, XY, X/Y , and XY