Integration by parts is a technique used in calculus to integrate products of functions, especially when both parts of the product depend on the variable of integration.
$ \int u \: dv = uv - \int v \: du $
* $u$: A function we will differentiate during the procedure ($u \to du$).
* $dv$: A function we will integrate during the procedure ($dv \to v$).
With this formula we can transform the integral of a product $\int u \: dv$ into a combination of product and another ==hopefully simpler integral== $\int v \: du$.
**Example:**
Let $X$ be a [[Random Variable]] an from [[Exponential Distribution]], with the following [[Probability Density Function]].
$ f_X(x)=\lambda e^{-\lambda x}, \quad x \ge 0, \lambda >0.$
To obtain the expectation we will use integration by parts.
$ \mathbb E[X] =\int_0^\infty \underbrace{x}_{u}* \underbrace{\lambda e^{-\lambda t} \, dx}_{dv} $
Terms:
- $u=x$
- $du = dx$ (derivative of $u$)
- $dv = \lambda e^{-\lambda t}dt$
- $v= e^{-\lambda t}$ (integrated $dv$)
$
\begin{align}
\mathbb E[X] &= \int_0^\infty x* \lambda e^{-\lambda x} dx \tag{1}\\[4pt]
&= \Big[x* -e^{-\lambda x} \Big ]_0^\infty - \int_0^\infty -e^{-\lambda x} dx \tag{2}\\[4pt]
&= \underbrace{\Big[x* -e^{-\lambda x} \Big ]_0^\infty}_{=0} +\Big[\frac{1}{\lambda} e^{-\lambda t} \Big ]_0^\infty \tag{3}\\[4pt]
&=1/\lambda \tag{4}
\end{align}
$
(3) Evaluating the term at $[0, \infty]$ both boundaries returns $0$, which make the whole terms $0$.
* When $x = \infty$ then $xe^{-\lambda x} = 0$ because the exponential decay is stronger than the linear growth in $x$.
* When $x=0$ then $xe^{-\lambda x} \to 0$.