The integration by parts formula is:
$$ \int udv = uv - \int vdu $$
Broadly speaking, integration by parts is done by:
1. Pick a part of integral to be $u$. 
2. The rest of the integral will be $dv$, 
3. Compute the derivative of $u$, $du$.
4. Compute the antiderivative of $dv$
5. Substitute those values in to the integration by parts formula.
## Deriving the Integration by Parts Formula
$$ \frac{d}{dx}(f(x)g(x)) = f'(x)g(x) + f(x)g'(x) $$
1. Integrating both sides, we get:
$$\int \frac{d}{dx} (f(x)g(x))dx = \int [f'(x)g(x) + f(x)]$$
2. Through the distributive property of integrals,
$$ = \int f'(x)g(x)dx + \int f(x)g'(x)dx $$
3. An integral cancels out an antiderivative, therefore:
$$f(x)g(x) = \int f'(x)g(x)dx + \int f(x)g'(x)dx $$
4. Moving terms around:
$$ \int f(x)g'(x)dx = f(x)g(x) - \int f'(x)g(x)dx$$

Now, let $u = f(x)$ and $v = g(x)$, then $dv = g'(x)dx$ and $du = f'(x)dx$. 

# Examples
>  Evaluate the below antiderivative using integration by parts.
$$\int xe^{2x}dx$$
1. Define $u$ to be a value you can take the derivative of easily, in this case $u = x$. The rest of the integral will be set to $dv$, in this case, $dv = e^{2x}dx$. 
	- $u = x$
	- $du = \frac{d}{dx}(x)= 1dx$ 
	- $dv = e^{2x}dx$
	- $v = \frac{1}{2}e^{2x}$ - The antiderivative of $dv$.
2. Looking back at the integration by parts formula, we know that:
	$$ \int udv = uv - \int v du $$
	$$ \int xe^{2x}dx = (\frac{1}{2}e^{2x})(x)-\int (\frac{1}{2}e^{2x}) (1dx) $$
3. The remaining integral can be solved with $u$ substitution, but we've already defined $u$, so we use $w$ as a replacement.
	- $w = 2x$
	- $dw = 2dx$
	- $\frac{1}{2}dw=dx$ 
		1. Substituting $w$ and $dw$ into the integral:
		$$ \int \frac{1}{2}e^w \frac{1}{2}dw $$
		2. This gives an integral that can be computed naively
		$$ \int\frac{1}{2}e^{w}\frac{1}{2}dw = \frac{1}{4}\int e^w dw= \frac{1}{4}e^{2x} $$
4. Combining everything together, we get:
	$$ \int xe^{2x}dx = (\frac{1}{2}e^{2x})(x)- (\frac{1}{4}e^2x) + C$$