How to interpret probability density function of transformed variable? I am currently reading digital image processing by Rafael c. Gonzalez (pdf link page 92 in page and 103 in pdf, equation 3.3-3). 
Basically what it says is if:
r : denotes the intensities of an image and has range  [ $0$ - ($L-1$)].
s = $T(r)$ 
Let $p_s$(r) and $p_s$(s)  denote the PDFs of r and s.  
A fundamental result from basic probability theory is that if $p_s$(r) and $p_s$(s) are known and $T(r)$ is continuous and differentiable over the range of values of interest then the PDF of the transformed (mapped) variable $s$ can be obtained using simple formula.
$p_s$(s) = $p_s$(r)$|$$\frac{dr}{ds}$$|$ 
Where did this simple formula came from? I am trying to wrap my head around where did $|$$\frac{dr}{ds}$$|$  came from?
 A: This is a general result for the transformation of a random variable. If we have two random variables $X$, $Y = g(X)$ with probability distribution functions $f_X(x)$, $f_Y(y)$ where $g$ is monotone. Along with some other technical conditions regarding the derivatives of $g^{-1}(y)$, the PDF of $Y$ is:
$$
f_Y(y) = 
\begin{cases}
f_X(g^{-1}(y)) |   \frac{d}{dy} g^{-1}(y) | \quad\text{     if       } y \in  \mathcal{Y}\\
0 \quad\quad\quad\quad\quad\quad\quad\quad \text{otherwise}
\end{cases}
$$
To see why this holds, note that if $g$ is increasing, then:
\begin{align*}
f_Y(y) = \frac{d}{dy}F_Y(y) \overset{\text{(1)}}{=} \frac{d}{dy} F_X(g^{-1}(y)) = f_X(g^{-1}(y)) \frac{d}{dy} g^{-1}(y)
\end{align*}
if $g$ is decreasing, then 
$$
f_Y(y) = -f_X(g^{-1}(y)) \frac{d}{dy} g^{-1}(y)
$$
So the general result follows easily.
In your case, $r = T^{-1}(s)$. When working with multivariate distributions we have a more general expression involving the Jacobian rather than the derivative
To see why (1) holds, assume $g$ increasing:
\begin{align*}
F_Y(y) &= P(Y \le y)\\
&= P(g(X) \le y) \\
& = P(X \le g^{-1}(y))\\
&= F_X(g^{-1}(y))
\end{align*}
Source:
https://www.amazon.com/Statistical-Inference-George-Casella/dp/0534243126
