# change of variables (probability distribution)

## 1. for strictly increasing function

- Let \(X\) be a random variable with pdf \(f_X(x)\).
- Say we have a change of variable \(Y = g(X)\)
- Then, the CDF of \(Y\) is:

\[\begin{align*} F_Y(y) &= P(Y \leq y) \\ &= P(X \leq g^{-1}(y))\\ &= F_X(g^{-1}(y)) \end{align*}\] Then, taking the derivative gives the PDF: \[f_y(y) = f_x(g^{-1}(y)) \frac{d}{dy}g^{-1}(y)\]

- here, we use the chain rule
- the monotonically decreasing case is similar.
- this result can be written as:

\[f_y(y) = f_x(x) \frac{dx}{dy}\]

- imagine trying to sweep out a little area in \(dy\) and seeing how much probability mass you accumulate. So "multiply" by \(dy\) on both sides. On the RHS, \(f_x(x) \frac{dx}{dy}dy\) is the mass you collect, where \(\frac{dx}{dy}\) is the exchange rate you pay for using \(dy\).
- this can be put another way. Think of \(f_y(y)dy = f_x(x)dx\): essentially conservation of probability mass
- taken from this stack overflow answer: https://stats.stackexchange.com/questions/239588/derivation-of-change-of-variables-of-a-probability-density-function
- useful notes also: https://www.math.umd.edu/~millson/teaching/STAT400fall18/handouts/changeofvariable.pdf