by Matias Morant

I kept this problem in the back of my mind for 10 years. Yesterday I found a solution.

### Statement:

Given some multidimensional random variable $X$ with probability distribution $P(X)$, and a random variable $z$ defined as $z=f(X)$, what is the probability distribution $P(z)$?

1. As a surface integral:

\begin{aligned} P(z)=\int_{f(X)=z}\frac{P(X)}{|\nabla f(X)|}dS &&&&&& \text{(Eq. 1)} \end{aligned}

2. As a volume integral:

\begin{aligned}P(z)=\int_{f(X)<z}\nabla.\frac{P(X)}{\nabla f(X)}dV &&&&& \text{(Eq. 2)} \end{aligned}

where $\frac{1}{\nabla f(x)}≡\frac{\nabla f(x)}{|\nabla f(x)|^2}$

### Proof:

\begin{aligned}CDF(z)&=\int_{f(X)<z}{P(X)}dV\\\\P(z)&=\frac{d(CDF(z))}{dz}\\&=\frac{d}{dz}\int_{f(X)<z}P(X)dV\\&=\lim_{dz \to 0} 1/dz\int_{z<f(X)<z+dz}P(X)dV\\&=\int_{f(X)=z}\frac{P(X)}{\nabla f(X)}.dS&\text{(Eq. 1)}&&\text{since }dV=dS\frac{dz}{|∇f(x)|}\\&=\int_{f(X)<z}\nabla.\frac{P(X)}{\nabla f(X)}dV&\text{(Eq. 2)} && \text{by divergence theorem}\end{aligned}

## Example: $z=x+y$

### Statement

Given:

$$z=f(X)=x+y\\ P(X)=P_x(x)P_y(y)\\$$

Find $P(z)$

### Solution

Using the surface integral (Eq. 1)

\begin{aligned}P(z)&=\int_{x+y=z}\frac{P_x(x)P_y(y)}{|\nabla (x+y)|}dS\\&=\int_{x+y=z}\frac{P_x(x)P_y(y)}{\sqrt{2}}dS\\&=\int \frac{P_x(x)P_y(z-x)}{\sqrt{2}}\sqrt{2}dx\\&=\int P_x(x)P_y(z-x)dx\\&= P_x*P_y \end{aligned}