Integration by substitution, often called $u$-substitution, simplifies integration by replacing a component of the function with the variable $u$.
## Process
1. Identify the part of the function that will be $u$.
2. Find the derivative of $u$ ($du$).
3. Solve for $dx$.
4. Substitute for $du$ in the original function.
5. Find the anti-derivative.
6. Substitute for $u$.
## Example
Let's calculate the probability that $X$ is less than $1$ when $X$ is the exponential distribution.
Recall the pdf of the exponential distribution is
$f(x) = \lambda e^{-\lambda x}$
The probability that $X$ is less than $1$ is given by the integral from $0$ to $1$ of the pdf.
$P(X <= 1) = \int_0^1 \lambda e^{-\lambda x} \ dx$
We can use $u$-substitution to simplify this integral. First, we'll pull the constant $\lambda$ in front of the integral.
$P(X <= 1) = \lambda\int_0^1 e^{-\lambda x} \ dx$
Let's let $u = -\lambda x$.
First, we need to find $du$, the derivative of $u$. From the [[product rule]], we know that the derivative of a constant times a function is the constant times the derivative of the function ($f'(cx) = cf'(x)$). Thus the derivative of $u$ is the constant $\lambda$ times the derivative of $x$ which is $1$.
$du = -\lambda \ dx$
Now let's rearrange the terms to solve for $dx$.
$dx = \frac{du}{-\lambda}$
Substituting in $u$ and $du$ in the pdf of the exponential distribution we get
$P(X <= 1) = \lambda \int_0^1 e^u \frac{du}{-\lambda}$
We can pull the $-\lambda$ term out of the integral and then simplify
$P(X <= 1) = \frac{\lambda}{-\lambda} \int_0^1 e^u du{} = -\int_0^1 e^u du{}$
Now we can substitute back in for $u$.
$P(X <= 1) = \int_o^1 e^{-\lambda x} \ du$
Finally evaluate the integral using the [[Fundamental Theorem of Calculus]].
$P(X <= 1) = -e^{-\lambda x} \Big|_0^1 = -e^{-\lambda * 1} -e^{-\lambda * 0}= -e^{-\lambda} - 1 = 1 - e^{-\lambda}$
> [!tip]- Additional Resources
> - https://www.youtube.com/watch?v=D9dqdbCgJQM
> - https://www.youtube.com/watch?v=dV8lyQnlp4c&t=422s