When the transformation function $g(X)$ of the [[Derived Distributions|derived distribution]] $Y$ is [[Monotonicity|monotonic]], we can obtain the [[Probability Density Function|PDF]] of $Y$ using the inverse of $g(X)$.
> [!note:]
> This approach is often simpler than the general approach for [[General Functions of Random Variables]].
The function $g(x)$ maps $x$ to $y$, while its inverse $g^{-1}(x)$ maps $y$ back to $x$. We denote this increase function as $h(y)$.
$
\begin{align}
y&=g(x) \\
x&=g^{-1}(y) = h(y)
\end{align}
$
## Monotonic Increase
We are interested in $f_Y(y)$ and therefore we first have to derive $F_Y(y)$.
$
\begin{align}
F_Y(y) &= \mathbf P(Y \leq y) \tag{1}\\[6pt]
F_Y(y) &= \mathbf P(X \leq h(y)) \tag{2}\\[6pt]
F_Y(y)&= F_X(h(y)) \tag{3}\\
f_Y(y) &=f_X\big(h(y)\big)*\frac{dh}{dy}(y) \tag{4}
\end{align}
$
where:
* (2) The probability that $Y$ is smaller than some $y$ is equal to the probability that $X$ is smaller than the inverse of $y$.
* (3) The probability that a [[Random Variable|r.v.]] is smaller than some value is precisely a [[Cumulative Density Function|CDF]].
* (4) Differentiating both sides to to get from CDF to PDF (applying [[Differentiation Rules#Chain Rule|Chain rule]]).
## Monotonic Decrease
$
\begin{align}
F_Y(y) &=\mathbf P(Y \leq y) \tag{1}\\[6pt]
F_Y(y) &=\mathbf P(X \ge h(y)) \tag{2}\\[6pt]
F_Y(y) &=1-\mathbf P(X \leq h(y) \tag{3}\\[6pt]
F_Y(y) &=1-F_X(h(y)) \tag{4}\\
f_Y(y)&=-f_X\big(h(y)\big)*\frac{dh}{dy}(y) \tag{5}
\end{align}
$
where:
* (2) Because of the reverse relationship (when $x$ increases, then $y$ decreases), also the inequality sign flips.
* (3) Probability rewritten as $1$ minus its complement.
## Generalized PDF
In the monotonic decreasing case, the slope is negative $\frac{dh}{dy}(y)<0$. This cancels the negative sign in front of $f_X(h(y))$, resulting in a generalized equation that works for both monotonic increase and decrease:
$
f_Y(y)=f_X(h(y))*\left \vert \frac{dh}{dy}(y)\right \vert \quad \text{where }
\begin{cases}
y=g(x) \\[2pt] h=y^{-1}
\end{cases}
$
## Intuitive Explanation
The transformation scales probabilities in accordance with the slope of $g(X)$. For a small interval:
$
\overbrace{\mathbf P(x \leq X \leq x+\delta_1)}^{f_X(x)*\delta_1} \approx
\overbrace{\mathbf P(y \leq Y \leq y+\delta_2)}^{f_Y(y)*\delta_2}
$
![[derived-distribution-monotonic.png|center|400]]
We can also make a statement about the relationship between $\delta_1$ and $\delta_2$.
$
\begin{align}
\delta_2 \approx \delta_1* \frac{dg}{dx}(x) \\[4pt]
\delta_1 \approx \delta_2* \frac{dh}{dy}(x)
\end{align}
$
Using this relationship:
$
\begin{align}
f_Y(y)*\delta_2 &\approx f_X(x)*\delta_1 \tag{1}\\[4pt]
f_Y(y)*\delta_2 &\approx f_X(x)*\delta_2*\frac{dh}{dy}(y) \tag{2}\\
f_Y(y) &\approx f_X(x)*\frac{dh}{dy}(y) \tag{3}\\
f_Y(y) &\approx f_X(h(y))*\frac{dh}{dy}(y) \tag{4}
\end{align}
$
(2) Replacing $\delta_1$ with its approximation of $\delta_2$ and the slope.
(3) Cancelling $\delta_2$ on both sides.
(4) Expressing $x$ as $h(y)$.
The slope of the curve can be looked at from two perspectives ($x$ or $y$):
- *In terms of $x$:* the slope $\frac{dg}{dx}$ at the marked area is *rather flat*, as increasing $x$ by 1 unit makes $y$ increase by *less than 1 unit* (slope is between 0 and 1). Therefore multiplying $\delta_1$ with such a slope factor, results in the depicted smaller $\delta_2$.
- *In terms of $y$* the slope $\frac{dh}{dy}$ at the marked area is *steep*, as increasing $y$ by 1 unit makes $x$ increase by *more than 1 unit* (slope is >1). Therefore multiplying $\delta_2$ with such a slope factor, results in the depicted bigger $\delta_1$.
> [!note:]
> In plain language, this means that the density of $Y$ at a specific point $y$ is equal to the density of $X$ at a specific point $x=h(y)$ times the slope from $y$ perspective.