# SHES 2303 MATHEMATICS IN BIOLOGY

1

Finding Volumes using Integration

The idea of ﬁnding the area under some curve using inﬁnitely many inﬁntesimally thin rectangular bars can be extended to the case of ﬁnding volumes. Consider a pyramid of with unit square base. If we cut a thin, square slice of the pyramid (Figure 1), its volume is given by 2 1 1 × . v = Base × Thickness = 1 − N N If we continue to cut such slices all the way up to the tip of the pyramid, then the volume of the pyramid can be approximated using
N −1

V

=
i=1

i N

2

1 N

1 (N − 1)(N)(2N − 1) N3 6 1 1 1 1− 2− . = 6 N N = Clearly, the actual volume of the pyramid can be found by taking limN →∞ V , which yields 1/3.

0.4

x/2

f(x)

−0.4

−0.2

0.0

0.2

−x/2

0.0

0.2

0.4 x

0.6

0.8

1.0

Figure 1. Lateral view of a pyramid with unit base. Its volume can be approximated using inﬁnitely many solids with square base and extremely small thickness. In this particular example, there are only three such solids, with thickness 0.25.

1

Thus, for solids with known integrable cross-section area A(x) from x = a to x = b, their volume is given by
b

A(x)dx.
a

EXAMPLE 1. What is the volume of a cone with height h and base radius r? SOLUTION. The cross-section area is circular. The general expression for the radius at any cross-section is given by r x, h where x is the height variable (which ranges from 0 to h). Therefore, we have A(x) = π and V = πr 2 h2
h

r 2 x2 , h2 πr 2 h . 3 ♣

x2 dx =
0

We can represent solids that have volumes with circular cross-section areas on a twodimensional graph by “ﬂattening” the solid laterally, and then rotating the regions of interest around a suitable axis. For example, if we rotate the region between y = x and the x-axis about the x-axis from x = 0 to x = 1, we generate a cone which has unit height and unit radius for the circular base. EXAMPLE 2. What is the volume of the solid that is generated by revolving the region between y = x2 and the x-axis about the x-axis, from x = 0 to x = 1? What if we change the axis of revolution to the y-axis, and revolve from y = 0 to y = 1? SOLUTION. For the ﬁrst case, we get a Vietnamese conical hat with volume
1

V =
0

π(x2 )2 dx =

π . 5

For the second case, the variable of interest is y, so we must reexpress x in terms of y. We get a bullet head with volume
1

V =
0

π √ π( y)2 dy = . 2 ♣

2

2

Integration Techniques

Algebraic manipulation and substitution are two general integration techniques that are very useful for helping us to evaluate an integral. Here, we shall learn two additional techniques. When combined with the ﬁrst two methods, they increase the number of integrals that can be successfully expressed in closed form. THEOREM 1 (TC). The integration by parts formula states that, for two variables u and v, the indeﬁnite integral udv = uv − vdu;

PROOF. Use the Product Rule and the fact that integration is an antiderivative process. This result is easy to use. The idea is that we need to choose our u and dv carefully, so that vdu is easy to evaluate. Otherwise, integration by parts does not lead to simpliﬁcation and is of little use. EXAMPLE 3. Find the indeﬁnite integral x sin xdx, and subsequently evalute the integral from x = 0 to x = π/2. SOLUTION. Let u = x, and dv = sin xdx. It follows that v = − cos x (it is not necessary to add a constant because it will be cancelled anyway), and du = dx. This gives x sin xdx = −x cos x − (− cos x)dx = −x cos x + sin x + C.

To ﬁnd deﬁnite integral, we just need to apply part 2 of the Fundamental Theorem of Calculus. This means
π/2 0

x sin xdx = −x cos x + sin x]π/2 = 1. 0

3

EXAMPLE 4. In some cases, we may need to repeatedly apply integration by parts to solve the problem. Consider the integral I= x2 ex dx.

Let u = x2 , dv = ex dx. We then have du = 2xdx, and v = ex . This leads to I = x2 ex − 2 xex dx.

We then evaluate the integral in the right-hand side using integration by parts again, with u = x. The resultant integral is given by I = x2 ex − 2 xex − ex dx = x2 ex − 2(xex − ex ) + C. ♣ A useful integration technique for dealing with algebraic fractions like 1 , x(x + 1) involves splitting such fractions into a sum of several fractions called partial fractions, and then evaluating these separately. Thus, we may write 1 1 1 = − , x(x + 1) x x+1 and accordingly, its indeﬁnite integral is given by 1 dx = x(x + 1) 1 dx − x 1 dx = log |x| − log |x + 1| + C. x+1

A method for decomposing an algebraic fraction f (x)/g(x) into partial fractions is given as follows. THE METHOD OF PARTIAL FRACTIONS Step 1. For g(x), let x − r be a linear factor, and that (x − r)m is the highest power of x − r that divides g(x). The partial fractions for this factor is given by, A1 A2 Am + +···+ . 2 x − r (x − r) (x − r)m Repeat the same procedure for other linear factors of g(x). 4

Step 2. Let x2 + px + q be a quadratic factor of g(x), and suppose (x2 + px + q)n is the highest power of this factor that divides g(x). The partial fractions for this factor is given by, B1 x + C1 B2 x + C2 Bn x + Cn + 2 +···+ 2 . 2 + px + q 2 x (x + px + q) (x + px + q)n Again, repeat the same procedure for other distinct factor of g(x) that cannot be factored into linear factors with real coeﬃcients. Step 3. Equate f (x)/g(x) to the sum of all these partial fractions. Multiply both sides by g(x) to remove the fractional part on the left-hand side, and arrange the terms in decreasing powers of x. Step 4. Match coeﬃcients of powers of x on both sides and solve the resultant equations for the unknown coeﬃcients. EXAMPLE 5 (TC). Evaluate (x2 SOLUTION. We write (x2 −2x + 4 C D Ax + B = 2 + + . 2 + 1)(x − 1) x +1 x − 1 (x − 1)2 −2x + 4 dx. + 1)(x − 1)2

Multiply both sides with (x − 1)2 : −2x + 4 = (Ax + B)(x − 1)2 + C(x − 1)(x2 + 1) + D(x2 + 1). Work out the algebra carefully to obtain the solutions A = 2; B = 1; C = −2; D = 1. The proper decomposition into partial fractions is therefore (x2 2x + 1 2 1 −2x + 4 = 2 − + . 2 + 1)(x − 1) x + 1 x − 1 (x − 1)2 2x + 1 2 1 − + 2 +1 x x − 1 (x − 1)2

The required integral is given by I = dx 1 +C x−1 ♣ 5

= log(x2 + 1) + tan−1 x − 2 log |x − 1| −

3

Improper Integrals

When the upper or lower limits of integration tend to (±) inﬁnity respectively, such an integral is called an improper integral. Thus, if f (x) is continuous on [a, ∞), we write
∞ b

f (x)dx = lim
a

b→∞

f (x)dx;
a

and if f (x) is continuous on (−∞, b],
b b

f (x)dx = lim
−∞

a→−∞

f (x)dx;
a

and if f (x) is continuous on (−∞, ∞),
∞ c ∞

f (x)dx =
−∞ −∞

f (x)dx +
c

f (x)dx.

If the limit is ﬁnite, we say that the improper integral is convergent, and its value is given by the limit. On the other hand, if the limit is inﬁnite, then the improper integral is divergent, and we assign no particular value to it. EXAMPLE 6. Evaluate
1 ∞

dx . xp

SOLUTIONS. If p = 1,
b

I=
1

x−p+1 dx = xp −p + 1 lim I =

b

=
1

1 (b1−p − 1). 1−p

Therefore,
b→∞

if p > 1, and limb→∞ I = ∞ if p < 1. For the case of p = 1,
∞ 1

1 , p−1

dx = lim log b = ∞. b→∞ x ♣

6

EXAMPLE 7. Evaluate

∞ −∞

1 dx. 1 + x2

SOLUTION. We can split the integral into two parts:
∞ −∞

1 dx = 1 + x2

0 −∞

1 dx + 1 + x2

∞ 0

1 dx. 1 + x2

By symmetry (f (x) = f (−x)), we need only evaluate one of the integrals on the righthand side, and then multiple it by 2 to obtain the answer. Now,
∞ 0

1 π dx = lim tan−1 x]b = . 0 2 b→∞ 1+x 2 ♣

The solution is therefore π.

4

Monte Carlo Integration

Numerical integration can be used to evaluate integrals that have no closed forms. Even then, this method may be too complicated to program some times, particularly for multidimensional integrals. A method known as Monte Carlo integration provides a statistical solution to diﬃcult integration problems. The scientists who ﬁrst worked on the atomic bomb project in USA used this approach to calculate complicated integrals in their mathematical models. The idea of Monte Carlo integration is simple. Suppose we are interested in the area under the curve y = x2 from x = 0 to x = 1. This area is of course 1/3. Let us randomly throw darts at the region (0, 1) × (0, 1) (Figure 2). If the dart is under the curve y = x2 , we score a hit. Otherwise, we score a 0. If we throw N times, we can estimate the area under curve as #Hits Area ≈ . N As N becomes larger, intuitively our estimate of A becomes more accurate. However, because of the random nature of scoring points, we shall not obtain the exact solution - this is not a serious problem if we can provide a measure of the degree of precision of our estimate (the standard error).

7

x^2 0.0 0.0 0.2 0.4

0.6

0.8

1.0

0.2

0.4 x

0.6

0.8

1.0

Figure 2. Monte Carlo integration of y = x2 . In this example, 30 points out of 100 fall under y = x2 , giving the estimate of the area as 0.3.

Speciﬁcally, Monte Carlo integration of the preceding problem is done as follows. We can view the integral as
1

I=
0

x2 × 1dx,

where f (x) = 1 is the probability density function of the uniform distribution in the unit interval. By deﬁnition, this integral can be written as the expectation E(X 2 ), where X is a uniform random variable on the unit interval. Suppose we generate N random variables from this distribution, and evaluate x2 , . . . , x2 using them. We can 1 N approximate E(X 2 ) using N 1 x2 = µ. ˆ E(X 2 ) ≈ N i=1 i The variance of this estimator is given by Variance = 1 N 1 N −1
N

i=1

(x2 − µ)2 ˆ i

.

The standard error (SE) is obtained by taking the square root of the variance. In principle, we can obtain an arbitrarily accurate solution by making N as large as we have the resources (and patience) to compute.

8

EXAMPLE 8. Evaluate
0

xe−x dx. SOLUTION. The exact solution using integration by parts is 1 (Verify). We note that f (x) = e−x is the probability density function of an exponential random variable (Verify that its integral over the positive real line is 1). Suppose we draw N values from this exponential distribution. The integral can then by approximated by µ= ˆ 1 N
N

xi .
i=1

For my particular simulation with N = 10000, I obtained µ = 0.99836 (to 5 decimal ˆ places), with SE given by 0.01016. Within 2 SE from µ, we have the interval [0.97804 , ˆ 1.01868] (the approximate 95% conﬁdence interval). ♣

9

KTF 2009/2010(2)