Lecture 7: Integration

Lecture 7: Integration
∗
In Song Kim†
September 12, 2011
1
Introduction to Integrals
See S&B appendix A4 (page 887) Integration is about calculating the area contained between a
function and the axis. E.g., we want to calculate the area between the function y = 2x + 1
f HxL
10
5
-4
x value
-2
2
4
-5
Figure 1: Graph of f (x) = 2x + 1
between the values of x = −1 and x = 2.
We could do this by the area formal for a triangle. Our base is 3 units long, and our height is
y = 2(2) + 1 = 5. Hence that area is 12 3 ∗ 5 = 7.5. Unfortunately, often we will not be given such
nice functions that intersect axes is nice ways to let us use these simple rules. Before getting to
integrating, lets build up some concepts.
2
Riemann and approximations to the integral
In this section, we study the integral calculus from a particular perspective, i.e., that of the Riemann
integral. Riemann’s idea was to use the notion of “area under the curve” for the definition of
integration. This is not the only way to define integrals and has its own limitations (e.g., the
Lebesgue integral is commonly used in modern probability theory). Nevertheless, the Riemann
integral gives a useful starting point for studying integral calculus.
∗
†
Please do not distribute without permission.
Ph.D. candidate, Department of Politics, Princeton University, Princeton NJ 08544.Email: [email protected]
1
• Riemann Sum: We want to determine the area A(R) of a region R defined by a curve f (x)
and some interval a ≤ x ≤ b. In our example before f (x) = 2x + 1 and a = −1, b = 2. One
way to calculate the area would be to divide the interval a ≤ x ≤ b into n subintervals of
length ∆x and approximate the region with a series of rectangles.
Each base of each rectangle is ∆x =
xi = ai + ∆x
2 .
b−a
n ,
and the height is f (x) at the midpoint of that interval,
A(R) would then be approximated by the area of all of the rectangles added together, which is
given by
n
X
S(f, ∆x) =
f (xi )∆x
i=1
This is called a Riemann sum.
• As we decrease the size of the subintervals ∆x, making the rectangles “thinner,” we would
expect our approximation of the area of the region to become closer to the true area. *Interpretation on board*. This gives the limiting process
A(R) = lim
∆x→0
n
X
f (xi )∆x
i=1
• Riemann Integral: If for a given function f the Riemann sum approaches a limit as ∆x → 0,
then that limit is called the Riemann integral of f from a to b. Formally,
Zb
f (x)dx = lim
∆x→0
a
n
X
f (xi )∆x
i=1
NOTE: All we have done is replaced one mathematical symbol, and its use with the limit
concept, with the integral symbol.
Figure 2: Notations for Integral
2
3
Integrals
3.1
Preliminary definitions: definite vs. indefinite
Definition 1 Definite Integral: We use the notation
Rb
f (x)dx to denote the definite integral of
a
f from a to b. The definite integral
Rb
f (x)dx is the area under the “curve” f (x) from x = a to
a
x = b.
Remember that this area can be negative, and hence “cancels out” areas of the curve that are
above the axis.
Definition 2 Indefinite Integral of a function f (x) is a function F (x) such that its derivative
is f (x). ie, (F 0 (x) = f (x)). It is denoted as:
Z
f (x)dx = F (x) + C
F is sometimes called the antiderivative of f , and C is just some constant number.
The key difference between the definite and indefinite integral is the the constant C is a constant.
What is the C for?
To see why we need a C, consider the following two functions.
f HxL
4
2
-4
-2
2
4
x value
-2
-4
Figure 3: Graph of f (x) = x2 + 1 and g(x) = x2 + 3
Note that, for every x, the value of the derivative will be exactly the same. If two functions
have the same derivative everywhere, then they differ only by a constant.
Theorem 3.1 Uniqueness Theorem If F and G are antiderivatives of f on some interval I (
i.e., F 0 (x) = G0 (x) = f (x) for all x in I ) then there is a constant C such that F (x) = G(x) + C
for all x in I. As a consequence of this theorem, we add the constant C to an indefinite integral.
*Geometric demonstration of this**Example of calculating C*[not covered]
3
3.2
Combining the concepts
Definition 3 Definite Integral in the interval [a,b] is the Indefinite Integral evaluated at a and
b. Mathematically:
Z b
f (x)dx = F (b) − F (a)
a
Notice how the C terms cancel out in the evaluation.
Thus in practice, the ’nuissance’ of the C term is pretty minimal, in that many times we will
be calculating definite integrals.
4
Fundamental Theorems of Calculus
Theorem 4.1 First Fundamental Theorem of Calculus: Let the function f be bounded on
[a, b] and continuous on (a, b). Then the function
Zx
F (x) =
f (s)ds,
a≤x≤b
a
has a derivative at each point in (a, b) and
F 0 (x) = f (x),
a<x<b
This last point shows that differentiation is the inverse of integration.
Example 1
Rx
d
• dx
a costdt
Rx 1
d
• dx
0 1+t2 dt
R5
d
• dx
x 3tsintdt
Theorem 4.2 Second Fundamental Theorem of Calculus: Let the function f be bounded
on [a, b] and continuous on (a, b). Let F be any function that is continuous on [a, b] such that
F 0 (x) = f (x) on (a, b). Then
Zb
f (x)dx = F (b) − F (a)
a
Example 2
Rπ
• 0 cosxdx
R 1/2 dx
• 0 √1−x
2
•
R4
1
3√
2 x
−
2
x
dx
Example 3 Find the following integrals.
R2
√
1. 1 4x2 + x − x3 dx
R
2. (x3 + 3x2 + 1)3 (x2 + 2x) dx
4
5
Computing integrals
At the end of the day we often times want a number, telling us the area under our curve.
The most basic technique for computing integrals is based on the fundamental theorem of
calculus. It proceeds as follows:
1. Choose a function f (x) and an interval [a, b].
2. Find an antiderivative of f : a function F such that F 0 = f .
Rb
3. By the fundamental theorem of calculus, a f (x) dx = F (b) − F (a).
4. Therefore the value of the integral is F (b) − F (a).
R b By the Fundamental Theorem of Calculus, the area under the graph of f from a to b is:
a f (x)dx.
5.1
Finding the anti-derivative of a function
The best way to think about finding an anti-derivative is the following. You have a function that
you want to find the anti-derivative of. So what other function, if you took the derivative of that
function, would give you the function you currently have. I.e., what is the F (x) that gives you the
f (x) you currently have.
˙ dF (x) = 2x.
Lets say f (x) = 2x. Then F (x) = x2 + C. To see this just differentiate F (x).
dx
Notice how the C drops because dC
=
0
(C
is
a
constant).
dx
Example 4 f (x) = x2 , F (x) = x2
Here notice how the denominator of the our original function f (x) gives us a sense of what
constant we’ll multiple by x2 . In this case we multiply by 1.
Example 5 f (x) = x3 , F (x) = 16 x2
Example 6
1.
R3
3x2 dx = 3
1
2.
R2
−2
1 3
3x
3
= (3)3 − (1)3 = 26
1
x
x 2
2
−2
ex ee dx = ee −2 = ee − ee = 1617.033
Example 7
1.
R
2.
R
f (x)dx
R
R
[f (x) + g(x)]dx = f (x)dx + g(x)dx
3.
R
xn dx =
4.
R
ex dx = ex + c
5.
R
1
x dx
af (x)dx = a
R
1
n+1
n+1 x
+ c [n 6= −1]
= ln x + c
5
6.
R
ef (x) f 0 (x)dx = ef (x) + c
7.
R
[f (x)]n f 0 (x)dx =
8.
R
f 0 (x)
f (x) dx
1
n+1
n+1 [f (x)]
+ c [n 6= −1]
= ln f (x) + c
Example 8
R
R
1. 3x2 dx = 3 x2 dx = 3 31 x3 + c = x3 + c
R
R
R
2. (2x + 1)dx = 2xdx + 1dx = x2 + x + c
R
x
x
3. ex ee dx = ee + c
5.2
Rules Satisfied by Definite Integrals
1. Order of Integration:
Z
a
Z
b
f (x)dx = −
b
f (x)dx
a
2. Zero Width Interval:
a
Z
f (x) = 0
a
3. Constant Multiple
Z
b
b
Z
kf (x)dx = k
a
Z
f (x)dx
a
b
b
Z
−f (x)dx = −
a
f (x)dx
a
4. Sum and Difference
Z
b
Z
(f (x) ± g(x))dx =
b
Z
f (x)dx ±
a
a
b
g(x)dx
a
5. Additivity
Z
b
Z
f (x)dx +
a
c
Z
f (x)dx =
b
c
f (x)dx
a
Example 9
•
R1
1
3x2 dx = x3 1 = (1)3 − (1)3 = 0
1
•
R4
0
•
4
R4
R4
(2x + 1)dx = 2 xdx + 1dx = x2 0 + x|40 = (16 − 0) + (4 − 0) = 20
0
R1
−1
•
R0
x3
3 dx
=
x
ex ee dx +
−2
•
R
(5x −
0
R2
0
√
x
x 0
x 2
0
−2
2
0
2
−2
ex ee dx = ee −2 + ee 0 = ee − ee + ee − ee = ee − ee = 1617.033
x)
6
5.3
Application
A common distribution in probability theory is the distribution f (x) =
all other points.
1
b−a
for a ≤ x ≤ b and 0 at
We know from probability theory that the area under the curve of a probability distribution must
be equal to 1.
Hence F (x)ba = 1
Rb 1
dx
F (x) = a b−a
R2
For example, let a = 0 and b = 2. Then we have 0 21 dx = 12 x|20 = 1 − 0.
6
Integration by Substitution
R
• Sometimes the integrand (the function under the ) doesn’t appear integrable using common
rules and antiderivatives. A method one might try is integration by substitution, which
is related to the Chain Rule.
R
• Suppose we want to find the indefinite integral g(x)dx and assume we can identify a function
u(x) such that g(x) = f [u(x)]u0 (x). That is, g(x) is a composite function f [u(x)] multiplied
by the derivative of the internal function.
R
2
• (2x + 2)ex +2x+2 dx
• Let’s refer to the antiderivative of f as F . Then the chain rule tells us that
f [u(x)]u0 (x). So, F [u(x)] is the antiderivative of g. We can then write
Z
Z
Z
d
g(x)dx = f [u(x)]u0 (x)dx =
F [u(x)]dx = F [u(x)] + c
dx
d
dx F [u(x)]
=
Theorem 6.1 If u = g(x) is a differentiable function whose range is an interval I and f is
continuous on I, then
Z
Z
0
f (g(x))g (x)dx = f (u)du
• Procedure to determine the indefinite integral
R
g(x)dx by the method of substitions:
1. Identify some part of g(x) that might be simplified by substituting in a single variable
u (which will then be a function of x).
2. Determine if g(x)dx can be reformulated in terms of u and du.
3. Solve the indefinite integral.
4. Substitute back in for x
• Substitution can also be used to calculate a definite integral. Using the same procedure as
above,
Zb
Zd
g(x)dx = f (u)du = F (d) − F (c)
a
c
where c = u(a) and d = u(b).
7
Example 10
R
2
1. (2x+2)ex +2x+2 dx Let u = x2 +2x+2, then we have du
= 2x+2. And thuse du = (2x+2)dx.
R udx
2
Subbing back into our original integral we obtain e du = eu + C = ex +2x+2
R √
2. x2 x + 1dx
√
√
The problem here is the x + 1 term. However, if the integrand had x times some polynomial, then we’d be in business. Let’s try u = x+1. Then x = u−1 and dx = du. Substituting
these into the above equation, we get
Z
Z
√
√
2
x x + 1dx =
(u − 1)2 udu
Z
=
(u2 − 2u + 1)u1/2 du
Z
=
(u5/2 − 2u3/2 + u1/2 )du
We can easily integrate this, since it’s just a polynomial. Doing so and substituting u = x + 1
back in, we get
Z
√
1
2
1
x2 x + 1dx = 2(x + 1)3/2 (x + 1)2 − (x + 1) +
+c
7
5
3
√
3. For the above problem, we could have also used the substitution u = x + 1. Then x = u2 −1
and dx = 2udu. Substituting these in, we get
Z
Z
√
2
x x + 1dx = (u2 − 1)2 u2udu
which when expanded is again a polynomial and gives the same result as above.
4.
R1
0
5e2x
dx
(1+e2x )1/3
When an expression is raised to a power, it’s often helpful to use this expression as the basis
for a substitution. So, let u = 1 + e2x . Then du = 2e2x dx and we can set 5e2x dx = 5du/2.
Additionally, u = 2 when x = 0 and u = 1 + e2 when x = 1. When using u-substitution for
definite integrals you must changed the bounds of integration. Substituting all of this in, we
get
Z1
5e2x
dx =
(1 + e2x )1/3
5
2
0
1+e
Z 2
du
u1/3
2
=
5
2
1+e
Z 2
u−1/3 du
2
2
15 2/3 1+e
=
u 4
2
= 9.53
Example 11
R x2 +1
. let u = x3 + 3x. Then you have
x3 +3x R
in we have 13 u1 du = 31 ln u + C
du
dx
= 3x2 + 3. So we’re off by a constant of 13 . Subbing
8
7
Integration by Parts
• Another useful integration technique is integration by parts, which is related to the Product
Rule of differentiation. The product rule states that
d
dv
du
(uv) = u
+v
dx
dx
dx
Integrating this and rearranging, we get
Z
Z
Z
du
dv
u dx = udv = uv − v dx
dx
dx
or
Z
Z
u(x)v 0 (x)dx = u(x)v(x) − v(x)u0 (x)dx
Often times this is written as:
Z
Z
udv = uv −
vdu
where du = u0 (x)dx and dv = v 0 (x)dx.
• For definite integrals:
Rb
a
dv
dx = uv|ba −
u dx
Rb
a
v du
dx dx
• Our goal here is to find expressions for
R u and dv that produce values of du and v that, when
combined, produce a ’nicer’ integral vdu. Notice that we are using a trick that we learned
before: let some new variable equal some more complicated expression.
• Sometimes its handy to make the following table:
u=
du =
v=
dv =
• Examples:
R
1. xeax dx
d
d
Let u = x and dv = eax dx. Then du = dx [Why? dx
u = dx
x, then du
dx = 1, so du = dx ]
ax
and v = (1/a)e . Substituting this into the integration by parts formula, we obtain
Z
Z
xeax dx = uv − vdu
Z
1 ax
1 ax
= x
e
−
e dx
a
a
1 ax
1
=
xe − 2 eax + c
a
a
R n ax
2. x e dx
As in the first problem, let’s let u = xn and dv = eax dx. Then du = nxn−1 dx and
v = (1/a)eax . Substituting these into the integration by parts formula gives
Z
Z
n ax
x e dx = uv − vdu
Z
1 ax n−1
n 1 ax
= x
e
−
e nx
dx
a
a
Z
1 n ax n
=
x e −
xn−1 eax dx
a
a
9
Notice that we now have an integral similar to the previous one, but with xn−1 instead
of xn . For a given n, we would repeat the integration by parts procedure
until the
R
integrand was directly integrable — e.g., when the integral became eax dx.
We would need to do this n times in this case....it pays to be neat when writing out
math....
R
2
3. x3 e−x dx
2
We could, as before, choose u = x3 and dv = e−x dx. But we can’t then find v — i.e.,
2
2
2
integrating e−x dx isn’t possible. Instead, notice that d(e−x )/dx = −2xe−x , which
can be factored out of the original integrand
Z
Z
2
2
x3 e−x dx = x2 (xe−x )dx
2
2
We can then let u = x2 and dv = xe−x dx. Then du = 2xdx and v = − 21 e−x .
Substituting these in, we have
Z
Z
3 −x2
x e dx = uv − vdu
Z 1 −x2
1 −x2
2
−
− e
2xdx
= x − e
2
2
Z
1
2
2
= − x2 e−x + xe−x dx
2
1
1
2
2
= − x2 e−x − e−x + c
2
2
8
Other integration tricks and limitations
8.1
Summary
8.2
Leibniz’s Rule
Theorem 8.1 If f is continuous on [a, b] and if u(x) and v(x) are differentiable functions of x
whose values lie in [a, b], then
Z v(x)
d
dv
du
f (t)dt = f (v(x))
− f (u(x))
dx u(x)
dx
dx
8.3
Trigonometric identities
Sometimes are functions will be in a form that corresponds to certain trigonometric properties.
Look at the summary above for some of the important identities.
8.4
Direct integration not always possible
Sometimes a function does not permit direct integration. For example, consider the equation for
the (standard) normal distribution frequently used in probability and statistics.
1 2
1
f (x) = √ e− 2 x
2π
What is the key difference between this function and our last example? Sometimes less in a
function means its harder, because you can’t cancel things out.
10
Instead of direct integration we use numerical
Though there is a clever way to
√
R −approximations.
1 2
x
2
use some trigometric properties to show that e
dx = 2π
9
Taylor Series
Sometimes nonlinear functions can be very complicated. However, in many cases, we care about
what goes on around certain points, and do not really care about characterizing every aspect of
the function. One practical way of doing this is to approximate the nonlinear function with a
polynomial function, which is much easier to analyze. This is what the Taylor Series does. It fits a
linear function, or quadratic or whatever order polynomial, each closer and closer to the function
we are interested in. In economics, we usually rely on first or second order order Taylor Series
approximations.
First Order Taylor Series Expansion around x0 :
f (x0 + h) ≈ f (x0 ) + hf 0 (x0 )
This is basically the formula for the tangent of f (x) at x0 . It is also, as we saw previously, the best
linear approximation to f (x) at x0 .
See S&B Figure 2.15 (page 37).
11
Similarly, the best quadratic approximation to f (x) at x0 is the Second Order Taylor Series
Expansion around x0 :
h2
f (x0 + h) ≈ f (x0 ) + hf 0 (x0 ) + f 00 (x0 )
2
The approximation is a quadratic function of h, that is, of the form: ah2 + bh + c.
The smaller h is, the better the approximation. The second order, of course is a better approximation than the first order.
Example 12
Let f (x) = e(2x−1)
Suppose we know that that f (1) = 2.718. But we want to know what f (1.1) is. In this case h = 0.1.
We need to calculate f 0(2x−1) = 2e
We use the Taylor Series Expansion around x = 1 to approximate what f (1.1) is:
f (x0 + h) = f (1.1) = e1.2 ≈ f (x0 ) + hf 0 (x0 ) = e + 0.1(2e) = 3.261
Note that since the function is convex, the approximation is an underestimation of f (x).
in fact, f (1.1) = 3.32012, so the difference is 0.058
Now let’s calculate what the second order Taylor approximation is: We know that f 00(2x−1) = 4e
when x = 1
f (x0 + h) = f (1.1) = e1.2 ≈ f (x0 ) + hf 0 (x0 ) +
h2 00
0.12
f (x0 ) = e + 0.1(2e) +
4e = 3.3163
2
2
in fact, f (1.1) = 3.32012 so the difference is 0.003, a good approximation indeed!
12