SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 2.5.1 Area and Riemann sumsConcept · 30 min
      2. 2.5.2 AntiderivativesConcept · 25 min
      3. 2.5.3 The fundamental theorem of calculusConcept · 30 min
      4. 2.5.4 Practice set: integrationPractice set · 25 min
      5. 2.5.5 Case study: present value of a continuous cash flowCase study · 35 min

Level 2, Single-variable calculus 2.5 Integration Lesson 3 of 5

ConceptLesson 2.5.3 in Level 2, Single-variable calculus. About 30 minutes.

The fundamental theorem of calculus

The area function

Fix a starting point aa and let the right edge move. The area under ff from aa up to xx is then a function of xx: the area function.

Rule: Area function

A(x)=∫axf(t) dtA(x) = \int_a^x f(t)\,dt

The signed area under ff from aa to xx. Inside the integral the letter tt runs along the axis, so that xx can name the right edge. At the start there is no width yet, so A(a)=0A(a) = 0.

Take f(t)=2tf(t) = 2t from 0. The region up to xx is a triangle with base xx and height 2x2x, so A(x)=12×x×2x=x2A(x) = \frac{1}{2} \times x \times 2x = x^2.

right edge xx123
height f(x)=2xf(x) = 2x246
area A(x)=x2A(x) = x^2149

Now differentiate: the slope of A(x)=x2A(x) = x^2 is 2x2x, the function we started from. The area function is an antiderivative of ff. A constant height gives the same pattern: under f(t)=3f(t) = 3, A(x)=3xA(x) = 3x, whose slope is 3.

Why the slope of the area is the height

Push the right edge from xx to x+hx + h. The area grows by a thin strip of width hh under the curve. Its height is almost f(x)f(x), so the extra area is about f(x)×hf(x) \times h.

So the growth rate A(x+h)−A(x)h\frac{A(x + h) - A(x)}{h} is about f(x)f(x), and it gets closer as hh shrinks. In the limit (lesson 2.2.1) the slope of AA at xx is exactly f(x)f(x).

Rule: Slope of the area function

ddx∫axf(t) dt=f(x)\frac{d}{dx}\int_a^x f(t)\,dt = f(x)

The area grows fastest where the curve is tallest. It stops growing where f(x)=0f(x) = 0, and it shrinks where f(x)<0f(x) < 0, since area below the axis counts as negative. This holds for every continuous ff; the Proof Gym has the proof.

The area under f(t)=4−t2f(t) = 4 - t^2 from 0 up to xx, and the graph of that area. At x=1x = 1 the area grows at rate f(1)=3f(1) = 3; it peaks at x=2x = 2, where ff crosses zero, and falls once ff is negative.

Numbers show the same thing for f(t)=4−t2f(t) = 4 - t^2 at x=1x = 1, where the height is f(1)=3f(1) = 3. Each strip ratio below comes from Riemann sums, with no formula for AA.

strip width hh0.10.010.001
A(1+h)−A(1)h\frac{A(1 + h) - A(1)}{h}2.8966672.9899672.999

Try it

area(x) is a midpoint sum (lesson 2.5.1) of 4−t24 - t^2 from 0 to xx, with 10,000 strips. The loop prints the strip ratios of the table, which close in on f(1)=3f(1) = 3.

⌘/Ctrl + Enter runs the cell

Drag the right edge yourself. Watch the area function's tangent: its slope matches the height of the curve at every xx, and it turns flat at x=2x = 2, where 4−t24 - t^2 crosses zero. Then try 1t\frac{1}{t}, whose area function from 1 is ln⁡x\ln x (lesson 2.5.2).

Explore

Drag the right edge x. The upper graph shades the area under the curve from 0 to x; the lower graph plots that area for every x. Its slope at x is always the height f(x).

0123−50

The area function A(x) = 4x − x³/3, with its tangent at x

01230246
Area from 0 to x
A(1) = 3.6667
Height there
f(1) = 3
Next strip ÷ its width
(A(1.1) − A(1)) ÷ 0.1 = 2.8967, close to the height
So the area is
growing, at rate f(x)

The fundamental theorem

To find ∫abf(x) dx\int_a^b f(x)\,dx, find any antiderivative FF and subtract its value at aa from its value at bb.

Here is why. The area function AA is an antiderivative of ff, and any other antiderivative FF differs from it by a constant (lesson 2.5.2), so A(x)=F(x)+CA(x) = F(x) + C. At x=ax = a the area is 0, which forces C=−F(a)C = -F(a), so A(b)=F(b)−F(a)A(b) = F(b) - F(a).

Rule: Fundamental theorem of calculus

∫abf(x) dx=F(b)−F(a)where F′=f\begin{gathered} \int_a^b f(x)\,dx = F(b) - F(a) \\ \text{where } F' = f \end{gathered}

For ff continuous on [a,b][a, b]. Any antiderivative works: a +C+ C would appear in both terms and cancel. The bracket [F(x)]ab\big[F(x)\big]_a^b is shorthand for F(b)−F(a)F(b) - F(a).

Four examples

  • ∫01x2 dx=[x33]01=13−0=13\int_0^1 x^2\,dx = \left[\frac{x^3}{3}\right]_0^1 = \frac{1}{3} - 0 = \frac{1}{3}. That is the number the Riemann sums of lesson 2.5.1 approached: 0.21875, 0.328125 and 0.46875 with 4 strips, and a midpoint sum of 0.333333 with 10,000.
  • ∫121x dx=[ln⁡x]12=ln⁡2−ln⁡1=ln⁡2≈0.693147\int_1^2 \frac{1}{x}\,dx = \big[\ln x\big]_1^2 = \ln 2 - \ln 1 = \ln 2 \approx 0.693147. It lies between that lesson's left and right sums with 4 strips, 0.759524 and 0.634524.
  • ∫01ex dx=[ex]01=e−e0=e−1≈1.718282\int_0^1 e^x\,dx = \big[e^x\big]_0^1 = e - e^0 = e - 1 \approx 1.718282. The lower limit gives e0=1e^0 = 1, not 0.
  • ∫12(3x2+2x) dx=[x3+x2]12=(8+4)−(1+1)=10\int_1^2 (3x^2 + 2x)\,dx = \big[x^3 + x^2\big]_1^2 = (8 + 4) - (1 + 1) = 10.

The theorem also explains the table above. For 4−t24 - t^2 it gives A(x)=4x−x33A(x) = 4x - \frac{x^3}{3}, and then the strip ratio is exactly 3−h−h233 - h - \frac{h^2}{3}: 2.896667 for h=0.1h = 0.1.

Where it breaks

The theorem needs ff continuous on the whole interval. 1x2\frac{1}{x^2} is positive everywhere, yet the formula would give ∫−111x2 dx=[−1x]−11=−1−1=−2\int_{-1}^{1} \frac{1}{x^2}\,dx = \left[-\frac{1}{x}\right]_{-1}^{1} = -1 - 1 = -2.

That is impossible for a curve above the axis. The trouble is at 0, where 1x2\frac{1}{x^2} has no value and blows up. Its midpoint sums grow without limit (47 with 10 strips, 491 with 100, 4,933 with 1,000), and lesson 2.6.3 deals with such integrals.

Try it

sp.integrate(f, (x, a, b)) gives a definite integral exactly. SciPy's quad(f, a, b) finds it numerically, sometimes off in the last digit, and returns an estimate of its own error too; [0] keeps the value.

SymPy writes ln⁡2\ln 2 as log(2) and e−1e - 1 as -1 + E. The last line asks for the broken integral of 1x2\frac{1}{x^2}: SymPy answers oo, infinity, rather than −2-2.

⌘/Ctrl + Enter runs the cell

Net and total area

F(b)−F(a)F(b) - F(a) is the net area: parts below the axis count as negative (lesson 2.5.1). For the total area, split the interval where ff crosses zero and add the pieces as positive numbers.

Take f(x)=4−x2f(x) = 4 - x^2 on [0,3][0, 3], the curve of the figure. With F(x)=4x−x33F(x) = 4x - \frac{x^3}{3}, the net area is F(3)−F(0)=12−9=3F(3) - F(0) = 12 - 9 = 3.

For the total, split at x=2x = 2, where ff crosses zero. The piece above the axis is F(2)−F(0)=163≈5.333F(2) - F(0) = \frac{16}{3} \approx 5.333, and the piece below is F(3)−F(2)=−73≈−2.333F(3) - F(2) = -\frac{7}{3} \approx -2.333. So the total area is 163+73=233≈7.667\frac{16}{3} + \frac{7}{3} = \frac{23}{3} \approx 7.667.

These are values of the area function in the figure. A(2)=163A(2) = \frac{16}{3} is its peak, and A(3)=3A(3) = 3 is lower because the last piece counts as negative.

Reversed and equal limits

The formula F(b)−F(a)F(b) - F(a) works for any two limits, in either order. That gives three rules.

Rule: Limits in any order

∫aaf dx=0∫baf dx=−∫abf dx∫abf dx+∫bcf dx=∫acf dx\begin{gathered} \int_a^a f\,dx = 0 \\[4pt] \int_b^a f\,dx = -\int_a^b f\,dx \\[4pt] \int_a^b f\,dx + \int_b^c f\,dx = \int_a^c f\,dx \end{gathered}

Equal limits give no width and no area. Swapping the limits flips the sign: in a Riemann sum, going from right to left makes Δx\Delta x negative. Areas side by side add.

So ∫20x2 dx=−83\int_2^0 x^2\,dx = -\frac{8}{3}, and ∫55ex2 dx=0\int_5^5 e^{x^2}\,dx = 0, even though ex2e^{x^2} has no antiderivative formula. Splitting [0,2][0, 2] at 1 gives ∫01x2 dx+∫12x2 dx=13+73=83\int_0^1 x^2\,dx + \int_1^2 x^2\,dx = \frac{1}{3} + \frac{7}{3} = \frac{8}{3}, the whole of ∫02x2 dx\int_0^2 x^2\,dx.

Try it

The first line splits 4−x24 - x^2 at its zero: the two pieces, then the net area. quad of the absolute value gives the total area, 233\frac{23}{3}.

Then the reversed and equal limits. quad accepts limits in either order; round hides float noise in the last digit.

⌘/Ctrl + Enter runs the cell

The integral of a rate is a total change

If F′=fF' = f, then ff is the rate at which FF changes. Integrating the rate over [a,b][a, b] gives the total change in FF.

Rule: Total change

∫abF′(t) dt=F(b)−F(a)\int_a^b F'(t)\,dt = F(b) - F(a)

The units are the rate's units times the input's units. A rate in cm per year, integrated over years, gives cm.

A tree trunk widens at 2e−0.1t2e^{-0.1t} cm per year, tt years after planting. Over the first 10 years it widens by

∫0102e−0.1t dt=[−20e−0.1t]010=20(1−e−1)≈12.64 cm\begin{aligned} \int_0^{10} 2e^{-0.1t}\,dt &= \left[-20e^{-0.1t}\right]_0^{10} \\ &= 20\left(1 - e^{-1}\right) \approx 12.64 \text{ cm} \end{aligned}

The antiderivative divides by k=−0.1k = -0.1, as in lesson 2.5.2. The rate and the time must use the same unit: ten years is t=10t = 10, not 120 months.

A velocity can be negative, and then the net and total areas mean different things. At 4−t24 - t^2 metres per second for 3 seconds, an object ends 3 m from where it started. It went forward 163\frac{16}{3} m, then back 73\frac{7}{3} m, so it travelled 233≈7.67\frac{23}{3} \approx 7.67 m in all.

Case study 2.5.5 integrates a cash-flow rate in dollars per year. Lesson 2.6.1 adds substitution, which finds many more antiderivatives.

Try it

The closed form and quad agree on the tree: 12.64 cm.

For the velocity, the net change in position is the integral of vv, and the distance travelled is the integral of ∣v∣|v|.

⌘/Ctrl + Enter runs the cell

Common mistakes

  1. Upper limit first. The answer is F(b)−F(a)F(b) - F(a), not F(a)−F(b)F(a) - F(b).
  2. The lower limit counts too. F(a)F(a) need not be 0: ∫01ex dx=e−1\int_0^1 e^x\,dx = e - 1, not ee.
  3. Net area is not total area. For the total, split where ff crosses zero and add the pieces as positive numbers.
  4. Swapping the limits flips the sign. ∫20x2 dx=−83\int_2^0 x^2\,dx = -\frac{8}{3}.
  5. The curve must be continuous on the whole interval. ∫−111x2 dx\int_{-1}^{1} \frac{1}{x^2}\,dx is not −2-2.
  6. Match the units. A rate per year needs the time in years.

The fundamental theorem

0 of 12 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
  11. 11.
  12. 12.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • The area function A(x)=∫axf(t) dtA(x) = \int_a^x f(t)\,dt has slope f(x)f(x): the area grows at the rate of the curve's height.
  • Fundamental theorem: ∫abf(x) dx=F(b)−F(a)\int_a^b f(x)\,dx = F(b) - F(a) for any antiderivative FF of a continuous ff.
  • The theorem gives net area. For total area, split where ff crosses zero and add the pieces as positive numbers.
  • ∫aaf dx=0\int_a^a f\,dx = 0, ∫baf dx=−∫abf dx\int_b^a f\,dx = -\int_a^b f\,dx, and integrals over intervals side by side add.
  • The integral of a rate is the total change, in the rate's units times the input's units.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.