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 2 of 5

ConceptLesson 2.5.2 in Level 2, Single-variable calculus. About 25 minutes.

Antiderivatives

Running differentiation backwards

Differentiation takes a function and gives its slope. An antiderivative goes the other way: given a function ff, find a function FF whose slope is ff. In symbols, F′(x)=f(x)F'(x) = f(x).

If ff is a speed in km per hour, an antiderivative is a position in km, since the slope of position is speed. Lesson 2.5.3 uses that link to find areas.

Guess, check, adjust

To find an antiderivative of x2x^2, guess x3x^3: differentiating lowers a power by one, so the answer must have power 3. Then differentiate the guess and compare.

guess F(x)F(x)F′(x)F'(x)compared with x2x^2
x3x^33x23x^23 times too big
x33\frac{x^3}{3}x2x^2right

Rule: Antiderivative

F′(x)=f(x)F'(x) = f(x)

FF is an antiderivative of ff when the derivative of FF is ff. To check an answer, differentiate it: you must get back exactly the function you started with.

The + C: a family of antiderivatives

x33\frac{x^3}{3} is not the only antiderivative of x2x^2. So are x33+5\frac{x^3}{3} + 5 and x33−2\frac{x^3}{3} - 2, because an added constant vanishes when you differentiate (lesson 2.3.1).

On an interval, these are all of them: two functions with the same derivative differ by a constant. The indefinite integral collects the whole family under one symbol.

Rule: Indefinite integral

∫f(x) dx=F(x)+Cwhere F′=f\begin{gathered} \int f(x)\,dx = F(x) + C \\ \text{where } F' = f \end{gathered}

CC stands for any constant. So ∫x2 dx=x33+C\int x^2\,dx = \frac{x^3}{3} + C. Without limits, the integral is a family of functions, not a number like the definite integral of lesson 2.5.1.

On a graph, the family is one curve copied up and down. At any xx the copies have the same slope, so their tangent lines there are parallel.

The antiderivatives of 2x2x: the curves y=x2+Cy = x^2 + C. At x=1x = 1 all four have slope 2. Only the one with C=2C = 2 passes through (1,3)(1, 3).

One value picks one curve

A single known value of FF fixes CC. Say F′(x)=2xF'(x) = 2x and F(1)=3F(1) = 3. Then F(x)=x2+CF(x) = x^2 + C, and putting in x=1x = 1 gives 1+C=31 + C = 3, so C=2C = 2 and F(x)=x2+2F(x) = x^2 + 2.

If FF is a position and F′F' its speed, the speed alone cannot tell you where the car started. One known position settles it.

Powers

Read the power rule of lesson 2.3.1 backwards. Differentiating lowers a power by one and multiplies by the old power; undoing it raises the power by one and divides by the new power.

Rule: Power rule, backwards

∫xn dx=xn+1n+1+C(n≠−1)\int x^n\,dx = \frac{x^{n+1}}{n + 1} + C \quad (n \neq -1)

Raise the power by one, then divide by the new power. Differentiating undoes both steps: the new power comes down in front and cancels the division.

Write roots and reciprocals as powers first (lesson 1.4.1). Each line of the table leaves out the +C+ C.

f(x)f(x)as a powerantiderivative
x3x^3x3x^3x44\frac{x^4}{4}
11x0x^0xx
x\sqrt{x}x1/2x^{1/2}23x3/2\frac{2}{3}x^{3/2}
1x2\frac{1}{x^2}x−2x^{-2}−x−1=−1x-x^{-1} = -\frac{1}{x}
1x\frac{1}{\sqrt{x}}x−1/2x^{-1/2}2x1/2=2x2x^{1/2} = 2\sqrt{x}

Check the fourth line by differentiating: ddx(−x−1)=(−1)(−1) x−2=x−2\frac{d}{dx}\left(-x^{-1}\right) = (-1)(-1)\,x^{-2} = x^{-2}. An antiderivative keeps the gaps in its domain. 1x2\frac{1}{x^2} and −1x-\frac{1}{x} have no value at 0, so the answer holds for x>0x > 0 and for x<0x < 0 separately.

Constant multiples and sums

Rule: Multiples and sums

∫c f dx=c∫f dx∫(f+g) dx=∫f dx+∫g dx\begin{gathered} \int c\,f\,dx = c\int f\,dx \\[4pt] \int (f + g)\,dx = \int f\,dx + \int g\,dx \end{gathered}

A constant multiplier comes out in front, and a sum splits into two integrals, exactly as for derivatives. So a polynomial is integrated term by term, with a single +C+ C at the end.

So ∫(6x2−4x+5) dx=2x3−2x2+5x+C\int (6x^2 - 4x + 5)\,dx = 2x^3 - 2x^2 + 5x + C. Differentiating gives back 6x2−4x+56x^2 - 4x + 5.

There is no product rule backwards. ∫x⋅x dx=x33\int x \cdot x\,dx = \frac{x^3}{3}, but multiplying the separate antiderivatives gives x22⋅x22=x44\frac{x^2}{2} \cdot \frac{x^2}{2} = \frac{x^4}{4}, which is wrong. Multiply out first when you can.

For example, ∫(x+1)2 dx=∫(x2+2x+1) dx=x33+x2+x+C\int (x + 1)^2\,dx = \int (x^2 + 2x + 1)\,dx = \frac{x^3}{3} + x^2 + x + C. The chain rule (lesson 2.3.3) shows that (x+1)33\frac{(x + 1)^3}{3} works too. Multiplied out, it is x33+x2+x+13\frac{x^3}{3} + x^2 + x + \frac{1}{3}: the two answers differ by a constant, which the +C+ C absorbs.

Try it

sp.integrate(f, x) gives one antiderivative, without the +C+ C. The cell finds one for each example above, then differentiates it back.

A check of 0 means F′−f=0F' - f = 0, so F′=fF' = f. SymPy writes x−2x^{-2} as x**(-2).

⌘/Ctrl + Enter runs the cell

The exception: 1x\frac{1}{x}

For n=−1n = -1 the power rule would give x00\frac{x^0}{0}, a division by zero. The antiderivative of 1x\frac{1}{x} is a logarithm instead.

Lesson 2.3.4 showed that ln⁡x\ln x has slope 1x\frac{1}{x} for x>0x > 0. It also showed that ln⁡∣x∣\ln|x|, the same curve mirrored in the yy-axis, has slope 1x\frac{1}{x} for x<0x < 0 too. Read backwards, that is the antiderivative on both sides.

Rule: Integral of 1/x

∫1x dx=ln⁡∣x∣+C(x≠0)\int \frac{1}{x}\,dx = \ln|x| + C \quad (x \neq 0)

The absolute value lets one formula cover both sides of 0. Each side is its own family, because 1x\frac{1}{x} has no value at 0.

For example, at x=−2x = -2 the slope of ln⁡∣x∣\ln|x| is −0.5-0.5, which is 1−2\frac{1}{-2}. Constants come out as usual: ∫3x dx=3ln⁡∣x∣+C\int \frac{3}{x}\,dx = 3\ln|x| + C.

Exponentials

exe^x is its own derivative, so it is its own antiderivative. For ekxe^{kx}, differentiating brings out a factor kk (lesson 2.3.4), so the antiderivative divides by kk.

Rule: Exponentials

∫ex dx=ex+C∫ekx dx=ekxk+C(k≠0)\begin{gathered} \int e^{x}\,dx = e^{x} + C \\[4pt] \int e^{kx}\,dx = \frac{e^{kx}}{k} + C \quad (k \neq 0) \end{gathered}

Check by differentiating: 1k⋅k ekx=ekx\frac{1}{k} \cdot k\,e^{kx} = e^{kx}. With a negative kk the antiderivative has a minus sign.

So ∫e3x dx=e3x3+C\int e^{3x}\,dx = \frac{e^{3x}}{3} + C. And ∫e−x/2 dx=−2e−x/2+C\int e^{-x/2}\,dx = -2e^{-x/2} + C, because dividing by k=−12k = -\frac{1}{2} multiplies by −2-2. Case study 2.5.5 integrates a discount factor e−rte^{-rt} in exactly this way.

Other bases follow from ddxbx=bxln⁡b\frac{d}{dx}b^x = b^x \ln b (lesson 2.3.4): ∫bx dx=bxln⁡b+C\int b^x\,dx = \frac{b^x}{\ln b} + C. So ∫2x dx=2xln⁡2+C\int 2^x\,dx = \frac{2^x}{\ln 2} + C. Lesson 2.6.1 extends the trick for ekxe^{kx} into a general method, substitution.

Try it

SymPy integrates the log and exponential examples, then differentiates each answer back. A check of 0 means the answer is right.

SymPy writes ln⁡\ln as log and gives log(x) for 1x\frac{1}{x}: it leaves out the absolute value and answers only for x>0x > 0.

⌘/Ctrl + Enter runs the cell

Sine and cosine

Lesson 2.3.5 showed that sin⁡x\sin x has slope cos⁡x\cos x, and cos⁡x\cos x has slope −sin⁡x-\sin x. Read backwards, sin⁡x\sin x is an antiderivative of cos⁡x\cos x, and −cos⁡x-\cos x is an antiderivative of sin⁡x\sin x.

Rule: Sine and cosine

∫cos⁡x dx=sin⁡x+C∫sin⁡x dx=−cos⁡x+C\begin{gathered} \int \cos x\,dx = \sin x + C \\[4pt] \int \sin x\,dx = -\cos x + C \end{gathered}

With xx in radians. Check by differentiating: the slope of −cos⁡x-\cos x is −(−sin⁡x)=sin⁡x-(-\sin x) = \sin x.

The minus sign goes with the sine. cos⁡x\cos x is an antiderivative of −sin⁡x-\sin x, not of sin⁡x\sin x.

With a factor inside, divide by it, as for ekxe^{kx}: ∫cos⁡(3x) dx=sin⁡(3x)3+C\int \cos(3x)\,dx = \frac{\sin(3x)}{3} + C. Lesson 2.5.3 turns antiderivatives into exact areas. For sin⁡x\sin x on [0,π][0, \pi] that gives −cos⁡π+cos⁡0=2-\cos\pi + \cos 0 = 2, the area of the hump that lesson 2.5.1 estimated.

Try it

SymPy integrates cos⁡x\cos x, sin⁡x\sin x and cos⁡(3x)\cos(3x), then differentiates each answer back. A check of 0 means the answer is right.

The last line evaluates −cos⁡x-\cos x at π\pi and at 0 and subtracts: the area under one hump.

⌘/Ctrl + Enter runs the cell

When there is no formula

Every function made of powers, exponentials and logs can be differentiated by rules. Antiderivatives are harder: some exist but cannot be written with those functions at all.

e−x2e^{-x^2} is the standard example. It has antiderivatives (lesson 2.5.3 builds one from areas), but no combination of powers, roots, exponentials and logs has derivative e−x2e^{-x^2}. SymPy answers with a new function, erf, which is itself defined by an integral of e−x2e^{-x^2}.

Lesson 2.6.3 meets its close relative e−x2/2e^{-x^2/2}, the bell curve, whose areas are found numerically. Other integrands need a method rather than a rule: substitution (lesson 2.6.1) and integration by parts (lesson 2.6.2).

Try it

SymPy's answer for e−x2e^{-x^2} uses erf. Differentiating it gives back e−x2e^{-x^2}, so it is an antiderivative; it just has no formula in familiar functions.

⌘/Ctrl + Enter runs the cell

Common mistakes

  1. Divide by the new power. ∫x3 dx=x44\int x^3\,dx = \frac{x^4}{4}, not x43\frac{x^4}{3}, and not 3x23x^2, which is the derivative.
  2. Keep the +C+ C. An indefinite integral is a whole family. When a value of FF is given, use it to find CC.
  3. n=−1n = -1 is the exception. ∫1x dx=ln⁡∣x∣+C\int \frac{1}{x}\,dx = \ln|x| + C, not x00\frac{x^0}{0}.
  4. 1x2\frac{1}{x^2} is not a log case. It is x−2x^{-2}, so the power rule gives −1x-\frac{1}{x}.
  5. Divide by kk, do not multiply. ∫e3x dx=e3x3+C\int e^{3x}\,dx = \frac{e^{3x}}{3} + C, not 3e3x3e^{3x}.
  6. There is no product rule backwards. ∫x⋅x dx\int x \cdot x\,dx is x33\frac{x^3}{3}, not x22⋅x22\frac{x^2}{2} \cdot \frac{x^2}{2}.
  7. Mind the sign with sine. ∫sin⁡x dx=−cos⁡x+C\int \sin x\,dx = -\cos x + C, not cos⁡x+C\cos x + C.
  8. Two answers can both be right. x33+x2+x\frac{x^3}{3} + x^2 + x and (x+1)33\frac{(x + 1)^3}{3} differ by a constant, so both are antiderivatives of (x+1)2(x + 1)^2.

Antiderivatives

0 of 13 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.
  13. 13.
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

  • FF is an antiderivative of ff when F′=fF' = f; check any answer by differentiating it.
  • ∫f(x) dx=F(x)+C\int f(x)\,dx = F(x) + C: all antiderivatives differ by a constant. One known value of FF fixes CC.
  • ∫xn dx=xn+1n+1+C\int x^n\,dx = \frac{x^{n+1}}{n + 1} + C for n≠−1n \neq -1, with roots and reciprocals written as powers first.
  • ∫1x dx=ln⁡∣x∣+C\int \frac{1}{x}\,dx = \ln|x| + C, on each side of 0.
  • ∫ekx dx=ekxk+C\int e^{kx}\,dx = \frac{e^{kx}}{k} + C, and ∫bx dx=bxln⁡b+C\int b^x\,dx = \frac{b^x}{\ln b} + C.
  • ∫cos⁡x dx=sin⁡x+C\int \cos x\,dx = \sin x + C and ∫sin⁡x dx=−cos⁡x+C\int \sin x\,dx = -\cos x + C, in radians.
  • Constants come out and sums split; products do not. Some functions, like e−x2e^{-x^2}, have no antiderivative formula.

Free further reading

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