===
7.1 Integration by parts
7.2 Trigonometric Integration
7.3 Trigonometric Substitution
7.4 Partial Fraction
Review the definition of Definite Integral: $$\color{blue}{|S| = \int^b_a f (x) d x = \lim_{n \rightarrow \infty} \sum_{k = 1}^n f (x_k^{\ast}) \Delta x.} $$ In another words, sum of infinite constants can be evaluated by the integration operation.
Consider a solid roll toilet paper with radius $b$. Then area of its side surface is about $b^2 \pi$
The area can be approximated by the following sum: $$ \sum_{k = 1}^n \pi ((k \Delta x)^2 - \pi ((k - 1) \Delta x)^2) $$ where $\Delta x = b / n$. And this sum can be evaluated by the following: \begin{eqnarray*} & & \sum_{k = 1}^n \pi ((k \Delta x)^2 - \pi ((k - 1) \Delta x)^2)\\ & = & \sum_{k = 1}^n \pi (2 k - 1) (\Delta x)^2\\ & = & \sum_{k = 1}^n \pi [(2 k - 1) \Delta x] \Delta x\\ & = & \sum_{k = 1}^n 2 \pi \left[ \frac{(2 k - 1)}{2} \Delta x \right] \Delta x\\ & \overset{n \rightarrow \infty}{\longrightarrow} & \int^b_0 2 \pi x d x = \pi b^2 \end{eqnarray*} Here we use the fact: $$ \begin{array}{ccccccccccccc} \color{blue}{x_0} & & \color{blue}{x_1} & & \color{blue}{x_2} & \cdots & \color{blue}{x_{k - 1}} & & \color{blue}{x_k} & \cdots & \color{blue}{x_{n - 1}} & & \color{blue}{x_n}\\ 0 & & \Delta x & & 2 \Delta x & \cdots & (k - 1) \Delta x & & k \Delta x & \cdots & (n - 1) \Delta x & & n \Delta x\\ & \downarrow & & \downarrow & & & & \downarrow & & & & \downarrow & \\ & \color{brown}{\frac{\Delta x}{2}} & & \color{brown}{\frac{3 \Delta x}{2}} & & \cdots & & \color{brown}{\frac{(2 k - 1) \Delta x}{2}} & & & & \color{brown}{\frac{(2 n - 1) \Delta x}{2}} & \\ & \color{red}{x^{\ast}_1} & & \color{red}{x^{\ast}_2} & & & & \color{red}{x^{\ast}_k} & & & & \color{red}{x^{\ast}_n} & \end{array} $$
where $\Delta x = b / n$ and $\{ \color{red}{x^{\ast}_k} \}$ is the middle points in each sub-interval, $[\color{blue}{x_{k - 1}}, \color{blue}{x_k}]$.
After expanding the roll paper, the area is also equal to $\color{red}{\Delta x \cdot L}$. This says: the length, $\color{red}{L}$, is $\color{red}{b^2 \pi / \Delta x}$.
1154
And \begin{eqnarray*} \int_a^b f' (x) g (x) d x & = & \left.f (x) \cdot g (x) \right|^b_a - \int^b_a f (x) g' (x) d x\\ & = & f (b) g (b) - f (a) g (a) - \int^b_a f (x) g' (x) d x \end{eqnarray*} This technique integration is called integration by parts.
What kind of functions need to be integrated by this method? In general, if the integrand is the product of any two types of the following functions, it does need:
$$\color{brown}{x^r, e^{a x}, \sin b x \text{ or } \cos b x}, \ln x, \sin^{- 1} x \text{ or } \tan^{- 1} x \text{ etc} . $$($g (x) = \color{brown}{x^n}$ and $f' (x) = \color{brown}{e^{a x}}$)
\begin{eqnarray*} & & \int \color{brown}{x^{}} e^{- x} d x\\ \begin{array}{l} \color{brown}{g' (x) = x' = 1}\\ \int e^{- x} d x = - e^{- x} + c \end{array} & = & - \color{brown}{x} e^{- x} + \int^{} \color{brown}{1} \cdot e^{- x} d x\\ & = & - x e^{- x} - e^{- x} + c \end{eqnarray*}Note $$\int \color{brown}{x^n} e^{a x} d x = e^{a x} (\color{brown}{a_n x^n + a_{n - 1} x^{n - 1} + \cdots + a_1 x + a_0}) + C $$
Then $$ \begin{array}{ll} \int x^{} e^{- x} d x & = \end{array} - x e^{- x} - e^{- x} + c$$
Suppose that $\Gamma (n)$ function is defined as follows: \begin{eqnarray*} {\Gamma} (n) & = & \int^{\infty}_0 x^{n - 1} e^{- x} d x\\ & = & (n - 1) \Gamma (n - 1)\\ \Gamma (1) & = & 0! = 1\\ \Gamma (n) & = & (n - 1) ! \text{if} n = 1, 2, 3, \cdots\\ \Gamma \left( \frac{1}{2} \right) & = \sqrt{\pi} & \end{eqnarray*}
We need:
( $x^r$ and $\ln x$ ) $$ \int x^{1 / 2} \color{brown}{\ln x} d x = \frac{2}{3} x^{3 / 2} \color{brown}{\ln x} - \frac{2}{3} \int x^{3 / 2} \color{brown}{\frac{1}{x}} d x = \frac{2}{3} x^{3 / 2} \color{brown}{\ln x} - \frac{4}{9} x^{3 / 2} + C $$
( $g (x) = x^n$ and $f' (x) = \sin b x$ or $\cos b x$ ) \begin{eqnarray*} \int \color{brown}{x^2} \sin x d x & = & - \color{brown}{x^2} \cos x + \color{brown}{2} \int \color{brown}{x}^{} \cos x d x\\ & = & - \color{brown}{x^2} \cos x + \left( \color{brown}{2 x^{}} \sin x - \int \color{brown}{2} \cdot \sin x d x \right)\\ & = & - \color{brown}{x^2} \cos x + \color{brown}{2 x}^{} \sin x + \color{brown}{2} \cos x + c \end{eqnarray*}
( $e^{a x}$ and $\sin b x$ or $\cos b x$ )
$$ \begin{array}{ll} I = \int e^x \color{brown}{\sin x} d x = e^x \color{brown}{\sin x} - \int e^x \color{brown}{\cos x} d x & \end{array} $$And in the similar way, we have $$ \int e^x \color{brown}{\cos x} d x = e^x \color{brown}{\cos x} + \int e^x \color{brown}{\sin x} d x $$ From these facts, we conclude:
\begin{eqnarray*} I & = & e^x \sin x - \int e^x \cos x d x\\ & = & e^x \sin x - e^x \cos x - \int e^x \sin x d x \color{red}{(= I)}\\ & \Downarrow & \\ 2 I & = & e^x \sin x - e^x \cos x + C\\ & \Downarrow & \\ I & = & \frac{1}{2} (e^x \sin x - e^x \cos x) + C \end{eqnarray*}For such type of integration, we also have the following result:
$$ \int e^{a x} \cdot \color{brown}{\begin{array}{c} \sin b x\\ \cos b x \end{array}} d x = e^{a x} (\color{brown}{A \sin b x + B \cos b x}) +C $$Back to our example:
$$ \int e^x \color{brown}{\cos x} d x = e^x (\color{brown}{A \sin x + B \cos x}) + C $$Differentiating both sides and comparing the coefficients get the following relations: \begin{eqnarray*} e^x \cos x & = & e^x (\color{blue}{A \sin x} + B \cos x) + e^x (A \cos x \color{blue}{- B \sin x})\\ & \Downarrow & \\ \color{blue}{A - B} & = & 0\\ A + B & = & 1\\ & \Downarrow & \\ A = 1 / 2 & \text{and} & B = 1 / 2 \end{eqnarray*}
($\sin^{-1}$ or $\tan^{-1}$)
\begin{eqnarray*} \int \sin^{- 1} x d x & = & \int 1 \cdot \sin^{- 1} x d x\\ & = & x \sin^{- 1} x - \int \frac{x}{\sqrt{1 - x^2}} d x\\ & = & x + \sin^{- 1} x + \sqrt{1 - x^2 } + C \end{eqnarray*}Integrate the following integrals:
Sol:
1. Let $f (x) = x$ and $g' (x) = e^{2 x}$. Then
\begin{eqnarray*} \int \color{brown}{x} e^{2 x} d x & = & \frac{1}{2} \color{brown}{x}e^{2 x} - \frac{1}{2} \int \color{brown}{1} \cdot e^{2 x} d x\\ & = & \frac{1}{2} \color{brown}{x} e^{2 x} - \frac{1}{4} e^{2 x} + C \end{eqnarray*}2. Let $f (x) = x^2$ and $g' (x) = \cos x$. Then
\begin{eqnarray*} \text{$\int \color{brown}{x^2} \cos x d x$} & = & \color{brown}{x^2}\sin x - \text{$\color{brown}{2} \int \color{brown}{x} \sin x d x$}\\ & = & \color{brown}{x^2} \sin x + \color{brown}{2 x} \cos x -\color{brown}{2} \int \cos x d x\\ & = & \color{brown}{x^2} \sin x + \color{brown}{2 x} \cos x -\color{brown}{2} \sin x + C \end{eqnarray*}3. Since the elementary integration formula don't include logarithmic function, let $f (x) = \ln x$ and $g' (x) = x^2$. Then
\begin{eqnarray*} \text{$\int x^2 \color{brown}{\ln x} d x$} & = & \frac{1}{3} x^3\color{brown}{\ln x} - \frac{1}{3} \int x^3 \cdot\color{brown}{\frac{1}{x}} d x\\ & = & \frac{1}{3} x^3 \color{brown}{\ln x} - \frac{1}{9} x^3 + C \end{eqnarray*}4. The integration about product of exponential functions and sine function is a special case. Any type can be chosen as $f (x)$. So let $f (x) = \cos 2 x$ and $g' (x) = e^x$.
\begin{eqnarray*} \text{$\int e^x \color{brown}{\cos 2 x} d x$} & = & e^x\color{brown}{\cos 2 x} + \color{brown}{2} \int e^x\color{brown}{\sin 2 x} d x\\ & = & e^x \color{brown}{\cos 2 x} + \color{brown}{2} e^x\color{brown}{\sin 2 x} - \color{brown}{4} \int e^x\color{brown}{\cos 2 x} d x \end{eqnarray*}Moving the integral in right side to the left side gets:
$$ \int e^x \cos 2 x d x = \frac{1}{5} e^x \cos 2 x + \frac{2}{5} e^x \sin 2x + C $$5. Let $f (x) = \sin^{- 1} x$ and $g' (x) = x / \sqrt{1 - x^2}$:
\begin{eqnarray*} \text{$\int \frac{x}{\sqrt{1 - x^2}} \cdot \color{brown}{\sin^{- 1} x} dx$} & = & - \sqrt{1 - x^2} \color{brown}{\sin^{- 1} x} + \int\frac{\not{\sqrt{1 - x^2}}}{\not{\sqrt{\color{brown}{1 - x^2}}}} d x\\ & = & - \sqrt{1 - x^2} \color{brown}{\sin^{- 1} x} + x + C \end{eqnarray*}Int(x*exp(2*x))
The indefinite integral of ʃ x*exp(2*x) dx is 2⋅x (2⋅x - 1)⋅ℯ ────────────── 4
Int(x**2*cos(x))
The indefinite integral of ʃ x**2*cos(x) dx is 2 x ⋅sin(x) + 2⋅x⋅cos(x) - 2⋅sin(x)
Int(x**2*log(x))
The indefinite integral of ʃ x**2*log(x) dx is 3 3 x ⋅log(x) x ───────── - ── 3 9
Int(exp(x)*cos(2*x))
The indefinite integral of ʃ exp(x)*cos(2*x) dx is x x 2⋅ℯ ⋅sin(2⋅x) ℯ ⋅cos(2⋅x) ───────────── + ─────────── 5 5
Int(x/sqrt(1-x**2)*asin(x))
The indefinite integral of ʃ x*asin(x)/sqrt(-x**2 + 1) dx is __________ ╱ 2 x - ╲╱ - x + 1 ⋅asin(x)
Summary from the above results: we have some experienced formula:
We can differentiate the above equations to find out the coefficients to calculate integration.
a,b=symbols("a b")
Int(exp(a*x)*sin(b*x))
The indefinite integral of ʃ exp(a*x)*sin(b*x) dx is ⎧ 0 for a = 0 ∧ b ⎪ ⎪ -ⅈ⋅b⋅x -ⅈ⋅b⋅x -ⅈ⋅b⋅x ⎪x⋅ℯ ⋅sin(b⋅x) ⅈ⋅x⋅ℯ ⋅cos(b⋅x) ⅈ⋅ℯ ⋅sin(b⋅x) ⎪────────────────── - ──────────────────── + ────────────────── for a = -ⅈ⋅ ⎪ 2 2 2⋅b ⎪ ⎪ ⅈ⋅b⋅x ⅈ⋅b⋅x ⅈ⋅b⋅x ⎨ x⋅ℯ ⋅sin(b⋅x) ⅈ⋅x⋅ℯ ⋅cos(b⋅x) ℯ ⋅cos(b⋅x) ⎪ ───────────────── + ─────────────────── - ─────────────── for a = ⅈ⋅ ⎪ 2 2 2⋅b ⎪ ⎪ a⋅x a⋅x ⎪ a⋅ℯ ⋅sin(b⋅x) b⋅ℯ ⋅cos(b⋅x) ⎪ ─────────────── - ─────────────── otherwise ⎪ 2 2 2 2 ⎩ a + b a + b = 0 b b
(Example revisited) Since
$${\int x e^{2 x} dx= A x e^{2 x} + B e^{2 x} + C}, $$differentiating both sides gets:
\begin{eqnarray*} x e^{2 x} = 2 A x e^{2 x} + (A + 2 B) e^{2 x} & & \end{eqnarray*}This implies
\begin{eqnarray*} 2 A = 1 \text{ and } A + 2 B = 0 & \Rightarrow & A = \frac{1}{2} \text{ and } B = - \frac{1}{4} \end{eqnarray*}Evaluate the integral, $\int \sec^n x d x$, for $n = 1, 2, 3, \cdots$.
Sol:
First, consider the case $n = 1$: $$ \color{brown}{\int \sec x d x} = \int \sec x \cdot \frac{\sec x + \tan x}{\sec x + \tan x} d x = \ln | \sec x + \tan x| + C $$ And $n = 2$ is a trivial case: $$\color{brown}{\int \sec^2 x d x} = \tan x + C $$ For the higher power, $n \ge 3$, we have \begin{eqnarray*} \int \sec^n x d x & = & \int \sec^{n - 2} x d \tan x\\ & = & \sec^{n - 2} x \tan x - (n - 2) \int \sec^{n - 2} x \cdot \tan^2 x d x\\ & = & \sec^{n - 2} x \tan x - (n - 2) \int \sec^n x d x + (n - 2) \int \sec^{n - 2} x d x \end{eqnarray*} Then this results the following recursive formula: $$ \int \sec^n x d x = \frac{1}{n - 1} \sec^{n - 2} x \tan x - \frac{n - 2}{n - 1} \int \sec^{n - 2} x d x $$ For the case $n = 3$, the integral is $$ \color{brown}{\int \sec^3 x d x} = \frac{1}{2} \sec x \tan x + \frac{1}{2} \int \sec^{} x d x = \frac{1}{2} \sec x \tan x + \frac{1}{2} \ln | \sec x + \tan x| + C $$
from sympy import *
x=Symbol("x")
def DefInt(f,a,b):
print(" ",b)
print("The definite integral of ʃ %s dt is " %f)
print(" ",a)
pprint(integrate(f,(x,a,b)))
def Int(f,*args):
if(len(args)!=0):
a=args[0]
b=args[1]
print(" ",b)
print("The definite integral of ʃ %s dx is " %f)
print(" ",a)
pprint(integrate(f,(x,a,b)))
else:
print("The indefinite integral of ʃ %s dx is " %f)
pprint(integrate(f,x))
#**18.**
integrate(x*atan(x),x)
x**2*atan(x)/2 - x/2 + atan(x)/2
integrate(x*atan(x),(x,0,1))
-1/2 + pi/4
DefInt(x*atan(x),0,1)
1 The definite integral of ʃ x*atan(x) dt is 0 1 π - ─ + ─ 2 4
Int(x*atan(x),0,1)
1 The definite integral of ʃ x*atan(x) dx is 0 1 π - ─ + ─ 2 4
Int(x*atan(x))
The indefinite integral of ʃ x*atan(x) dx is 2 x ⋅atan(x) x atan(x) ────────── - ─ + ─────── 2 2 2
#30
Int((x**2-1)*cos(x))
The indefinite integral of ʃ (x**2 - 1)*cos(x) dx is 2 x ⋅sin(x) + 2⋅x⋅cos(x) - 3⋅sin(x)
#34.
Int(log(x+1),0,2)
2 The definite integral of ʃ log(x + 1) dx is 0 -2 + 3⋅log(3)
#36.
Int(x*sin(2*x),0,pi)
pi The definite integral of ʃ x*sin(2*x) dx is 0 -π ─── 2
#42.
Int(sin(sqrt(x)),0,pi**2/4)
pi**2/4 The definite integral of ʃ sin(sqrt(x)) dx is 0 2
Int(sin(sqrt(x)))
The indefinite integral of ʃ sin(sqrt(x)) dx is -2⋅√x⋅cos(√x) + 2⋅sin(√x)
#44.
Int(atan(sqrt(x)),0,1)
1 The definite integral of ʃ atan(sqrt(x)) dx is 0 π -1 + ─ 2
#44.
Int(atan(sqrt(x)))
The indefinite integral of ʃ atan(sqrt(x)) dx is -√x + x⋅atan(√x) + atan(√x)
1455
In this section, we will discuss the integration technique about trigonometric functions, trigonmetric integration.
Consider $$ \int \sin^m x \cos^n x d x $$ where $m$ and $n$ are integer.
and let $n = 2 k + 1$, $k \in \mathbb{R}$ \begin{eqnarray*} \int \sin^m x \cos^n x d x & = & \int \sin^m x \cos^{2 k} x \color{brown}{\cos x d x}\\ & = & \int \sin^m x (1 - \sin^2 x)^k \color{brown}{d \sin x}\\ & = & \int u^m (1 - u^2)^k d u \end{eqnarray*}
Evaluate $\int \sin x \cos^4 x d x$.
Sol: $$ \int \color{brown}{\sin x} \cos^4 x \color{brown}{d x} = - \int \cos^4 x \color{brown}{d \cos x} = \frac{- 1}{5} \cos^5 x + C $$
# EXAMPLE
Int(sin(x)**5*cos(x)**2)
The indefinite integral of ʃ sin(x)**5*cos(x)**2 dx is 7 5 3 cos (x) 2⋅cos (x) cos (x) - ─────── + ───────── - ─────── 7 5 3
Int(sin(x)**3*sqrt(cos(x)),0,pi/2)
Evaluate the integral $\int \cos^4 x d x$.
Sol:
\begin{eqnarray*} \int \cos^4 x d x & = & \int \left( \frac{1 + \cos 2 x}{2} \right)^2 d x\\ & = & \frac{1}{4} \int (1 + 2 \cos 2 x + \cos^2 2 x) d x\\ & = & \frac{1}{4} \int \left( \frac{3}{2} + 2 \cos 2 x + \frac{\cos 4 x}{2} \right) d x\\ & = & \frac{3}{8} x + \frac{1}{4} \sin 2 x + \frac{\sin 4 x}{32} + C \end{eqnarray*}Here, we use: $$ \int \cos a x d x = \frac{1}{a} \int \cos \color{brown}{a x} d \color{brown}{a x} = \frac{1}{a} \sin \color{brown}{a x} + C $$
#Example
Int(sin(x)**4)
The indefinite integral of ʃ sin(x)**4 dx is 3 3⋅x sin (x)⋅cos(x) 3⋅sin(x)⋅cos(x) ─── - ────────────── - ─────────────── 8 4 8
The second case is the integral with the integrand being $\tan^m x \sec^n x$} then
\begin{eqnarray*} \int \tan^m x \sec^n x d x & = & \int \tan^{2 k} x \sec^{n - 1} x \sec x \tan x d x\\ & = & \int (\sec^2 x - 1)^k \sec^{n - 1} x d \sec x\\ & = & \int (u^2 - 1)^k u^{n - 1} d u \end{eqnarray*} where $u = \sec x$.
Int(tan(x)**3*sec(x)**7)
Int(sqrt(tan(x))*sec(x)**6)
Int(cot(x)**5*csc(x)**5)
The indefinite integral of ʃ cot(x)**5*csc(x)**5 dx is ⎛ 4 2 ⎞ -⎝63⋅sin (x) - 90⋅sin (x) + 35⎠ ──────────────────────────────── 9 315⋅sin (x)
Int(tan(x)/sec(x)**2)
The indefinite integral of ʃ tan(x)/sec(x)**2 dx is 2 sin (x) ─────── 2
Evaluate $I = \int \sec^2 x \tan^3 x d x$.
Sol:
None of above satisfies, then by other techniques.
Consider the integral $\int \tan^n x d x$ where $n = 1, 2, 3, \cdots$.
Sol:
When $n = 1$, $$ \int \tan x d x = \int \frac{\sin x}{\cos x} d x = - \ln | \cos x| + C = \ln | \sec x| + C $$ If $n = 2$, we have $$ \int \tan^2 x d x = \int (\sec^2 x - 1) d x = \tan x - x + C $$ The more higher power, $n \ge 3$, integrals can be derived by the following recursive formula: \begin{eqnarray*} \int \tan^n x d x & = & \int \tan^{n - 2} x (\sec^2 x - 1) d x\\ & = & \frac{1}{n - 1} \tan^{n - 1} x - \int \tan^{n - 2} x d x \end{eqnarray*} For $n = 3$, the integral is: $$\int \tan^3 x d x = \frac{1}{2} \tan^2 x - \int \tan x d x = \frac{1}{2} \tan^2 x - \ln | \sec x| + C $$
There is still a exceptional case under these conditions: $n$ being even and $m$ being odd. Certainly, no absolute procedure may be used in such case. But it does not mean no way to solve this type.
Solve $\int \frac{\tan^2 x}{\sec^{} x} d x$.
Sol:
This example is just the exceptional case out of control. Consider that transform the $\tan x$ and $\sec x$ into $\sin x$ and $\cos x$: \begin{eqnarray*} \int \frac{\tan^2 x}{\sec^{} x} d x & = & \int \frac{\sec^2 x - 1}{\sec x} d x\\ & = & \int \sec x d x - \int \cos x d x\\ & = & \ln | \sec x + \tan x| - \sin x + C \end{eqnarray*}
Before the end of this section, we introduce the type of integration of $\sin a x \cos b x$ where $a \neq b$. In such cases, the following rules are needed: \begin{eqnarray*} \sin a x \cos b x & = & \frac{1}{2} (\sin (a + b) x + \sin (a - b) x)\\ \cos a x \cos b x & = & \frac{1}{2} (\cos (a + b) x + \cos (a - b) x)\\ \sin a x \sin b x & = & \frac{1}{2} (\cos (a - b) x - \cos (a + b) x) \end{eqnarray*}
Calculate $\int \sin 3 x \sin 7 x d x$.
Sol: \begin{eqnarray*} \int \sin 3 x \sin 7 x d x & = & \frac{1}{2} \int (\cos (7 - 3) x - \cos (7 + 3) x) d x\\ & = & \frac{1}{8} \sin 4 x - \frac{1}{20} \sin 10 x + C \end{eqnarray*}
Int(sin(4*x)*cos(5*x))
The indefinite integral of ʃ sin(4*x)*cos(5*x) dx is 5⋅sin(4⋅x)⋅sin(5⋅x) 4⋅cos(4⋅x)⋅cos(5⋅x) ─────────────────── + ─────────────────── 9 9
Calculate the following definite integrals, $a, b \in \mathbb{N}$:
2.
$$ \begin{array}{lll} \int_0^{2 \pi} \sin a x \sin b x = \pi \delta (a - b), & & \end{array} $$3.
$$\begin{array}{lll} \int_0^{2 \pi} \sin a x \cos b x = 0 & & \end{array} $$Sol:
2. If $a = b$, then
\begin{eqnarray*} \int_0^{2 \pi} \cos a x \cos b x d x & = & \int_0^{2 \pi} \cos^2 a x d x\\ & = & \int_0^{2 \pi} \frac{1 + \cos (2 a x)}{2} d x\\ & = & \left. \frac{x}{2} + \frac{\sin (2 a x)}{4 a} \right|^{2 \pi}_0\\ & = & \pi \end{eqnarray*}and 3) are the same.
Consider the type of integral of power of sine function: $$ I_n = \int f^n (x) d x $$
For $n \ge2$, consider \begin{eqnarray*} I_n & = & \int^{\pi / 2}_0 \sin^n x d x\\ & = & \int^{\pi / 2}_0 (- \cos x)' \cdot \sin^{n - 1} x d x\\ & = & - \left.\cos x \sin^{n - 1} x \right|^{\pi / 2}_0 + (n - 1) \int^{\pi / 2}_0 \sin^{n - 2} x \color{brown}{\cos^2 x} d x\\ & = & 0 + (n - 1) \int^{\pi / 2}_0 \sin^{n - 2} x (1 - \sin^2 x) d x\\ & \Downarrow & \\ I_n & = & \frac{n - 1}{n} \int^{\pi / 2}_0 \sin^{n - 2} x d x = \frac{n - 1}{n} I_{n - 2} \end{eqnarray*} This implies
By the help of $t = \tan \frac{x}{2}$, we have: \begin{eqnarray*} \int \frac{d x}{4 \sin x + 3 \cos x} & = & \int \frac{1}{4 \frac{2 t}{1 + t^2} + 3 \frac{1 - t^2}{1 + t^2}} \cdot \frac{2 d t}{1 + t^2}\\ & = & \int \frac{2 d t}{3 + 8 t - 3 t^2}\\ & = & \int \frac{1}{5} \left( \frac{3}{3 t + 1} - \frac{1}{t - 3} \right) d t\\ & = & \frac{1}{5} (\ln |3t + 1| - \ln |t - 3|) + C\\ & = & \frac{1}{5} \ln \left| \frac{3 t + 1}{t - 3} \right| + C\\ & = & \frac{1}{5} \ln \left| \frac{3 \tan \frac{x}{2} + 1}{\tan \frac{x}{2} - 3} \right| + C\\ & & \end{eqnarray*}
Int(1/(4*sin(x)+3*cos(x)))
The indefinite integral of ʃ 1/(4*sin(x) + 3*cos(x)) dx is ⎛ ⎛x⎞ ⎞ ⎛ ⎛x⎞ 1⎞ log⎜tan⎜─⎟ - 3⎟ log⎜tan⎜─⎟ + ─⎟ ⎝ ⎝2⎠ ⎠ ⎝ ⎝2⎠ 3⎠ - ─────────────── + ─────────────── 5 5
#6
Int(cos(x)**3)
The indefinite integral of ʃ cos(x)**3 dx is 3 sin (x) - ─────── + sin(x) 3
# 10
Int(sin(2*x)**2*cos(2*x)**4)
The indefinite integral of ʃ sin(2*x)**2*cos(2*x)**4 dx is 5 3 x sin(2⋅x)⋅cos (2⋅x) sin(2⋅x)⋅cos (2⋅x) sin(2⋅x)⋅cos(2⋅x) ── - ────────────────── + ────────────────── + ───────────────── 16 12 48 32
#18
Int(x*cos(x)**2)
The indefinite integral of ʃ x*cos(x)**2 dx is 2 2 2 2 2 x ⋅sin (x) x ⋅cos (x) x⋅sin(x)⋅cos(x) cos (x) ────────── + ────────── + ─────────────── + ─────── 4 4 2 4
#20
Int(tan(pi-x)**3)
The indefinite integral of ʃ -tan(x)**3 dx is ⎛ 2 ⎞ log⎝sin (x) - 1⎠ 1 - ──────────────── + ───────────── 2 2 2⋅sin (x) - 2
#22
Int(tan(x)**5*sec(x)**3)
The indefinite integral of ʃ tan(x)**5*sec(x)**3 dx is 4 2 35⋅cos (x) - 42⋅cos (x) + 15 ──────────────────────────── 7 105⋅cos (x)
##24
Int(tan(x)**2*sec(x)**2,0,pi/4)
pi/4 The definite integral of ʃ tan(x)**2*sec(x)**2 dx is 0 1/3
##38
Int((1+cot(x))**2*csc(x))
Int((sin(x)+cos(x))/sin(x)**3)
The indefinite integral of ʃ (sin(x) + cos(x))/sin(x)**3 dx is 2⎛x⎞ ⎛x⎞ tan ⎜─⎟ tan⎜─⎟ ⎝2⎠ ⎝2⎠ 1 1 - ─────── + ────── - ──────── - ───────── 8 2 ⎛x⎞ 2⎛x⎞ 2⋅tan⎜─⎟ 8⋅tan ⎜─⎟ ⎝2⎠ ⎝2⎠
#40
Int(sin(3*x)*sin(4*x))
The indefinite integral of ʃ sin(3*x)*sin(4*x) dx is 4⋅sin(3⋅x)⋅cos(4⋅x) 3⋅sin(4⋅x)⋅cos(3⋅x) - ─────────────────── + ─────────────────── 7 7
#48, cos^2=(cos x+sin(x))(cos(x)-sin(x))
Int(cos(2*x)/(cos(x)+sin(x)))
The indefinite integral of ʃ cos(2*x)/(sin(x) + cos(x)) dx is ⌠ ⎮ cos(2⋅x) ⎮ ─────────────── dx ⎮ sin(x) + cos(x) ⌡
1793
Sometimes, the integrand of functions based on quadratic function can be transformed into function of trigonometric functions and integrated out by trigonometric integration technique introduced above.
With suitable trigonometric functions substitution, $f (a x^2 + b x + c)$ can be simplified into function concerned with trigonometric functions.
with the following transformation respectively:
2. $a^2 + x^2 \Rightarrow x = a \tan \theta$ and $d x = a \sec^2 \theta d \theta$
\begin{eqnarray*} \int \frac{d x}{1 + x^2} & = & \int \frac{\sec^2 \theta d \theta}{\sec^2 \theta}\\ & = & \int 1 d \theta\\ & = & \theta + C = \tan^{- 1} x + C \end{eqnarray*}3. $x^2 - a^2 \Rightarrow x = a \sec \theta$ and $d x = a \sec \theta \tan \theta d \theta$
\begin{eqnarray*} \int \frac{d x}{x^2 - 4} & = & \int \frac{2 \sec \theta \tan \theta d \theta}{4 \tan^2 \theta}\\ & = & \int \frac{d \theta}{2 \sin \theta}\\ & = & - \frac{\ln | \csc \theta + \cot \theta |}{2} + C\\ & = & - \frac{\ln | \frac{x}{\sqrt{x^2 - 4}} + \frac{2}{\sqrt{x^2 - 4}} |}{2} + C\\ & = & - \frac{1}{2} \left( \ln |x - 2| - \ln \sqrt{x^2 - 4} \right) +C\\ & = & \frac{\ln | x - 2|}{4} - \frac{\ln |x + 2|}{4} + C \end{eqnarray*}Int(x**2/sqrt(9-x**2))
The indefinite integral of ʃ x**2/sqrt(-x**2 + 9) dx is __________ ⎛x⎞ ╱ 2 9⋅asin⎜─⎟ x⋅╲╱ - x + 9 ⎝3⎠ - ─────────────── + ───────── 2 2
Int(sqrt(1+x**2))
The indefinite integral of ʃ sqrt(x**2 + 1) dx is ________ ╱ 2 x⋅╲╱ x + 1 asinh(x) ───────────── + ──────── 2 2
Int((sqrt(4+x**2))**3)
The indefinite integral of ʃ (x**2 + 4)**(3/2) dx is ________ ________ 3 ╱ 2 ╱ 2 x ⋅╲╱ x + 4 5⋅x⋅╲╱ x + 4 ⎛x⎞ ────────────── + ─────────────── + 6⋅asinh⎜─⎟ 4 2 ⎝2⎠
Int(sqrt(x**2-16)/x)
The indefinite integral of ʃ sqrt(x**2 - 16)/x dx is ⎧ ⅈ⋅x ⎛4⎞ 16⋅ⅈ │1 │ ⎪- ────────────── - 4⋅ⅈ⋅acosh⎜─⎟ + ──────────────── for 16⋅│──│ > 1 ⎪ _________ ⎝x⎠ _________ │ 2│ ⎪ ╱ 16 ╱ 16 │x │ ⎪ ╱ -1 + ── x⋅ ╱ -1 + ── ⎪ ╱ 2 ╱ 2 ⎪ ╲╱ x ╲╱ x ⎨ ⎪ x ⎛4⎞ 16 ⎪ ───────────── + 4⋅asin⎜─⎟ - ─────────────── otherwise ⎪ ________ ⎝x⎠ ________ ⎪ ╱ 16 ╱ 16 ⎪ ╱ 1 - ── x⋅ ╱ 1 - ── ⎪ ╱ 2 ╱ 2 ⎩ ╲╱ x ╲╱ x
Int(1/sqrt(x**2+3))
The indefinite integral of ʃ 1/sqrt(x**2 + 3) dx is ⎛√3⋅x⎞ asinh⎜────⎟ ⎝ 3 ⎠
Evaluate the integral:
\begin{eqnarray*} \int^{\infty}_0 \frac{d x}{1 + x^2} & = & \left. \tan^{- 1} x\right|^{\infty}_0\\ & = & \tan^{- 1} \infty - \tan^{- 1} 0\\ & = & \frac{\pi}{2} \end{eqnarray*}
Take $x = 2 \sin t$:
\begin{eqnarray*} \int \frac{d x}{2 + \sqrt{4 - x^2}} & = & \int \frac{2 \cos t d t}{2 + \sqrt{4 - 4 \sin^2 t}}\\ & = & \int \frac{\cos t d t}{1 + \cos t}\\ & = & \int \left( 1 - \frac{1}{1 + \cos t} \right) d t\\ \left( \cos \frac{t}{2} = \sqrt{\frac{1 + \cos t}{2}} \right) & = & t - \int \frac{d t}{2 \cos^2 \frac{t}{2}}\\ & = & t - \frac{1}{2} \int \sec^2 \frac{t}{2} d t\\ & = & t - \tan \frac{t}{2} + C \end{eqnarray*}$(a^2 - x^2$ and $a^2 + x^2)$
\begin{eqnarray*} \int \frac{d x}{(4 - x^2) \sqrt{4 + x^2}} & = & \int \frac{d (2 \tan \theta)}{(4 - 4 \tan^2 \theta) \sqrt{4 + 4 \tan^2 \theta}} (\color{brown}{x = 2 \tan \theta})\\ & = & \frac{1}{4} \int \frac{\sec^{} \theta}{1 - \tan^2 \theta} d \theta\\ & = & \frac{1}{4} \int \frac{\cos \theta}{\cos^2 \theta - \sin^2 \theta} d \theta\\ & = & \frac{1}{4} \int \frac{d t}{1 - 2 t^2} (\color{brown}{t = \sin \theta})\\ & = & \frac{1}{8} \int \left( \frac{1 / \sqrt{2}}{t + \frac{1}{\sqrt{2}}} - \frac{1 / \sqrt{2}}{t - \frac{1}{\sqrt{2}}} \right) d t\\ & = & \frac{1}{8 \sqrt{2}} \ln \frac{t + \frac{1}{\sqrt{2}}}{t - \frac{1}{\sqrt{2}}} + C\\ & = & \frac{1}{8 \sqrt{2}} \ln \frac{\sin \theta + \frac{1}{\sqrt{2}}}{\sin \theta - \frac{1}{\sqrt{2}}} + C\\ & = & \frac{1}{8 \sqrt{2}} \ln \frac{\frac{x}{\sqrt{4 + x^2}} + \frac{1}{\sqrt{2}}}{\frac{x}{\sqrt{4 + x^2}} - \frac{1}{\sqrt{2}}} + C \end{eqnarray*}#4
Int(sqrt(4-x**2)/x**2)
The indefinite integral of ʃ sqrt(-x**2 + 4)/x**2 dx is __________ ╱ 2 ⎛x⎞ ╲╱ - x + 4 - asin⎜─⎟ - ───────────── ⎝2⎠ x
#6
Int(x**3*sqrt(1+x**2))
The indefinite integral of ʃ x**3*sqrt(x**2 + 1) dx is ________ ________ ________ 4 ╱ 2 2 ╱ 2 ╱ 2 x ⋅╲╱ x + 1 x ⋅╲╱ x + 1 2⋅╲╱ x + 1 ────────────── + ────────────── - ───────────── 5 15 15
#8
Int(1/x**3/sqrt(x**2-4))
The indefinite integral of ʃ 1/(x**3*sqrt(x**2 - 4)) dx is ⎧ _________ ⎪ ╱ 4 ⎪ ⎛2⎞ ⅈ⋅ ╱ -1 + ── ⎪ ⅈ⋅acosh⎜─⎟ ╱ 2 ⎪ ⎝x⎠ ╲╱ x │1 │ ⎪ ────────── + ──────────────── for 4⋅│──│ > 1 ⎪ 16 8⋅x │ 2│ ⎪ │x │ ⎪ ⎨ ⎛2⎞ ⎪ asin⎜─⎟ ⎪ ⎝x⎠ 1 1 ⎪- ─────── + ───────────────── - ────────────────── otherwise ⎪ 16 ________ ________ ⎪ ╱ 4 3 ╱ 4 ⎪ 8⋅x⋅ ╱ 1 - ── 2⋅x ⋅ ╱ 1 - ── ⎪ ╱ 2 ╱ 2 ⎪ ╲╱ x ╲╱ x ⎩
Explicitly,
\begin{eqnarray} \int\frac{dx}{x^3\sqrt{x^2-4}}&=&\int\frac{\sec t\tan tdt}{\sec^3t\tan t}\\ &=&\int{\cos^2t}dt\\ &=&\int\frac{1+\cos2t}{2}dt=\frac{2t+\sin2t}{4}+C \end{eqnarray}#24
Int((2*x+3)/sqrt(1-x**2))
The indefinite integral of ʃ (2*x + 3)/sqrt(-x**2 + 1) dx is __________ ╱ 2 - 2⋅╲╱ - x + 1 + 3⋅asin(x)
#26
Int(exp(x)*sqrt(exp(x)+1))
The indefinite integral of ʃ sqrt(exp(x) + 1)*exp(x) dx is ________ ________ ╱ x x ╱ x 2⋅╲╱ ℯ + 1 ⋅ℯ 2⋅╲╱ ℯ + 1 ──────────────── + ───────────── 3 3
#30
Int(x**2/sqrt(4*x-x**2))
The indefinite integral of ʃ x**2/sqrt(-x**2 + 4*x) dx is ⌠ ⎮ 2 ⎮ x ⎮ ────────────── dx ⎮ ____________ ⎮ ╲╱ -x⋅(x - 4) ⌡
Sympy could not solve this integral directly. Let us use change the variable, $u=x-2$, and re-run integration:
\begin{eqnarray} u&=&x-2\\ du&=&dx\\ \frac{x^2}{\sqrt{4x-x^2}}&=&\frac{(u+2)^2}{\sqrt{4-u^2}} \end{eqnarray}# x=t-2
Int((x+2)**2/sqrt(4-x**2))
The indefinite integral of ʃ (x + 2)**2/sqrt(-x**2 + 4) dx is __________ ╱ 2 __________ x⋅╲╱ - x + 4 ╱ 2 ⎛x⎞ - ─────────────── - 4⋅╲╱ - x + 4 + 6⋅asin⎜─⎟ 2 ⎝2⎠
The form of partial fraction functions is in form as follows: $$\frac{P_n(x)}{Q_m(x)}$$ where $P_n(x)$ and $Q_m(x)$ are polynomials of $n,m$ respectively.
Since improper partial fraction can be represented as sum of polynomial and proper rational function, it is only to consider how to manipulate the integration on proper rational function if want to manipulate integation over partial fraction.
$ax^2+2bx+c=a(x+b/a)^2+c-b^2/a$ and use trigonometric substitution to take integration over it;
f=(4*x**2-4*x+6)/(x**3-x**2-6*x)
print('f=',f,' = ',apart(f))
f= (4*x**2 - 4*x + 6)/(x**3 - x**2 - 6*x) = 3/(x + 2) + 2/(x - 3) - 1/x
Int(f)
The indefinite integral of ʃ (4*x**2 - 4*x + 6)/(x**3 - x**2 - 6*x) dx is -log(x) + 2⋅log(x - 3) + 3⋅log(x + 2)
By polynomial quotient rule:
2x | -1 | ||||
----------------------------- | |||||
2x2+x-3 | ) | 4x3 | + 0 x2 | + x | |
4x3 | + 2 x2 | -6 x | |||
-------------------------- | |||||
- 2 x2 | 7 x | ||||
- 2 x2 | - x | 3 | |||
-------------------------- | |||||
8x | -3 | ||||
2.
$$\mathbf{\frac{8x-3}{2x^2+x-3}=\frac{8x-3}{(2x+3)(x-1)}=\frac{6}{2x+3}+\frac{1}{x-1}}$$3. \begin{eqnarray} \mathbf{\int\frac{4x^3+x}{2x^2+x-3}dx}&=&\int\left(2x-1+\frac{8x-3}{2x^2+x-3}\right)dx\\ &=&\int\left(2x-1+\frac{6}{2x+3}+\frac{1}{x-1}\right)dx\\ &=&\mathbf{x^2-x+\ln|x-1|+3\ln|2x+3|+C} \end{eqnarray}
def FracInt(f,g):
func="(%s)/(%s)" %(f,g)
print("1. Integrand: (%s)/(%s) could be expressed as folllows:" %(f,g))
pf=apart(f/g)
pprint(pf)
print("2.")
Int(f/g)
FracInt(4*x**3+x,2*x**2+x-3)
1. Integrand: (4*x**3 + x)/(2*x**2 + x - 3) could be expressed as folllows: 6 1 2⋅x - 1 + ─────── + ───── 2⋅x + 3 x - 1 2. The indefinite integral of ʃ (4*x**3 + x)/(2*x**2 + x - 3) dx is 2 x - x + log(x - 1) + 3⋅log(x + 3/2)
f=(4*x**3+x)/(2*x**2+x-3)
print('f=',f,' = ',apart(f))
Int(f)
f= (4*x**3 + x)/(2*x**2 + x - 3) = 2*x - 1 + 6/(2*x + 3) + 1/(x - 1) The indefinite integral of ʃ (4*x**3 + x)/(2*x**2 + x - 3) dx is 2 x - x + log(x - 1) + 3⋅log(x + 3/2)
f=(2*x**2+3*x+7)/(x**3+x**2-x-1)
print('f=',f,' = ',apart(f))
Int(f)
f= (2*x**2 + 3*x + 7)/(x**3 + x**2 - x - 1) = -1/(x + 1) - 3/(x + 1)**2 + 3/(x - 1) The indefinite integral of ʃ (2*x**2 + 3*x + 7)/(x**3 + x**2 - x - 1) dx is 3 3⋅log(x - 1) - log(x + 1) + ───── x + 1
FracInt(x**4+3*x**3+14*x**2+14*x+41,(x**2+4)*(x**2+2*x+5))
1. Integrand: (x**4 + 3*x**3 + 14*x**2 + 14*x + 41)/((x**2 + 4)*(x**2 + 2*x + 5)) could be expressed as folllows: x + 4 1 ──────────── + 1 + ────── 2 2 x + 2⋅x + 5 x + 4 2. The indefinite integral of ʃ (x**4 + 3*x**3 + 14*x**2 + 14*x + 41)/((x**2 + 4)*(x**2 + 2*x + 5)) dx is ⎛x⎞ ⎛x 1⎞ ⎛ 2 ⎞ atan⎜─⎟ 3⋅atan⎜─ + ─⎟ log⎝x + 2⋅x + 5⎠ ⎝2⎠ ⎝2 2⎠ x + ───────────────── + ─────── + ───────────── 2 2 2
\int\frac{x+4}{x^2+2x+5}dx=\int\frac{x+1}{(x+1)^2+2^2}dx+\int\frac{3}{2^2+(x+1)^2}dx =\frac{1}{2}\ln|(x+1)^2+4|+\frac{3}{2}\tan^{-1}\frac{x+1}{2}+C }$$ the former comes substitution method and the latter comes from above.
Evaluate $$\mathbf{\int\frac{x^3-2x^2+3x+2}{x(1+x^2)^2}dx}$$
FracInt(x**3-2*x**2+3*x+2,x*(x**2+1)**2)
1. Integrand: (x**3 - 2*x**2 + 3*x + 2)/(x*(x**2 + 1)**2) could be expressed as folllows: 2⋅x - 1 2⋅(2⋅x - 1) 2 - ─────── - ─────────── + ─ 2 2 x x + 1 ⎛ 2 ⎞ ⎝x + 1⎠ 2. The indefinite integral of ʃ (x**3 - 2*x**2 + 3*x + 2)/(x*(x**2 + 1)**2) dx is x + 2 ⎛ 2 ⎞ ────── + 2⋅log(x) - log⎝x + 1⎠ + 2⋅atan(x) 2 x + 1
imply $$\mathbf{\frac{x^3-2x^2+3x+2}{x(1+x^2)^2}=\frac{2}{x}+\frac{-2x+1}{1+x^2}+\frac{-4x+2}{(1+x^2)^2}}$$
3. integrate term by term:
$$\mathbf{\int\frac{-2x+1}{1+x^2}dx=-\int\frac{2xdx}{1+x^2}+\int\frac{dx}{1+x^2}=-\ln|1+x^2|+\tan^{-1}x+C}$$
\begin{eqnarray} \mathbf{\int\frac{-4x+2}{(1+x^2)^2}dx}&=&\int\frac{-2(2x)+2}{(1+x^2)^2}dx\\ &=&-2\int\frac{(2x)dx}{(1+x^2)^2}dx+\int\frac{2}{(1+x^2)^2}dx\\ &=&\frac{2}{1+x^2}+2\int\frac{\sec^2tdt}{(1+\tan^2t)^2}\\ &=&\frac{2}{1+x^2}+2\int\cos^2tdt= \frac{2}{1+x^2}+\int(1+\cos2t)dt\\ &=&\frac{2}{1+x^2}+t+\frac{\sin2t}{2}+C=\frac{2}{1+x^2}+t+{\sin t\cos t}+C\\ &=&\mathbf{\frac{2}{1+x^2}+\tan^{-1}x+\frac{1\cdot x}{1+x^2}+C} \end{eqnarray}
#10
FracInt(2*x-1,2*x**2-x)
1. Integrand: (2*x - 1)/(2*x**2 - x) could be expressed as folllows: 1 ─ x 2. The indefinite integral of ʃ (2*x - 1)/(2*x**2 - x) dx is log(x)
#20
f=(x**4-3*x**2-3*x-2)/(x**3-x**2-2*x)
FracInt(x**4-3*x**2-3*x-2,x**3-x**2-2*x)
1. Integrand: (x**4 - 3*x**2 - 3*x - 2)/(x**3 - x**2 - 2*x) could be expressed as folllows: 1 2 1 x + 1 - ───────── - ───────── + ─ 3⋅(x + 1) 3⋅(x - 2) x 2. The indefinite integral of ʃ (x**4 - 3*x**2 - 3*x - 2)/(x**3 - x**2 - 2*x) dx is 2 x 2⋅log(x - 2) log(x + 1) ── + x + log(x) - ──────────── - ────────── 2 3 3
#28
f=x**2/(x**2+4*x+3)**2
FracInt(x**2,(x**2+4*x+3)**2)
1. Integrand: (x**2)/((x**2 + 4*x + 3)**2) could be expressed as folllows: 3 9 3 1 ───────── + ────────── - ───────── + ────────── 4⋅(x + 3) 2 4⋅(x + 1) 2 4⋅(x + 3) 4⋅(x + 1) 2. The indefinite integral of ʃ x**2/(x**2 + 4*x + 3)**2 dx is 5⋅x + 6 3⋅log(x + 1) 3⋅log(x + 3) - ────────────── - ──────────── + ──────────── 2 4 4 2⋅x + 8⋅x + 6
#44
f=cos(x)/(sin(x)**2-sin(x)-6)
#print('f=',f,":")
#pprint(apart(f))
Int(f)
The indefinite integral of ʃ cos(x)/(sin(x)**2 - sin(x) - 6) dx is log(sin(x) - 3) log(sin(x) + 2) ─────────────── - ─────────────── 5 5
#46
f=exp(x)/(exp(2*x)+2*exp(x)-8)
Int(f)
The indefinite integral of ʃ exp(x)/(exp(2*x) + 2*exp(x) - 8) dx is ⎛ x ⎞ ⎛ x ⎞ log⎝ℯ - 2⎠ log⎝ℯ + 4⎠ ─────────── - ─────────── 6 6