## Basic Integration Principles

Integration is the process of finding the region bounded by a function; this process makes use of several important properties.

### Learning Objectives

Apply the basic principles of integration to integral problems

### Key Takeaways

#### Key Points

- The term integral may also refer to the notion of the anti- derivative, a function [latex]F[/latex] whose derivative is the given function [latex]f[/latex]. In this case, it is called an indefinite integral and is written, [latex]\int f(x)\,dx = F(x) + C[/latex].
- Integration is linear, additive, and preserves inequality of functions.
- The definite integral of [latex]f[/latex] over the interval [latex]a[/latex] to [latex]b[/latex] is given by [latex]\int_a^b f = F\vert_a^b[/latex], where [latex]F[/latex] is an anti-derivative of [latex]f[/latex].

#### Key Terms

**integration**: the operation of finding the region in the x-y plane bound by the function

Integration is an important concept in mathematics and—together with its inverse, differentiation—is one of the two main operations in calculus. Given a function [latex]f[/latex] of a real variable [latex]x[/latex], and an interval [latex][a, b][/latex] of the real line, the definite integral [latex]\int_a^b \! f(x)\,dx[/latex] is defined informally to be the area of the region in the [latex]xy[/latex]-plane bounded by the graph of [latex]f[/latex], the [latex]x[/latex]-axis, and the vertical lines [latex]x=a[/latex] and [latex]x=b[/latex], such that area above the [latex]x[/latex]-axis adds to the total, and that below the [latex]x[/latex]-axis subtracts from the total. The term integral may also refer to the notion of the anti-derivative, a function [latex]F[/latex] whose derivative is the given function [latex]f[/latex].

More rigorously, once an anti-derivative [latex]F[/latex] of [latex]f[/latex] is known for a continuous real-valued function [latex]f[/latex] defined on a closed interval [latex][a, b][/latex], the definite integral of [latex]f[/latex] over that interval is given by

[latex]\displaystyle{\int_a^b \! f(x)\,dx = F(b) - F(a)}[/latex]

If [latex]F[/latex] is one anti-derivative of [latex]f[/latex], then all other anti-derivatives will have the form [latex]F(x) + C[/latex] for some constant [latex]C[/latex]. The collection of all anti-derivatives is called the indefinite integral of [latex]f[/latex] and is written as

[latex]\displaystyle{\int f\; \mathrm d x = F(x) + C}[/latex]

Integration proceeds by adding up an infinite number of infinitely small areas. This sum can be computed by using the anti-derivative.

### Properties

### Linearity

The integral of a linear combination is the linear combination of the integrals.

[latex]\displaystyle{\int_a^b (\alpha f + \beta g)(x) \, dx = \alpha \int_a^b f(x) \,dx + \beta \int_a^b g(x) \, dx}[/latex]

### Inequalities

If [latex]f(x) \leq g(x)[/latex] for each [latex]x[/latex] in [latex][a, b][/latex], then each of the upper and lower sums of [latex]f[/latex] is bounded above by the upper and lower sums, respectively, of [latex]g[/latex]:

[latex]\displaystyle{\int_a^b f(x) \, dx \leq \int_a^b g(x) \, dx}[/latex]

### Additivity

If [latex]c[/latex] is any element of [latex][a, b][/latex], then:

[latex]\displaystyle{\int_a^b f(x) \, dx = \int_a^c f(x) \, dx + \int_c^b f(x) \, dx}[/latex]

### Reversing Limits of Integration

If [latex]a > b[/latex],

[latex]\displaystyle{\int_a^b f(x) \, dx = - \int_b^a f(x) \, dx}[/latex]

### Integration by Substitution

By reversing the chain rule, we obtain the technique called integration by substitution. Given two functions [latex]f(x)[/latex] and [latex]g(x)[/latex], we can use the following identity:

[latex]\displaystyle{\int [f'(g(x)) \cdot g'(x)]\; \mathrm d x = f(g(x)) + C}[/latex]

or written in terms of the “dummy variable” [latex]u = g(x)[/latex]:

[latex]\displaystyle{\int f'(u)\; \mathrm d u = f(u) + C}[/latex]

If we are going to use integration by substitution to calculate a definite integral, we must change the upper and lower bounds of integration accordingly.

## Integration By Parts

Integration by parts is a way of integrating complex functions by breaking them down into separate parts and integrating them individually.

### Learning Objectives

Solve integrals by using integration by parts

### Key Takeaways

#### Key Points

- Integration by parts is a theorem that relates the integral of a product of functions to the integral of their derivative and anti-derivative.
- The theorem is expressed as [latex]\int u(x) v'(x) \, dx = u(x) v(x) - \int u'(x) v(x) \, dx[/latex].
- Integration by parts may be interpreted graphically in addition to mathematically.

#### Key Terms

**integral**: also sometimes called antiderivative; the limit of the sums computed in a process in which the domain of a function is divided into small subsets and a possibly nominal value of the function on each subset is multiplied by the measure of that subset, all these products then being summed**derivative**: a measure of how a function changes as its input changes

### Introduction

In calculus, integration by parts is a theorem that relates the integral of a product of functions to the integral of their derivative and anti-derivative. It is frequently used to find the anti-derivative of a product of functions into an ideally simpler anti-derivative. The rule can be derived in one line by simply integrating the product rule of differentiation.

### Theorem of integration by parts

Let’s take the functions [latex]u = u(x)[/latex] and [latex]v = v(x)[/latex]. When taking their derivatives, we are left with [latex]du = u ‘(x)[/latex] and [latex]dxdv = v'(x) dx[/latex]. Now, let’s take a look at the principle of integration by parts:

[latex]\displaystyle{\int u(x) v'(x) \, dx = u(x) v(x) - \int u'(x) v(x) \ dx}[/latex]

or, more compactly,

[latex]\displaystyle{\int u \, dv=uv-\int v \, du}[/latex]

### Proof

Suppose [latex]u(x)[/latex] and [latex]v(x)[/latex] are two continuously differentiable functions. The product rule states:

[latex]\displaystyle{\frac{d}{dx}\left(u(x)v(x)\right) = u(x) \frac{d}{dx}\left(v(x)\right) + \frac{d}{dx}\left(u(x)\right) v(x)}[/latex]

Integrating both sides with respect to [latex]x[/latex], over an interval [latex]a \leq x \leq b[/latex],

[latex]\displaystyle{\int_a^b \frac{d}{dx}\left(u(x)v(x)\right)\,dx = \int_a^b u'(x)v(x)\,dx + \int_a^b u(x)v'(x)\,dx}[/latex]

then applying the fundamental theorem of calculus,

[latex]\displaystyle{\int_a^b \frac{d}{dx}\left(u(x)v(x)\right)\,dx = \left[u(x)v(x)\right]_a^b}[/latex]

gives the formula for “integration by parts”:

[latex]\displaystyle{\left[u(x)v(x)\right]_a^b = \int_a^b u'(x)v(x)\,dx + \int_a^b u(x)v'(x)\,dx}[/latex].

### Visulization

Let’s define a parametric curve by [latex](x, y) = (f(t), g(t))[/latex].

### Example

In order to calculate [latex]I=\int x\cos (x) \,dx[/latex], let:

[latex]u = x \\ \therefore du = dx[/latex]

and

[latex]dv = \cos(x)\,dx \\ \therefore v = \int\cos(x)\,dx = \sin x[/latex]

then:

[latex]\begin{align} \int x\cos (x) \,dx & = \int u \, dv \\ & = uv - \int v \, du \\ & = x\sin (x) - \int \sin (x) \,dx \\ & = x\sin (x) + \cos (x) + C \end{align}[/latex]

## Trigonometric Integrals

The trigonometric integrals are a specific set of functions used to simplify complex mathematical expressions in order to evaluate them.

### Learning Objectives

Solve basic trigonometric integrals

### Key Takeaways

#### Key Points

- Some of the expressions for the trigonometric integrals are found using properties of trigonometric functions.
- Some of the expressions were derived using techniques like integration by parts.
- There is no guarantee that a trigonometric integral has an analytic expression.

#### Key Terms

**trigonometric**: relating to the functions used in trigonometry: [latex]\sin[/latex], [latex]\cos[/latex], [latex]\tan[/latex], [latex]\csc[/latex], [latex]\cot[/latex], [latex]\sec[/latex]**integral**: also sometimes called antiderivative; the limit of the sums computed in a process in which the domain of a function is divided into small subsets and a possibly nominal value of the function on each subset is multiplied by the measure of that subset, all these products then being summed

### Trigonometric Integrals

The trigonometric integrals are a family of integrals which involve trigonometric functions ([latex]\sin[/latex], [latex]\cos[/latex], [latex]\tan[/latex], [latex]\csc[/latex], [latex]\cot[/latex], [latex]\sec[/latex]). The following is a list of integrals of trigonometric functions. Some of them were computed using properties of the trigonometric functions, while others used techniques such as integration by parts.

Generally, if the function, [latex]\sin(x)[/latex], is any trigonometric function, and [latex]\cos(x)[/latex] is its derivative, then

[latex]\displaystyle{\int a\cos nx\;\mathrm{d}x = \frac{a}{n}\sin nx+C}[/latex]

In all formulas, the constant [latex]a[/latex] is assumed to be nonzero, while [latex]C[/latex] denotes the integration constant.

### Integrands Involving Only Sine:

[latex]\displaystyle{\int\sin ax\;\mathrm{d}x = -\frac{1}{a}\cos ax+C\,\! \\ \int\sin^2 {ax}\;\mathrm{d}x = \frac{x}{2} - \frac{1}{4a} \sin 2ax +C= \frac{x}{2} - \frac{1}{2a} \sin ax\cos ax +C\! \\ \int\sin^3 {ax}\;\mathrm{d}x = \frac{\cos 3ax}{12a} - \frac{3 \cos ax}{4a} +C\! \\ \int x\sin^2 {ax}\;\mathrm{d}x = \frac{x^2}{4} - \frac{x}{4a} \sin 2ax - \frac{1}{8a^2} \cos 2ax +C\! \\ \int x^2\sin^2 {ax}\;\mathrm{d}x = \frac{x^3}{6} - \left( \frac {x^2}{4a} - \frac{1}{8a^3} \right) \sin 2ax - \frac{x}{4a^2} \cos 2ax +C\!}[/latex]

### Integrands Involving Only Cosine:

[latex]\int\cos ax\;\mathrm{d}x = \frac{1}{a}\sin ax+C[/latex]

[latex]\int\cos^2 {ax}\;\mathrm{d}x = \frac{x}{2} + \frac{1}{4a} \sin 2ax +C = \frac{x}{2} + \frac{1}{2a} \sin ax\cos ax +C[/latex]

[latex]\int\cos^n ax\;\mathrm{d}x = \frac{\cos^{n-1} ax\sin ax}{na} + \frac{n-1}{n}\int\cos^{n-2} ax\;\mathrm{d}x \qquad\mbox{(for }n>0\mbox{)}[/latex]

[latex]\int x\cos ax\;\mathrm{d}x = \frac{\cos ax}{a^2} + \frac{x\sin ax}{a}+C[/latex]

[latex]\int x^2\cos^2 {ax}\;\mathrm{d}x = \frac{x^3}{6} + \left( \frac {x^2}{4a} - \frac{1}{8a^3} \right) \sin 2ax + \frac{x}{4a^2} \cos 2ax +C[/latex]

### Integrands Involving Only Tangent:

[latex]\begin{align}\int\tan ax\;\mathrm{d}x &= -\frac{1}{a}\ln \left|\cos ax \right|+C\\ & = \frac{1}{a}\ln \left|\sec ax \right|+C\end{align}[/latex]

[latex]\displaystyle{\int\tan^n ax\;\mathrm{d}x = \frac{1}{a(n-1)}\tan^{n-1} ax-\int\tan^{n-2} ax\;\mathrm{d}x}[/latex]

where [latex]n \neq 1[/latex]; and

[latex]\displaystyle{\int\frac{\mathrm{d}x}{q \tan ax + p} = \frac{1}{p^2 + q^2}(px + \frac{q}{a}\ln \left|q\sin ax + p\cos ax \right|)+C }[/latex]

where [latex]p^2 + q^2 \neq 0[/latex].

### Integrands Involving Only Secant:

[latex]\displaystyle{\int \sec{ax} \, \mathrm{d}x = \frac{1}{a}\ln{\left| \sec{ax} + \tan{ax}\right|}+C}[/latex]

[latex]\displaystyle{\int \sec^2{x} \, \mathrm{d}x = \tan{x}+C}[/latex]

### Integrands involving only cosecant:

[latex]\displaystyle{\int \csc{ax} \, \mathrm{d}x = \frac{1}{a}\ln{\left| \csc{ax}-\cot{ax}\right|}+C}[/latex]

[latex]\displaystyle{\int \csc^2{x} \, \mathrm{d}x = -\cot{x}+C}[/latex]

### Complicated Trigonometric Integrals

We now look at integrals involving the product of a power of [latex]\sin x[/latex] and a power of [latex]\cos x[/latex]. Two simple examples of such integrals are [latex]\int \sin^k x \cos x \; \mathrm d x[/latex] and [latex]\int \cos^k x \sin x\; \mathrm d x[/latex], which can be solved used the substitutions [latex]u = \sin x[/latex] and [latex]u = \cos x[/latex], respectively. We now consider the more general case of [latex]\int \sin^n x \cos^m x\; \mathrm d x[/latex], where [latex]n[/latex] and [latex]m[/latex] are positive integers.

- If [latex]n[/latex] is odd, we can pull out one factor of [latex]\sin x[/latex], convert the rest to cosines using the identity [latex]\sin^2 x + \cos^2 x = 1[/latex], and then use the substitution [latex]u = \cos x[/latex].
- If [latex]m[/latex] is odd, we can pull out one factor of [latex]\cos x[/latex], convert the rest to sines using the identity [latex]\sin^2 x + \cos^2 x = 1[/latex], and then use the substitution [latex]u = \sin x[/latex].
- If both [latex]n[/latex] and [latex]m[/latex] are odd, we can use either of the above two methods.
- If both [latex]n[/latex] and [latex]m[/latex] are even, then we can try to use a combination of the following three identities: [latex]\cos^2 x = \frac{1}{2} (1 + \cos 2x)[/latex], [latex]\sin^2 x = \frac{1}{2} (1 - \sin 2x)[/latex], and [latex]\sin x \cos x = \frac{1}{2} \sin 2x[/latex].

## Trigonometric Substitution

Trigonometric functions can be substituted for other expressions to change the form of integrands and simplify the integration.

### Learning Objectives

Use trigonometric substitution to solve an integral

### Key Takeaways

#### Key Points

- If the integrand contains [latex]a^2 − x^2[/latex], let [latex]x = a \sin(\theta)[/latex].
- If the integrand contains [latex]a^2 + x^2[/latex], let [latex]x = a \tan(\theta)[/latex].
- If the integrand contains [latex]x^2 - a^2[/latex], let [latex]x = a \sec(\theta)[/latex].

#### Key Terms

**trigonometric**: relating to the functions used in trigonometry: [latex]\sin[/latex], [latex]\cos[/latex], [latex]\tan[/latex], [latex]\csc[/latex], [latex]\cot[/latex], [latex]\sec[/latex]

Trigonometric functions can be substituted for other expressions to change the form of integrands. One may use the trigonometric identities to simplify certain integrals containing radical expressions (or expressions containing [latex]n[/latex]th roots). The following are general methods of trigonometric substitution, depending on the form of the function to be integrated.

### Substitution Rule #1

If the integral contains [latex]a^2-x^2[/latex], let [latex]x = a \sin(\theta)[/latex] and use the identity:

[latex]1-\sin^2(\theta) = \cos^2(\theta)[/latex]

### Substitution Rule #2

If the integrand contains [latex]a^2+x^2[/latex], let [latex]x = a \tan(\theta)[/latex] and use the identity:

[latex]1+\tan^2(\theta) = \sec^2(\theta)[/latex]

### Substitution Rule #3

If the integrand contains [latex]x^2-a^2[/latex], let [latex]x = a \sec(\theta)[/latex] and use the identity:

[latex]\sec^2(\theta)-1 = \tan^2(\theta)[/latex]

Note that, for a definite integral, one must figure out how the bounds of integration change due to the substitution.

### Examples

In order to better understand these substitutions, let’s go over the derivation of some of them.

### Example 1: Integrals where the integrand contains [latex]a^2 − x^2[/latex] (where [latex]a[/latex] is positive)

In the integral

[latex]\displaystyle{\int\frac{dx}{\sqrt{a^2-x^2}}}[/latex]

we may use:

[latex]\displaystyle{x=a\sin(\theta)\\ dx=a\cos(\theta)\,d\theta\\ \theta=\arcsin\left(\frac{x}{a}\right)}[/latex]

With the substitution, we get:

[latex]\begin{align} \int\frac{dx}{\sqrt{a^2-x^2}} & = \int\frac{a\cos(\theta)\,d\theta}{\sqrt{a^2-a^2\sin^2(\theta)}} \\ &= \int\frac{a\cos(\theta)\,d\theta}{\sqrt{a^2(1-\sin^2(\theta))}} \\ &= \int\frac{a\cos(\theta)\,d\theta}{\sqrt{a^2\cos^2(\theta)}} \\ &= \int d\theta \\ &= \theta+C \\ &= \displaystyle{\arcsin \left(\frac{x}{a}\right)}+C \end{align}[/latex]

### Example 2: Integrals where the integrand contains [latex]a^2 − x^2[/latex] (where [latex]a[/latex] is not zero)

In the integral

[latex]\displaystyle{\int\frac{dx}{{a^2+x^2}}}[/latex]

we may use:

[latex]\displaystyle{x=a\tan(\theta)\\ dx=a\sec^2(\theta)\,d\theta\\ \theta=\arctan\left(\frac{x}{a}\right)}[/latex]

With the substitution, we get:

[latex]\begin{align}\int\frac{dx}{{a^2+x^2}} &= \int\frac{a\sec^2(\theta)\,d\theta}{{a^2+a^2\tan^2(\theta)}} \\ &= \int\frac{a\sec^2(\theta)\,d\theta}{{a^2(1+\tan^2(\theta))}} \\ &= \int \frac{a\sec^2(\theta)\,d\theta}{{a^2\sec^2(\theta)}} \\ &= \int \frac{d\theta}{a} \\ &= \frac{\theta}{a}+C \\ &= \frac{1}{a} \arctan \left(\frac{x}{a}\right)+C\end{align}[/latex]

## The Method of Partial Fractions

Partial fraction expansions provide an approach to integrating a general rational function.

### Learning Objectives

Use partial fraction decomposition to integrate rational functions

### Key Takeaways

#### Key Points

- Any rational function of a real variable can be written as the sum of a polynomial and a finite number of rational fractions whose denominator is the power of an irreducible polynomial and whose numerator has a degree lower than the degree of this irreducible polynomial.
- The substitution [latex]u = ax + b[/latex], [latex]du = a \,dx[/latex] reduces the integral as the following: [latex]\int {1 \over ax+b}\,dx = {1 \over a} \ln\left|ax+b\right|+C[/latex].
- When there is an irreducible 2nd-degree polynomial in the denominator, complete the square and change the variable.

#### Key Terms

**irreducible**: unable to be factorized into polynomials of lower degree, as [latex]x^2 + 1[/latex]

Partial fraction expansions provide an approach to integrating a general rational function. Any rational function of a real variable can be written as the sum of a polynomial and a finite number of rational fractions whose denominator is the power of an irreducible polynomial and whose numerator has a degree lower than the degree of this irreducible polynomial. Here are some common examples.

### A 1st-Degree Polynomial in the Denominator

The substitution [latex]u = ax + b[/latex], [latex]du = a \,dx[/latex] reduces the integral [latex]\int {1 \over ax+b}\,dx[/latex] to:

[latex]\begin{align}\int {1 \over u}\,{du \over a}&={1 \over a}\int{du\over u}\\ &={1 \over a}\ln\left|u\right|+C \\ &= {1 \over a} \ln\left|ax+b\right|+C\end{align}[/latex]

### A Repeated 1st-Degree Polynomial in the Denominator

The same substitution reduces such integrals as [latex]\int {1 \over (ax+b)^8}\,dx[/latex] to

[latex]\begin{align}\int {1 \over u^8}\,{du \over a}&={1 \over a}\int u^{-8}\,du \\ &= {1 \over a} \cdot{u^{-7} \over(-7)}+C \\ &= {-1 \over 7au^7}+C \\ &= {-1 \over 7a(ax+b)^7}+C\end{align}[/latex]

### An Irreducible 2nd-Degree Polynomial in the Denominator

Next we consider integrals such as

[latex]\displaystyle{\int {x+6 \over x^2-8x+25}\,dx}[/latex]

The quickest way to see that the denominator, [latex]x^2 − 8x + 25[/latex], is irreducible is to observe that its discriminant is negative. Alternatively, we can complete the square:

[latex]\begin{align}x^2-8x+25&=(x^2-8x+16)+9\\ &=(x-4)^2+9\end{align}[/latex]

and observe that this sum of two squares can never be [latex]0[/latex] while [latex]x[/latex] is a real number. In order to make use of the substitution

[latex]\begin{align} u & = x^2-8x+25 \\ du & =(2x-8)\,dx \\ \frac{du}{2} & = (x-4)\,dx \end{align}[/latex]

we would need to find [latex](x-4)[/latex] in the numerator. So we decompose the numerator [latex]x + 6[/latex] as [latex](x-4) + 10[/latex], and we write the integral as

[latex]\displaystyle{\int {x-4 \over x^2-8x+25}\,dx + \int {10 \over x^2-8x+25}\,dx}[/latex]

The substitution handles the first summand, thus:

[latex]\begin{align}\int \frac{x-4}{x^2-8x+25}\,dx &= \int \frac{\displaystyle{\frac{du}{2}}}{u} \\ &= \frac{1}{2}\ln\left|u\right|+C \\ &= \frac{1}{2}\ln(x^2-8x+25)+C\end{align}[/latex]

Note that the reason we can discard the absolute value sign is that, as we observed earlier, [latex](x-4)^2 + 9[/latex] can never be negative.

Next we must treat the integral

[latex]\displaystyle{\int {10 \over x^2-8x+25} \, dx}[/latex]

With a little more algebra,

[latex]\begin{align} \int {10 \over x^2-8x+25} \, dx &= \int {10 \over (x-4)^2+9} \, dx \\ & = \int \frac{\displaystyle{\frac{10}{9}}}{\left(\displaystyle{\frac{x-4}{3}}\right)^2+1}\,dx \\ &= {10 \over 3} \arctan\left(\frac{x-4}{3}\right) + C \end{align}[/latex]

Putting it all together:

[latex]\displaystyle{\int {x + 6 \over x^2-8x+25}\,dx = {1 \over 2}\ln(x^2-8x+25) + {10 \over 3} \arctan\left({x-4 \over 3}\right) + C}[/latex]

## Integration Using Tables and Computers

Tables of known integrals or computer programs are commonly used for integration.

### Learning Objectives

Recognize which integrals should be solved using tables or computers due to their complexity

### Key Takeaways

#### Key Points

- While differentiation has easy rules by which the derivative of a complicated function can be found by differentiating its simpler component functions, integration does not.
- In books with integral tables, a compilation of a list of integrals and techniques of integral calculus can be found.
- There are several commercial softwares, such as Mathematica or Matlab, that can perform symbolic integration.

#### Key Terms

**integral**: also sometimes called antiderivative; the limit of the sums computed in a process in which the domain of a function is divided into small subsets and a possibly nominal value of the function on each subset is multiplied by the measure of that subset, all these products then being summed

Integration is the basic operation in integral calculus. While differentiation has easy rules by which the derivative of a complicated function can be found by differentiating its simpler component functions, integration does not, so tables of known integrals are often useful. We also may have to resort to computers to perform an integral.

### Integration Using Tables

A compilation of a list of integrals and techniques of integral calculus was published by the German mathematician Meyer Hirsch as early as in 1810. More extensive tables were compiled in 1858 by the Dutch mathematician David de Bierens de Haan. A new edition was published in 1862. These tables, which contain mainly integrals of elementary functions, remained in use until the middle of the 20th century. They were then replaced by the much more extensive tables of Gradshteyn and Ryzhik. Here are a few examples of integrals in these tables for logarithmic functions:

[latex]\int\ln ax\;dx = x\ln ax - x[/latex]

[latex]\displaystyle{\int\ln (ax + b)\;dx = \frac{(ax+b)\ln(ax+b) - ax}{a}}[/latex]

[latex]\int (\ln x)^2\; dx = x(\ln x)^2 - 2x\ln x + 2x[/latex]

[latex]\displaystyle{\int (\ln x)^n\; dx = x\sum^{n}_{k=0}(-1)^{n-k} \frac{n!}{k! }(\ln x)^k}[/latex]

[latex]\displaystyle{\int \frac{dx}{\ln x} = \ln\left|\ln x \right| + \ln x + \sum^\infty_{k=2}\frac{(\ln x)^k}{k\cdot k! }}[/latex]

[latex]\displaystyle{\int \frac{dx}{(\ln x)^n} = -\frac{x}{(n-1)(\ln x)^{n-1}} + \frac{1}{n-1}\int\frac{dx}{(\ln x)^{n-1}} \qquad\mbox{(for }n\neq 1\mbox{)}}[/latex]

You can certainly see that these integrals are hard to do simply “by hand.”

### Integration Using Computers

Computers may be used for integration in two primary ways. First, numerical methods using computers can be helpful in evaluating a definite integral. There are many methods and algorithms. We will briefly learn about numerical integration in another atom. Second, there are several commercial softwares, such as Mathematica or Matlab, that can perform symbolic integration.

Example: Mathematica’s symbolic integration produces the following result:

[latex]\int \log(1-x^2) dx = -2x-\log(x-1) + \log(1+x) +x \log(1-x^2).[/latex]

These programs know how to perform almost any integral that can be done analytically or in terms of standard mathematical functions.

## Approximate Integration

The trapezoidal rule (also known as the trapezoid rule or trapezium rule) is a technique for approximating the definite integral [latex]\int_{a}^{b} f(x)\, dx[/latex].

### Learning Objectives

Use the trapezoidal rule to approximate the value of a definite integral

### Key Takeaways

#### Key Points

- The trapezoidal rule works by approximating the region under the graph of the function [latex]f(x)[/latex] as a trapezoid and calculating its area: [latex]\int_{a}^{b} f(x)\, dx \approx (b-a)\frac{f(a) + f(b)}{2}[/latex].
- For a domain discretized into [latex]N[/latex] equally spaced panels, or [latex]N+1[/latex] grid points [latex](1, 2, \cdots, N+1)[/latex], where the grid spacing is [latex]h=\frac{(b-a)}{N}[/latex], the approximation to the integral becomes [latex]\int_{a}^{b} f(x)\, dx = \frac{b-a}{2N}(f(x_1) + 2f(x_2) + 2f(x_3) + \ldots + 2f(x_N) + f(x_{N+1}))[/latex].
- In two and more dimensions, where simple approximation methods become prohibitively expensive in terms of computational effort, one may use other methods such as the Monte Carlo method.

#### Key Terms

**trapezoid**: a (convex) quadrilateral with two (non-adjacent) parallel sides

Numerical integration, in some instances also known as numerical quadrature, asks for the value of a definite integral. Popular methods use one of the Newton–Cotes formulas (such as midpoint rule or Simpson’s rule) or Gaussian quadrature. These methods rely on a “divide and conquer” strategy, whereby an integral on a relatively large set is broken down into integrals on smaller sets. In higher dimensions, where these methods become prohibitively expensive in terms of computational effort, one may use other methods such as the Monte Carlo method. Here, we will study a very simple approximation technique, called a trapezoidal rule.

### Trapezoidal rule

The trapezoidal rule (also known as the trapezoid rule or trapezium rule) is a technique for approximating the definite integral [latex]\int_{a}^{b} f(x)\,dx[/latex]. The trapezoidal rule works by approximating the region under the graph of the function [latex]f(x)[/latex] as a trapezoid and calculating its area. It follows that:

[latex]\displaystyle{\int_{a}^{b} f(x)\, dx \approx (b-a)\frac{f(a) + f(b)}{2}}[/latex]

The trapezoidal rule tends to become extremely accurate when periodic functions are integrated over their periods.

### Numerical Implementation of the Trapezoidal Rule

For a domain discretized into [latex]N[/latex] equally spaced panels, or [latex]N+1[/latex] grid points [latex](1, 2, \cdots, N+1)[/latex], where the grid spacing is [latex]h=\frac{(b-a)}{N}[/latex], the approximation to the integral becomes:

[latex]\begin{align}\int_{a}^{b} f(x)\, dx &\approx \frac{h}{2} \sum_{k=1}^{N} \left( f(x_{k+1}) + f(x_{k}) \right) {} \\ &= \frac{b-a}{2N}(f(x_1) + 2f(x_2) + \cdots + 2f(x_N) + f(x_{N+1}))\end{align}[/latex]

Although the method can adopt a nonuniform grid as well, this example used a uniform grid for the the approximation.

## Improper Integrals

An Improper integral is the limit of a definite integral as an endpoint of the integral interval approaches either a real number or [latex]\infty[/latex] or [latex]-\infty[/latex].

### Learning Objectives

Evaluate improper integrals with infinite limits of integration and infinite discontinuity

### Key Takeaways

#### Key Points

- An improper integral may be a limit of the form [latex]\lim_{b\to\infty} \int_a^bf(x)\, \mathrm{d}x, \, \lim_{a\to -\infty} \int_a^bf(x)\, \mathrm{d}x[/latex].
- It could also be a limit of the form [latex]\lim_{c\to b^-} \int_a^cf(x)\, \mathrm{d}y,\, \lim_{c\to a^+} \int_c^bf(x)\, \mathrm{d}x[/latex], in which one takes a limit in one or the other (or sometimes both) endpoints.
- It is often necessary to use improper integrals in order to compute a value for integrals which may not exist in the conventional sense (as a Riemann integral, for instance) because of a singularity in the function, or an infinite endpoint of the domain of integration.

#### Key Terms

**integrand**: the function that is to be integrated**definite integral**: the integral of a function between an upper and lower limit

An improper integral is the limit of a definite integral as an endpoint of the interval(s) of integration approaches either a specified real number or [latex]\infty[/latex] or [latex]-\infty[/latex] or, in some cases, as both endpoints approach limits. Such an integral is often written symbolically just like a standard definite integral, perhaps with infinity as a limit of integration. But that conceals the limiting process.

Specifically, an improper integral is a limit of one of two forms.

First, an improper integral could be a limit of the form:

[latex]\displaystyle \lim_{b\to\infty} \int_a^bf(x)\, \mathrm{d}x, \, \lim_{a\to -\infty} \int_a^bf(x)\, \mathrm{d}x[/latex]

Second, an improper integral could be a limit of the form:

[latex]\displaystyle \lim_{c\to b^-} \int_a^cf(x)\, \mathrm{d}y,\, \lim_{c\to a^+} \int_c^bf(x)\, \mathrm{d}x[/latex]

in which one takes a limit at one endpoint or the other (or sometimes both).

Integrals are also improper if the integrand is undefined at an interior point of the domain of integration, or at multiple such points. It is often necessary to use improper integrals in order to compute a value for integrals which may not exist in the conventional sense (as a Riemann integral, for instance) because of a singularity in the function, or an infinite endpoint of the domain of integration.

### Example 1

The original definition of the Riemann integral does not apply to a function such as [latex]\frac{1}{x^2}[/latex] on the interval [latex][1, \infty][/latex], because in this case the domain of integration is unbounded. However, the Riemann integral can often be extended by continuity, by defining the improper integral instead as a limit:

[latex]\begin{align} \int_1^\infty \frac{1}{x^2}\,\mathrm{d}x &=\lim_{b\to\infty} \int_1^b\frac{1}{x^2}\,\mathrm{d}x \\ &= \lim_{b\to\infty} \left(-\frac{1}{b} + \frac{1}{1}\right) \\ &= 1\end{align}[/latex]

### Example 2

The narrow definition of the Riemann integral also does not cover the function [latex]\frac{1}{\sqrt{x}}[/latex] on the interval [latex][0, 1][/latex]. The problem here is that the integrand is unbounded in the domain of integration (the definition requires that both the domain of integration and the integrand be bounded). However, the improper integral does exist if understood as the limit

[latex]\begin{align}\displaystyle \int_0^1 \frac{1}{\sqrt{x}}\,\mathrm{d}x &=\lim_{a\to 0^+}\int_a^1\frac{1}{\sqrt{x}}\, \mathrm{d}x \\ &= \lim_{a\to 0^+}(2\sqrt{1}-2\sqrt{a})\\ &=2\end{align}[/latex]

## Numerical Integration

Numerical integration constitutes a broad family of algorithms for calculating the numerical value of a definite integral.

### Learning Objectives

Solve definite integrals

### Key Takeaways

#### Key Points

- The basic problem considered by numerical integration is to compute an approximate solution to a definite integral: [latex]\int_a^b\! f(x)\, dx[/latex].
- There are several reasons for carrying out numerical integration. It could be due to the specific nature of the function (to be integrated) or its antiderivatives.
- A large class of quadrature rules can be derived by constructing interpolating functions which are easy to integrate. Typically these interpolating functions are polynomials. Midpoint method and trapezoidal method are simple examples.

#### Key Terms

**trapezoidal**: in the shape of a trapezoid, or having some faces which have one pair of parallel sides**antiderivative**: an indefinite integral

Numerical integration constitutes a broad family of algorithms for calculating the numerical value of a definite integral, and, by extension, the term is also sometimes used to describe the numerical solution of differential equations. This article focuses on calculation of definite integrals. The term numerical quadrature (often abbreviated to quadrature) is more or less a synonym for numerical integration, especially as applied to one-dimensional integrals. Numerical integration over more than one dimension is sometimes described as cubature, although the meaning of quadrature is understood for higher dimensional integration as well.

The basic problem considered by numerical integration is to compute an approximate solution to a definite integral:

[latex]\displaystyle{\int_a^b\! f(x)\, dx}[/latex]

If [latex]f(x)[/latex] is a smooth well-behaved function, integrated over a small number of dimensions and the limits of integration are bounded, there are many methods of approximating the integral with arbitrary precision.

### Reasons for numerical integration

- There are several reasons for carrying out numerical integration. The integrand [latex]f(x)[/latex] may be known only at certain points, such as when obtained by sampling. Some embedded systems and other computer applications may need numerical integration for this reason.
- A formula for the integrand may be known, but it may be difficult or impossible to find an antiderivative which is an elementary function. An example of such an integrand [latex]f(x)=\exp(-x^2)[/latex], the antiderivative of which (the error function, times a constant) cannot be written in elementary form.
- It may be possible to find an antiderivative symbolically, but it may be easier to compute a numerical approximation than to compute the antiderivative. That may be the case if the antiderivative is given as an infinite series or product, or if its evaluation requires a special function which is not available.

### Methods for One-Dimensional Integrals

A large class of quadrature rules can be derived by constructing interpolating functions which are easy to integrate. Typically these interpolating functions are polynomials. The simplest method of this type is to let the interpolating function be a constant function (a polynomial of degree zero) which passes through the point [latex]\left(\frac{(a+b)}{2}, f\left(\frac{(a+b)}{2}\right)\right)[/latex]. This is called the midpoint rule or rectangle rule:

[latex]\displaystyle{\int_a^b f(x)\,dx \approx (b-a) \, f\left(\frac{a+b}{2}\right)}[/latex]

The interpolating function may be an affine function (a polynomial of degree 1) which passes through the points [latex](a, f(a))[/latex] and [latex](b, f(b))[/latex]. This is called the trapezoidal rule.

For either one of these rules, we can make a more accurate approximation by breaking up the interval [latex][a, b][/latex] into some number [latex]n[/latex] of subintervals, computing an approximation for each subinterval, then adding up all the results. This is called a composite rule, extended rule, or iterated rule. For example, the composite trapezoidal rule can be stated as

[latex]\displaystyle{\int_a^b f(x)\,dx \approx \frac{b-a}{n} \left( {f(a) \over 2} + \sum_{k=1}^{n-1} \left( f \left( a+k \frac{b-a}{n} \right) \right) + {f(b) \over 2} \right)}[/latex]

where the subintervals have the form [latex][k h, (k+1) h][/latex], with [latex]h= \frac{(b-a)}{n}[/latex] and [latex]k = 0, 1, 2, \cdots, n−1[/latex].