# Extracting the TeX source using getTeXSource

This page contains MathML equations that have been generated using TeXZilla. Double-click on any of them to get the original TeX source.

Copyright (C) 2013 Frédéric Wang

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU


## Basic Integration

### Ideas

If $F$ is a primitive of $f$ then $\int_\left\{a\right\}^b f\left(x\right) d x = F\left(b\right) - F\left(a\right)$, provided the integrand and integral have no singularities on the path of integration. As a consequence, we can use a table of derivatives:

 Function Derivative Linearity $a f + b g$ $a f\text{'} + b g\text{'}$ Leibniz rule $f g$ $f\text{'} g + g f\text{'}$ Reciprocal rule $\frac\left\{1\right\}\left\{f\right\}$ $-\frac\left\{f\text{'}\right\}\left\{f^2\right\}$ Chain Rule $f \circ g$ $\left(f\text{'} \circ g\right) g\text{'}$ Inverse function rule $f^\left\{-1\right\}$ $\frac\left\{1\right\}\left\{f\text{'} \circ f^\left\{-1\right\}\right\}$ Elementary power rule $x^n$ $n x^\left\{n-1\right\}$ Generalized power rule $f^g = e^\left\{g \ln\left(f\right)\right\}$ $f^g \left\left( f\text{'} \frac\left\{g\right\}\left\{f\right\} + g\text{'} \ln\left(f\right) \right\right)$ Exponential $\exp x$ $\exp x$ Logarithm $\ln x$ $\frac\left\{1\right\}\left\{x\right\}$ Sine $\sin x$ $\cos x$ Cosine $\cos x$ $-\sin x$ Tangent $\tan x$ $\frac\left\{1\right\}\left\{\cos^2 x\right\} = 1+\tan^2 x$

### Examples

Using linearity and elementary power rule:

$\int_0^\left\{1\right\} u^4 - 2u^3 + 5u^2 + 4 du = \left\left[ \frac\left\{u^5\right\}\left\{5\right\} - 2 \frac\left\{u^4\right\}\left\{4\right\} + 5 \frac\left\{u^3\right\}\left\{3\right\} + 4u \right\right]_\left\{u=0\right\}^1 = \frac\left\{161\right\}\left\{30\right\}$

Using linearity and sine/cosine:

$\int_0^\left\{\pi\right\} 2 \cos\left(\theta\right) - 3 \sin\left(\theta\right) d\theta = \left\left[ 2 \sin\left(\theta\right) + 3 \cos\left(\theta\right) \right\right]_\left\{\theta=0\right\}^\pi = -6$

Using Leibniz rule, Chain rule and Exponential/Power:

$\int_\left\{0\right\}^\left\{2\right\} 2x e^\left\{-3x\right\} - 3 x^2 e^\left\{-3x\right\} d x = \left\left[ x^2 e^\left\{-3x\right\} \right\right]_0^2 = \frac\left\{4\right\}\left\{e^\left\{12\right\}\right\}$

Using the inverse function rule and tangent:

$\int_\left\{0\right\}^\left\{1\right\} \frac\left\{1\right\}\left\{1 + x^2\right\} d x = \int_\left\{0\right\}^\left\{1\right\} \frac\left\{1\right\}\left\{\tan\text{'}\left(\arctan\left(x\right)\right)\right\} d x = \left\left[ \arctan\left(x\right) \right\right]_0^1 = \frac\left\{\pi\right\}\left\{4\right\}$

Using linearity, reciprocal rule and logarithm:

$\int_\left\{2\right\}^\left\{3\right\} \frac\left\{1\right\}\left\{v \left(\ln\left(v\right)\right)^2\right\} d v = - \int_\left\{2\right\}^\left\{3\right\} - \frac\left\{\frac\left\{1\right\}\left\{v\right\}\right\}\left\{\left(\ln\left(v\right)\right)^2\right\} d v = - \left\left[ \frac\left\{1\right\}\left\{\ln\left(v\right)\right\} \right\right]_2^3 = \frac\left\{1\right\}\left\{\ln 2\right\} - \frac\left\{1\right\}\left\{\ln 3\right\}$

Using the power rules and chain rule:

$\int_\left\{0\right\}^1 \frac\left\{3t^2\right\}\left\{\left(t^3+1\right)^5\right\} d t = -\frac\left\{1\right\}\left\{4\right\} \int_0^1 \left(t^3+1\right)^\left\{-4\right\} \left\left( 3t^2 \frac\left\{-4\right\}\left\{t^3+1\right\} + 0 \right\right) d t = -\frac\left\{1\right\}\left\{4\right\} \left\left[ \left(t^3+1\right)^\left\{-4\right\} \right\right]_0^1 = \frac\left\{15\right\}\left\{64\right\}$

## Integration by Substitution

### Idea

Do a substitution $x = g\left(y\right)$ to simplify an integral. We have $\frac\left\{dx\right\}\left\{dy\right\} = g\text{'}\left(y\right)$ and $\int f\left(x\right) dx = \int f\left(g\left(y\right)\right) g\text{'}\left(y\right) dy$: this is the chain rule!

### Example 1

$\int_\left\{0\right\}^1 x \left(x^2 - 1\right) dx$

Let $y = x^2 - 1$, $dy = 2 x dx$ then we get

$\frac\left\{1\right\}\left\{2\right\} \int_\left\{y=-1\right\}^0 y dy = \left\left[\frac\left\{y^2\right\}\left\{4\right\}\right\right]_\left\{y=-1\right\}^0 = -\frac\left\{1\right\}\left\{4\right\}$

We find the same result as

$\int_\left\{0\right\}^1 x^3 - x dx = \left\left[ \frac\left\{x^4\right\}\left\{4\right\} - \frac\left\{x^2\right\}\left\{2\right\} \right\right]_\left\{x=0\right\}^1 = \frac\left\{1\right\}\left\{4\right\} - \frac\left\{1\right\}\left\{2\right\} = -\frac\left\{1\right\}\left\{4\right\}$

### Example 2

Consider

$\int_2^3 6x^2 \cos\left(x^3 - 2\right) d x$

Let $y = x^3 - 2$, $dy = 3x^2 dx$ so

$\int_\left\{2\right\}^\left\{3\right\} 6 x^2 \cos\left(x^3 - 2\right) d x = 2 \int_\left\{y=6\right\}^\left\{25\right\} \cos\left(y\right) d y = 2 \left[\sin\left(y\right)\right]_\left\{y=6\right\}^\left\{25\right\} = 2 \sin\left(25\right) - 2 \sin\left(6\right)$

### Example 3

Consider

$\int_\left\{v=1\right\}^2 \frac\left\{dv\right\}\left\{v^3 e^\left\{\frac\left\{1\right\}\left\{v^2\right\}\right\}\right\}$

Let $u = -\frac\left\{1\right\}\left\{v^2\right\}$, $du = \frac\left\{2\right\}\left\{v^3\right\} dv$:

$\int_\left\{v=1\right\}^2 \frac\left\{dv\right\}\left\{v^3 e^\left\{\frac\left\{1\right\}\left\{v^2\right\}\right\}\right\} = \frac\left\{1\right\}\left\{2\right\} \int_\left\{u=-1\right\}^\left\{-\frac\left\{1\right\}\left\{4\right\}\right\} e^\left\{u\right\} du = \frac\left\{1\right\}\left\{2\right\} \left\left(\frac\left\{1\right\}\left\{\sqrt\left[4\right]\left\{e\right\}\right\} - \frac\left\{1\right\}\left\{e\right\}\right\right)$

### Example 4

Consider

$\int_\left\{-\sqrt\left\{2\right\}\right\}^\left\{-1\right\} \frac\left\{5t\right\}\left\{\sqrt\left\{4 - t^2\right\}\right\} d t$

Let $t = 2 \sin \theta$ and so $dt = 2 \cos \theta d \theta$. We have

$\int_\left\{\frac\left\{3\pi\right\}\left\{4\right\}\right\}^\left\{\frac\left\{7\pi\right\}\left\{6\right\}\right\} \frac\left\{10 \sin \theta\right\}\left\{\sqrt\left\{4 - 4\sin^2 \left\{\theta\right\}\right\}\right\} 2 \cos \theta d \theta = 10 \int_\frac\left\{3\pi\right\}\left\{4\right\}^\left\{\frac\left\{7\pi\right\}\left\{6\right\}\right\} \sin \theta \frac\left\{\cos \theta\right\}\left\{\sqrt\left\{\cos^2 \theta\right\}\right\} d \theta$

We have $-1 < \cos \theta < 0$ on $\left\left[\frac\left\{3\pi\right\}\left\{4\right\},\frac\left\{7\pi\right\}\left\{6\right\}\right\right]$ and so

$\int_\left\{-\sqrt\left\{2\right\}\right\}^\left\{-1\right\} \frac\left\{5t\right\}\left\{\sqrt\left\{4 - t^2\right\}\right\} d t = -10 \int_\frac\left\{3\pi\right\}\left\{4\right\}^\left\{\frac\left\{7\pi\right\}\left\{6\right\}\right\} \sin \theta d \theta = 10 \left\left[\cos \theta\right\right]_\frac\left\{3\pi\right\}\left\{4\right\}^\left\{\frac\left\{7\pi\right\}\left\{6\right\}\right\} = 5 \left(\sqrt\left\{2\right\} - \sqrt\left\{3\right\}\right)$

### Example 5

Consider

$\int_\left\{\frac\left\{3\right\}\left\{2\right\}\right\}^\left\{+\infty\right\} \frac\left\{dx\right\}\left\{2x^2 - 6x + 7\right\}$

We first write

$2x^2 - 6x + 7 = 2\left\left(x^2 - 3x + \frac\left\{7\right\}\left\{2\right\}\right\right) = 2\left\left( \left\left(x - \frac\left\{3\right\}\left\{2\right\}\right\right)^2 + \frac\left\{5\right\}\left\{4\right\} \right\right) = \frac\left\{5\right\}\left\{2\right\} \left\left( \left\left(\frac\left\{x - \frac\left\{3\right\}\left\{2\right\}\right\}\left\{\sqrt\left\{\frac\left\{5\right\}\left\{4\right\}\right\}\right\}\right\right)^2 + 1 \right\right)$

Now doing the substitution $y = \frac\left\{x - \frac\left\{3\right\}\left\{2\right\}\right\}\left\{\sqrt\left\{\frac\left\{5\right\}\left\{4\right\}\right\}\right\}$, $dy = \frac\left\{dx\right\}\left\{\sqrt\left\{\frac\left\{5\right\}\left\{4\right\}\right\}\right\}$ we get

$\int_0^\left\{+\infty\right\} \frac\left\{\sqrt\left\{\frac\left\{5\right\}\left\{4\right\}\right\} dy\right\}\left\{\frac\left\{5\right\}\left\{2\right\}\left(y^2+1\right)\right\} = \frac\left\{1\right\}\left\{\sqrt\left\{5\right\}\right\} \int_0^\left\{+\infty\right\} \frac\left\{dy\right\}\left\{y^2+1\right\}$

But we have already met this integral in the basic methods:

$\int_\left\{\frac\left\{3\right\}\left\{2\right\}\right\}^\left\{+\infty\right\} \frac\left\{dx\right\}\left\{2x^2 - 6x + 7\right\} = \frac\left\{1\right\}\left\{\sqrt\left\{5\right\}\right\} \left[\arctan y\right]_\left\{y=0\right\}^\left\{\infty\right\} = \frac\left\{\pi\right\}\left\{2 \sqrt\left\{5\right\}\right\}$

### Example 6

Consider

$\int_\left\{\frac\left\{\pi\right\}\left\{6\right\}\right\}^\left\{\frac\left\{\pi\right\}\left\{3\right\}\right\} \tan\left\left(\frac\left\{\theta\right\}\left\{2\right\}\right\right) \frac\left\{\left\{\left(1 + \cos \theta\right)\right\}^2\right\}\left\{\sin^3 \theta\right\} d \theta$

We do the substitution $t = \tan\left\left(\frac\left\{\theta\right\}\left\{2\right\}\right\right)$. We have $d \theta = \frac\left\{2 dt\right\}\left\{1+t^2\right\}$, $\cos \theta = \frac\left\{1-t^2\right\}\left\{1+t^2\right\}$ and $\sin \theta = \frac\left\{2t\right\}\left\{1+t^2\right\}$. Also, we have

$\tan\left\left(\frac\left\{\pi\right\}\left\{12\right\}\right\right) = \frac\left\{1-\cos\left\left(\frac\left\{\pi\right\}\left\{6\right\}\right\right)\right\}\left\{1-\sin\left\left(\frac\left\{\pi\right\}\left\{6\right\}\right\right)\right\} = 2 - \sqrt\left\{3\right\}$

and so

$\int_\left\{2 - \sqrt\left\{3\right\}\right\}^\left\{\frac\left\{1\right\}\left\{\sqrt\left\{3\right\}\right\}\right\} t \frac\left\{\left\left(\frac\left\{2\right\}\left\{1+t^2\right\}\right\right)^2\right\}\left\{\left\left( \frac\left\{2t\right\}\left\{1+t^2\right\}\right\right)^3\right\} \frac\left\{2 dt\right\}\left\{1+t^2\right\} = \int_\left\{2 - \sqrt\left\{3\right\}\right\}^\left\{\frac\left\{1\right\}\left\{\sqrt\left\{3\right\}\right\}\right\} \frac\left\{1\right\}\left\{t^2\right\} dt = \left\left[ -\frac\left\{1\right\}\left\{t\right\} \right\right]_\left\{2 - \sqrt\left\{3\right\}\right\}^\left\{\frac\left\{1\right\}\left\{\sqrt\left\{3\right\}\right\}\right\} = \frac\left\{1\right\}\left\{2-\sqrt\left\{3\right\}\right\}-\sqrt\left\{3\right\}$

and finally

$\int_\left\{\frac\left\{\pi\right\}\left\{6\right\}\right\}^\left\{\frac\left\{\pi\right\}\left\{3\right\}\right\} \tan\left\left(\frac\left\{\theta\right\}\left\{2\right\}\right\right) \frac\left\{\left\{\left(1 + \cos \theta\right)\right\}^2\right\}\left\{\sin^3 \theta\right\} d \theta = 2$

## Integration by parts

### Idea

Given a two function $f, g$ we have

$\int f g\text{'} = f g - \int f\text{'} g$

this is Leibniz rule!

### Example 1

Consider

$\int_\left\{0\right\}^\left\{+\infty\right\} \left(x^2 + x + 1\right) e^\left\{-3x\right\} d x$

We consider $f\left(x\right) = x^2 + x + 1$ and $g\left(x\right) = \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\}$ that is $f\text{'}\left(x\right) = 2x+1$ and $g\text{'}\left(x\right) = e^\left\{-3x\right\}$. The integral can be written $\int f g\text{'} dx$ and hence we get

$\left\left[\left(x^2 + x + 1\right) \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\}\right\right]_\left\{0\right\}^\left\{+\infty\right\} - \int_\left\{0\right\}^\left\{+\infty\right\} \left(2x+1\right) \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\} d x = \frac\left\{1\right\}\left\{3\right\} + \frac\left\{1\right\}\left\{3\right\} \int_\left\{0\right\}^\left\{+\infty\right\} \left(2x+1\right) e^\left\{-3x\right\} d x$

We now consider $h\left(x\right) = 2x+1, h\text{'}\left(x\right)=2$ the second integral can be written $\int h g\text{'} dx$ and hence

$\int_\left\{0\right\}^\left\{+\infty\right\} \left(2x+1\right) e^\left\{-3x\right\} d x = \left\left[\left(2x + 1\right) \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\}\right\right]_\left\{0\right\}^\left\{+\infty\right\} - \int_\left\{0\right\}^\left\{+\infty\right\} 2 \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\} d x = \frac\left\{1\right\}\left\{3\right\} + \frac\left\{2\right\}\left\{3\right\} \int_\left\{0\right\}^\left\{+\infty\right\} e^\left\{-3x\right\} d x$

We now recognize $g\text{'}$ in the last integral and so

$\int_\left\{0\right\}^\left\{+\infty\right\} e^\left\{-3x\right\} d x = \left\left[ \frac\left\{e^\left\{-3x\right\}\right\}\left\{-3\right\}\right\right]_\left\{0\right\}^\left\{+\infty\right\} = \frac\left\{1\right\}\left\{3\right\}$

Finally,

$\int_\left\{0\right\}^\left\{+\infty\right\} \left(x^2 + x + 1\right) e^\left\{-3x\right\} d x = \frac\left\{1\right\}\left\{3\right\} + \frac\left\{1\right\}\left\{3\right\} \times \left\left( \frac\left\{1\right\}\left\{3\right\} + \frac\left\{2\right\}\left\{3\right\} \times \frac\left\{1\right\}\left\{3\right\} \right\right) = \frac\left\{14\right\}\left\{27\right\}$

### Example 2

$\int_1^2 x^3 \left(2\ln x + 7\arctan x\right) d x$

We let $f\left(x\right) = 2\ln x + 7\arctan x$ and $g\left(x\right) = \frac\left\{x^3\right\}\left\{3\right\}$. Hence $f\text{'}\left(x\right) = \frac\left\{2\right\}\left\{x\right\} + \frac\left\{7\right\}\left\{1+x^2\right\}$ and $g\text{'}\left(x\right) = x^3$. The integration by parts gives:

$\left\left[\frac\left\{x^3\right\}\left\{3\right\} \left\left(2\ln x + 7\arctan x\right\right) \right\right]_1^2 - \int_1^2 \frac\left\{x^3\right\}\left\{3\right\} \left\left(\frac\left\{2\right\}\left\{x\right\} + \frac\left\{7\right\}\left\{1+x^2\right\}\right\right) d x$

The integral can be written

$\int_1^2 \frac\left\{2\right\}\left\{3\right\} x^2 + \frac\left\{7\right\}\left\{3\right\} \frac\left\{x\left(x^2+1\right) - x\right\}\left\{x^2+1\right\} dx = \int_2^2 \frac\left\{2\right\}\left\{3\right\} x^2 + \frac\left\{7\right\}\left\{3\right\} x - \frac\left\{7\right\}\left\{6\right\} \frac\left\{2x\right\}\left\{x^2+1\right\} dx$

Finally

$\int_1^2 x^3 \left(2\ln x + 7\arctan x\right) d x = \left\left[\frac\left\{x^3\right\}\left\{3\right\} \left\left(2\ln x + 7\arctan x\right\right) - \frac\left\{2\right\}\left\{9\right\} x^3 -\frac\left\{7\right\}\left\{6\right\} x^2 + \frac\left\{7\right\}\left\{6\right\} \ln \left(x^2 + 1\right) \right\right]_1^2 = \frac\left\{28\right\}\left\{9\right\} \ln\left(5\right) + \frac\left\{89\right\}\left\{18\right\} \ln\left(2\right) + \frac\left\{56\right\}\left\{3\right\} \arctan\left(2\right) - \frac\left\{7 \pi\right\}\left\{12\right\} - \frac\left\{301\right\}\left\{18\right\}$

### Example 3

Consider

$I =\int_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} \sin\left(3 \theta\right) e^\left\{2 \theta\right\} d \theta$

We do an integration by parts with $f\left(\theta\right) = \sin\left(3 \theta\right)$ and $g\text{'}\left(\theta\right) = e^\left\{2 \theta\right\}$:

$I = \left\left[\sin\left(3 \theta\right) \frac\left\{e^\left\{2 \theta\right\}\right\}\left\{2\right\}\right\right]_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} - \frac\left\{3\right\}\left\{2\right\} \int_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} \cos\left(3 \theta\right) e^\left\{2 \theta\right\} d \theta$

We repeat a similar integration by parts on the remaining integral:

$\int_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} \cos\left(3 \theta\right) e^\left\{2 \theta\right\} d \theta = \left\left[\cos\left(3 \theta\right) \frac\left\{e^\left\{2 \theta\right\}\right\}\left\{2\right\}\right\right]_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} + \frac\left\{3\right\}\left\{2\right\} \int_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} \sin\left(3 \theta\right) e^\left\{2 \theta\right\} d \theta$

We note that we found the initial integral $I$. We get:

$I = \left\left[\sin\left(3 \theta\right) \frac\left\{e^\left\{2 \theta\right\}\right\}\left\{2\right\} -\frac\left\{3\right\}\left\{4\right\} \cos\left(3 \theta\right) e^\left\{2 \theta\right\} \right\right]_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} - \frac\left\{9\right\}\left\{4\right\} I$

Finally,

$I =\int_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} \sin\left(3 \theta\right) e^\left\{2 \theta\right\} d \theta = \frac\left\{4\right\}\left\{13\right\} \left\left[\left\left(\frac\left\{1\right\}\left\{2\right\} \sin\left(3 \theta\right) -\frac\left\{3\right\}\left\{4\right\} \cos\left(3 \theta\right)\right\right) e^\left\{2 \theta\right\} \right\right]_\left\{0\right\}^\left\{\frac\left\{\pi\right\}\left\{2\right\}\right\} = \frac\left\{3 - 2 e^\pi\right\}\left\{13\right\}$

## Integration by Partial Fraction Decomposition

### Idea

Given a rational function $\frac\left\{P\right\}\left\{Q\right\}$, write its partial fraction decomposition and integrate each term.

### Example 1

$\int_\left\{x=2\right\}^\left\{3\right\} \frac\left\{2x^4-6x^3+41x^2-44x+12\right\}\left\{6x^5-18x^4+18x^3-6x^2\right\} d x$

Clearly, we have $6x^5-18x^4+18x^3-6x^2 = 6 x^2 \left(x^3-3x^2+3x-1\right)$ and $1$ is a trivial root of the second factor so we can factor it by $\left(x-1\right)$ and obtain:

$6x^5-18x^4+18x^3-6x^2 = 6 x^2 \left(x-1\right) \left(x^2-2x+1\right) = 6x^2 \left(x-1\right)^3$

Hence we search a decomposition of

$F\left(x\right) = \frac\left\{2x^4-6x^3+41x^2-44x+12\right\}\left\{6 x^2 \left(x^3-3x^2+3x-1\right)\right\} = \frac\left\{A\right\}\left\{x\right\} + \frac\left\{B\right\}\left\{x^2\right\} + \frac\left\{C\right\}\left\{x-1\right\} + \frac\left\{D\right\}\left\{\left(x-1\right)^2\right\} + \frac\left\{E\right\}\left\{\left(x-1\right)^3\right\}$

for some constants $A, B, C, D, E \in \mathbb\left\{R\right\}$. We have

$\lim_\left\{x \rightarrow 1\right\} \left(x - 1\right)^3 F\left(x\right) = E = \frac\left\{2 - 6 + 41 - 44 + 12\right\}\left\{6\right\} = \frac\left\{5\right\}\left\{6\right\}$ $\lim_\left\{x \rightarrow 0\right\} x^2 F\left(x\right) = B = \frac\left\{12\right\}\left\{-6\right\} = -2$ $\lim_\left\{x \rightarrow 0\right\} \left(x^2 F\left(x\right)\right)\text{'} = A = \frac\left\{-44 \times -1 - 12 \times 3\right\}\left\{6\right\} = \frac\left\{4\right\}\left\{3\right\}$ $\lim_\left\{x \rightarrow +\infty\right\} x F\left(x\right) = A + C = \frac\left\{2\right\}\left\{6\right\} \rightarrow C = \frac\left\{2\right\}\left\{6\right\} - \frac\left\{4\right\}\left\{3\right\} = -1$ $F\left(2\right) = \frac\left\{A\right\}\left\{2\right\} + \frac\left\{B\right\}\left\{4\right\} + C + D + E = \frac\left\{2\times16 - 6\times8+41\times4-44\times2+12\right\}\left\{6 \times 4\right\} = 3 \rightarrow D = 3 - \frac\left\{2\right\}\left\{3\right\} + \frac\left\{1\right\}\left\{2\right\} + 1 - \frac\left\{5\right\}\left\{6\right\} = 3$

Finally,

$\int_\left\{x=2\right\}^\left\{3\right\} F\left(x\right) d x = \left\left[ \frac\left\{4\right\}\left\{3\right\} \ln |x| + \frac\left\{2\right\}\left\{x\right\} - \ln |x - 1| - \frac\left\{3\right\}\left\{x-1\right\} - \frac\left\{5\right\}\left\{12\right\} \frac\left\{1\right\}\left\{\left(x-1\right)^2\right\} \right\right]_\left\{x=2\right\}^3 = \frac\left\{4\right\}\left\{3\right\} \ln\left(3\right) - \frac\left\{7\right\}\left\{3\right\} \ln\left(2\right) + \frac\left\{71\right\}\left\{48\right\}$

### Example 2

$\int_\left\{u=1\right\}^\left\{5\right\} \frac\left\{2u^4-5u^3+24u^2-26u+50\right\}\left\{u^5-4u^4+14u^3-20u^2+25u\right\} d u$

The denominator can be written $u^5-4u^4+14u^3-20u^2+25u = u\left(u^4-4u^3+14u^2-20u+25\right)$. Evaluating the second factor at $0, \pm1, \pm2$ we don't find any trivial roots. Hence we try to convert it to a depressed quartic by setting $u = v - \frac\left\{-4\right\}\left\{4\right\} = v + 1$. We find $\left(u^4-4u^3+14u^2-20u+25\right) = v^4 + 8v^2 + 16 = \left(v^2 + 4\right)^2 = \left(u^2-2u+5\right)^2$. The discriminant of $u^2-2u+5$ is $4\left(1-5\right) < 0$ so we have the decomposition in irreducible factors:

$u^5-4u^4+14u^3-20u^2+25u = u \left(u^2-2u+5\right)^2$

We now try to find $A, B, C, D, E \in \mathbb\left\{R\right\}$ such that

$F\left(u\right) = \frac\left\{2u^4-5u^3+24u^2-27u+50\right\}\left\{u \left(u^2-2u+5\right)^2\right\} = \frac\left\{A\right\}\left\{u\right\} + \frac\left\{Bu+C\right\}\left\{u^2-2u+5\right\} + \frac\left\{Du+E\right\}\left\{\left(u^2-2u+5\right)^2\right\}$ $\lim_\left\{u \rightarrow 0\right\} uF\left(u\right) = A = \frac\left\{50\right\}\left\{3 \times 25\right\} = 2$ $\lim_\left\{u \rightarrow +\infty\right\} uF\left(u\right) = A + B = 2 \rightarrow B = 0$ $\lim_\left\{u \rightarrow +\infty\right\} u^2\left\left(F\left(u\right) - \frac\left\{A\right\}\left\{u\right\}\right\right) = C = \lim_\left\{u \rightarrow +\infty\right\} u^2 \frac\left\{2 u^4 - 5u^3 - 2\left(u^4-4u^3\right)\right\}\left\{u \times u^4\right\} = 3$ $F\left(1\right) = \frac\left\{11\right\}\left\{4\right\} = 2 + \frac\left\{3\right\}\left\{4\right\} + \frac\left\{D+E\right\}\left\{16\right\} \rightarrow D+E = 44 - 32 - 12 = 0$ $F\left(2\right) = \frac\left\{42\right\}\left\{25\right\} = 1 + \frac\left\{3\right\}\left\{5\right\} + \frac\left\{2D+E\right\}\left\{25\right\} \rightarrow 2D + E = 42 - 25 - 15 = 2$

From the two last equalities, we immediately get $D = 2$ and $E = -2$. Finally,

$F\left(u\right) = \frac\left\{2\right\}\left\{u\right\} + \frac\left\{3\right\}\left\{u^2-2u+5\right\} + \frac\left\{2u - 2\right\}\left\{\left(u^2-2u+5\right)^2\right\}$

We have

$\int_\left\{u=1\right\}^\left\{5\right\} \frac\left\{2\right\}\left\{u\right\} d u= \left\left[ 2 \ln|u| \right\right]_\left\{u=1\right\}^5 = 2 \ln\left(5\right)$ $\int_\left\{u=1\right\}^\left\{5\right\} \frac\left\{3\right\}\left\{u^2-2u+5\right\} d u= \frac\left\{3\right\}\left\{4\right\} \int_\left\{u=1\right\}^\left\{5\right\} \frac\left\{d u\right\}\left\{\left(\frac\left\{u-1\right\}\left\{2\right\}\right)^2+1\right\} = \frac\left\{3\right\}\left\{2\right\} \int_\left\{v=0\right\}^\left\{2\right\} \frac\left\{d v\right\}\left\{v^2+1\right\} = \frac\left\{3\right\}\left\{2\right\} \arctan\left(2\right)$ $\int_\left\{u=1\right\}^\left\{5\right\} \frac\left\{2u - 2\right\}\left\{\left(u^2-2u+5\right)^2\right\} d u = \left\left[ - \frac\left\{1\right\}\left\{u^2-2u+5\right\} \right\right]_\left\{u=1\right\}^5 = \frac\left\{1\right\}\left\{5\right\}$

hence

$\int_\left\{u=1\right\}^5 F\left(u\right) d u = 2 \ln\left(5\right) + \frac\left\{3\right\}\left\{2\right\} \arctan\left(2\right) + \frac\left\{1\right\}\left\{5\right\}$

### Example 3

$\int_\left\{t=2\right\}^\left\{17\right\} \frac\left\{t^6-2t^5-3t^4+15t^3+4t^2-17\right\}\left\{t^4+2t^3-t-2\right\} d t$

By polynomial long division we find that

$X^6-2x^5-3X^4+15X^3+4X^2-17 = \left(X^2-4X+5\right)\left(X^4+2X^3-X-2\right)+6X^3+2X^2-3X-7$

and so

$\frac\left\{t^6-2t^5-3t^4+15t^3+4t^2-17\right\}\left\{t^4+2t^3-t-2\right\} = t^2-4t+5+\frac\left\{6t^3+2t^2-3t-7\right\}\left\{t^4+2t^3-t-2\right\}$

The integral of the first term is:

$\int_\left\{t=2\right\}^\left\{17\right\} t^2-4t+5 d t = \left\{\left\left[\frac\left\{t^3\right\}\left\{3\right\} - 2t^2 + 5t\right\right]\right\}_\left\{t=2\right\}^\left\{17\right\} = 1140$

First we search trivial roots for the denominator. If we evaluate $t^4+2t^3-t-2$ at $t=0,-1,1,-2,2$ we find respectively $-2, -2, 0, 0, 28$. So we can factor $X^4+2X^4-X-2$ by $\left(X - 1\right)\left(X + 2\right)$. We get

$X^4+2X^3-X-2 = \left(X - 1\right)\left(X + 2\right)\left(X^2+X+1\right)$

The polynomial $X^2+X+1$ is irreducible on $\mathbb\left\{R\right\}$ because its discrimant is $1 - 4 = -3 < 0$. Hence we search a decomposition of

$F\left(t\right) = \frac\left\{6t^3+2t^2-3t-7\right\}\left\{\left(t - 1\right)\left(t + 2\right)\left(t^2+t+1\right)\right\} = \frac\left\{A\right\}\left\{t - 1\right\} + \frac\left\{B\right\}\left\{t + 2\right\} + \frac\left\{C t + D\right\}\left\{t^2+t+1\right\}$

for some constants $A, B, C, D \in \mathbb\left\{R\right\}$. We have

$\lim_\left\{t \rightarrow 1\right\} \left(t - 1\right)F\left(t\right) = A = \frac\left\{6+2-3-7\right\}\left\{3 \times 3\right\} = - \frac\left\{2\right\}\left\{9\right\}$ $\lim_\left\{t \rightarrow -2\right\} \left(t + 2\right)F\left(t\right) = B = \frac\left\{6\times-8+2\times4+3\times2-7\right\}\left\{-3 \times \left(4-2+1\right)\right\} = \frac\left\{41\right\}\left\{9\right\}$ $\lim_\left\{t \rightarrow +\infty\right\} t F\left(t\right) = A + B + C = 6 \rightarrow C = 6 + \frac\left\{2\right\}\left\{9\right\} - \frac\left\{41\right\}\left\{9\right\} = \frac\left\{5\right\}\left\{3\right\}$ $F\left(0\right) = -A + \frac\left\{B\right\}\left\{2\right\} + D = \frac\left\{-7\right\}\left\{-1 \times 2 \times 1\right\} \rightarrow D = \frac\left\{7\right\}\left\{2\right\} -\frac\left\{2\right\}\left\{9\right\} - \frac\left\{41\right\}\left\{18\right\} = 1$

So

$F\left(t\right) = -\frac\left\{2\right\}\left\{9\left(t - 1\right)\right\} + \frac\left\{41\right\}\left\{9\left(t + 2\right)\right\} + \frac\left\{\frac\left\{5\right\}\left\{3\right\} t + 1\right\}\left\{t^2+t+1\right\}$

The integral of the two first terms is easy to compute:

$\int_\left\{t=2\right\}^\left\{17\right\} -\frac\left\{2\right\}\left\{9\left(t - 1\right)\right\} + \frac\left\{41\right\}\left\{9\left(t + 2\right)\right\} d t = -\frac\left\{2\right\}\left\{9\right\} \left\left[\ln|t-1|\right\right]_\left\{2\right\}^\left\{17\right\} + \frac\left\{41\right\}\left\{9\right\} \left\left[\ln|t+2|\right\right]_\left\{2\right\}^\left\{17\right\} = -\frac\left\{2\right\}\left\{9\right\} \ln\left(16\right) + \frac\left\{41\right\}\left\{9\right\} \ln\left(19\right) - \frac\left\{41\right\}\left\{9\right\} \ln\left(4\right)$

The last term can be split into two parts:

$\frac\left\{\frac\left\{5\right\}\left\{3\right\} t + 1\right\}\left\{t^2+t+1\right\} = \frac\left\{5\right\}\left\{6\right\} \frac\left\{2t+1\right\}\left\{t^2+t+1\right\} + \frac\left\{1\right\}\left\{6\right\} \times \frac\left\{4\right\}\left\{3\right\} \frac\left\{1\right\}\left\{\left\left( \frac\left\{t+\frac\left\{1\right\}\left\{2\right\}\right\}\left\{\sqrt\left\{\frac\left\{3\right\}\left\{4\right\}\right\}\right\} \right\right)^2 + 1\right\}$

We have

$\int_\left\{t=2\right\}^\left\{17\right\} \frac\left\{5\right\}\left\{6\right\} \frac\left\{2t\right\}\left\{t^2+t+1\right\} d t = \frac\left\{5\right\}\left\{6\right\} \left\left[ \ln |t^2 + t + 1| \right\right]_\left\{t=2\right\}^\left\{17\right\} = \frac\left\{5\right\}\left\{6\right\} \ln\left(307\right) - \frac\left\{5\right\}\left\{6\right\} \log\left(7\right)$

and

$\int_\left\{t=2\right\}^\left\{17\right\} \frac\left\{2\right\}\left\{9\right\} \frac\left\{d t\right\}\left\{\left\left( \frac\left\{t+\frac\left\{1\right\}\left\{2\right\}\right\}\left\{\sqrt\left\{\frac\left\{3\right\}\left\{4\right\}\right\}\right\} \right\right)^2 + 1\right\} = \frac\left\{2\right\}\left\{9\right\} \int_\left\{u=\frac\left\{5\right\}\left\{\sqrt\left\{3\right\}\right\}\right\}^\left\{\frac\left\{35\right\}\left\{\sqrt\left\{3\right\}\right\}\right\} \frac\left\{\sqrt\left\{\frac\left\{3\right\}\left\{4\right\}\right\} d u\right\}\left\{u^2 + 1\right\} = \frac\left\{1\right\}\left\{3 \sqrt\left\{3\right\}\right\} \left\left[ \arctan u \right\right]_\left\{u=\frac\left\{5\right\}\left\{\sqrt\left\{3\right\}\right\}\right\}^\left\{\frac\left\{35\right\}\left\{\sqrt\left\{3\right\}\right\}\right\}$

Finally we get

$\int_\left\{t=2\right\}^\left\{17\right\} \frac\left\{t^6-2t^5-3t^4+15t^3+4t^2-17\right\}\left\{t^4+2t^3-t-2\right\} d t = 1140 -\frac\left\{2\right\}\left\{9\right\} \ln\left(16\right) + \frac\left\{41\right\}\left\{9\right\} \ln\left(19\right) - \frac\left\{41\right\}\left\{9\right\} \ln\left(4\right) + \frac\left\{5\right\}\left\{6\right\} \ln\left(307\right) - \frac\left\{5\right\}\left\{6\right\} \log\left(7\right) + \frac\left\{1\right\}\left\{3 \sqrt\left\{3\right\}\right\} \arctan\left\left(\frac\left\{35\right\}\left\{\sqrt\left\{3\right\}\right\}\right\right) - \frac\left\{1\right\}\left\{3 \sqrt\left\{3\right\}\right\} \arctan\left\left(\frac\left\{5\right\}\left\{\sqrt\left\{3\right\}\right\}\right\right)$

Alternatively, we can write

$G\left(t\right) = \frac\left\{\frac\left\{5\right\}\left\{3\right\} t + 1\right\}\left\{t^2+t+1\right\} = \frac\left\{E\right\}\left\{t - t^+\right\} + \frac\left\{F\right\}\left\{t - t^-\right\}$

where $t^\pm = \frac\left\{-1\pm i \sqrt\left\{3\right\}\right\}\left\{2\right\}$ are the complex roots of $t^2+t+1$. We have

$\lim_\left\{t \rightarrow t^+\right\} \left(t-t^+\right) G\left(t\right) = E = \frac\left\{5\sqrt\left\{3\right\}+i\right\}\left\{6 \sqrt\left\{3\right\}\right\}$ $\lim_\left\{t \rightarrow t^-\right\} \left(t-t^-\right) G\left(t\right) = F = \frac\left\{5\sqrt\left\{3\right\}-i\right\}\left\{6 \sqrt\left\{3\right\}\right\}$

We have

$\int_\left\{2\right\}^\left\{17\right\} G\left(t\right) d t = \left\left[ E \left\left( \ln |t - t^+| + i \arctan \frac\left\{t - \Re\left(t^+\right)\right\}\left\{\Im\left(t^+\right)\right\} \right\right) + F \left\left( \ln |t - t^-| + i \arctan \frac\left\{t - \Re\left(t^-\right)\right\}\left\{\Im\left(t^-\right)\right\} \right\right) \right\right]_\left\{2\right\}^\left\{17\right\}$

After simplification, we get

$\int_\left\{2\right\}^\left\{17\right\} G\left(t\right) d t = \frac\left\{5\right\}\left\{6\right\} \ln\left(307\right) - \frac\left\{5\right\}\left\{6\right\} \log\left(7\right) + \frac\left\{1\right\}\left\{3 \sqrt\left\{3\right\}\right\} \arctan\left\left(\frac\left\{35\right\}\left\{\sqrt\left\{3\right\}\right\}\right\right) - \frac\left\{1\right\}\left\{3 \sqrt\left\{3\right\}\right\} \arctan\left\left(\frac\left\{5\right\}\left\{\sqrt\left\{3\right\}\right\}\right\right)$

## Contour Integration

### Idea

Consider contour integral $\oint_\gamma f\left(z\right) d z$ along paths in complex plane to deduce integral along the real line.

### Example 1

Consider the integral

$\int_\left\{0\right\}^\left\{2 \pi\right\} \frac\left\{6 \cos\left(2 \theta\right)\right\}\left\{4 \sin\left(\theta\right) - 5\right\} d\theta$

Write $z = e^\left\{i \theta\right\}$, $d z = i z d \theta$. The integral becomes

$\oint_\left\{\gamma\right\} \frac\left\{3 \left(z^2 + z^\left\{-2\right\}\right)\right\}\left\{-2 i \left(z - z^\left\{-1\right\}\right) - 5\right\} \frac\left\{d z\right\}\left\{i z\right\} = \oint_\left\{\gamma\right\} \frac\left\{3\left(z^4+1\right)\right\}\left\{2 z^2 \left(z - 2 i\right)\left\left(z - \frac\left\{i\right\}\left\{2\right\}\right\right)\right\} d z$

where $\gamma$ is the unit circle traversed counterclockwise. $f : z \mapsto \frac\left\{3\left(z^4+1\right)\right\}\left\{2 z^2 \left(z - 2 i\right)\left\left(z - \frac\left\{i\right\}\left\{2\right\}\right\right)\right\}$ has two singularities inside that circle: $0$ and $\frac\left\{i\right\}\left\{2\right\}$. Hence the integral is the $2 \pi i$ times the sum of the residues of $f$ at these points:

$\mathrm\left\{Res\right\}\left(f, 0\right) = \lim_\left\{z \rightarrow 0\right\} \frac\left\{d \left\left( z^2 f\left(z\right) \right\right)\right\}\left\{dz\right\} = \frac\left\{15 i\right\}\left\{4\right\}$ $\mathrm\left\{Res\right\}\left(f, \frac\left\{i\right\}\left\{2\right\}\right) = \lim_\left\{z \rightarrow 0\right\} \left\left( z - \frac\left\{i\right\}\left\{2\right\} \right\right) f\left(z\right) = -\frac\left\{17 i\right\}\left\{4\right\}$

Hence

$\int_\left\{0\right\}^\left\{2 \pi\right\} \frac\left\{6 \cos\left(2 \theta\right)\right\}\left\{4 \sin\left(\theta\right) - 5\right\} d\theta = \oint_\left\{\gamma\right\} f\left(z\right) d z = 2 \pi i \left\left( \frac\left\{15 i\right\}\left\{4\right\} -\frac\left\{17 i\right\}\left\{4\right\} \right\right) = \pi$

### Example 2

We want to know the value of the integral

$\int_\left\{-\infty\right\}^\left\{+\infty\right\} \frac\left\{16 \sin\left(2x+\pi\right)\right\}\left\{5\left(x^2+2x+5\right)^2\right\} dx$

For that purpose, we introduce the function

$f\left(z\right) = \frac\left\{16 e^\left\{-2\pi z\right\}\right\}\left\{5\left(z^2+2z+5\right)^2\right\}$

We note that $x \mapsto \Im\left(f\left(x\right)\right)$ is the integrand above. We also note that the poles of $f$ are $z^\pm = -1 \pm 2 i$. By choosing the right contour, one can show that

$\int_\left\{-\infty\right\}^\left\{+\infty\right\} f\left(x\right) dx = -2 i \pi \sum_\left\{\stackrel\left\{z \text\left\{residue\right\}\right\}\left\{\Im\left(z\right) < 0\right\}\right\} \mathrm\left\{Res\right\}\left(f, z\right)$

We have

$\mathrm\left\{Res\right\}\left(f, z^-\right) = \lim_\left\{z \rightarrow z⁻\right\} \frac\left\{d \left\left( \left(z - z^-\right)^2 f\left(z\right) \right\right)\right\}\left\{dz\right\} = \frac\left\{i e^\left\{2 i\right\}\right\}\left\{2 e^4\right\}$

Hence

$\int_\left\{-\infty\right\}^\left\{+\infty\right\} \frac\left\{16 \sin\left(2x+\pi\right)\right\}\left\{5\left(x^2+2x+5\right)^2\right\} dx = \Im\left\left(\int_\left\{-\infty\right\}^\left\{+\infty\right\} f\left(x\right) dx\right\right) = \Im\left\left(-2 i \pi \frac\left\{i e^\left\{2 i\right\}\right\}\left\{2 e^4\right\}\right\right) = \Im\left\left(\frac\left\{\pi e^\left\{2 i\right\}\right\}\left\{e^4\right\}\right\right)$

Finally

$\int_\left\{-\infty\right\}^\left\{+\infty\right\} \frac\left\{16 \sin\left(2x+\pi\right)\right\}\left\{5\left(x^2+2x+5\right)^2\right\} dx = \frac\left\{\pi \sin\left(2\right)\right\}\left\{e^4\right\}$