SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 2.3.1 Power, constant and sum rulesConcept · 25 min
      2. 2.3.2 Product and quotient rulesConcept · 25 min
      3. 2.3.3 The chain ruleConcept · 30 min
      4. 2.3.4 Derivatives of exponentials and logarithmsConcept · 30 min
      5. 2.3.5 Derivatives of sine and cosineConcept · 35 min
      6. 2.3.6 Practice set: differentiationPractice set · 25 min
      7. 2.3.7 Case study: modified duration and elasticityCase study · 30 min

Level 2, Single-variable calculus 2.3 Differentiation rules Lesson 1 of 7

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

Power, constant and sum rules

From limits to rules

Lesson 2.2.2 found derivatives from the limit: write the chord slope, simplify until hh cancels, then let h→0h \to 0. That works for any function, but it is slow, and it gets harder with every new function. This lesson and the next three give rules that produce a derivative in one line.

ddx\frac{d}{dx} in front of an expression means "the derivative of this with respect to xx". So ddxx2=2x\frac{d}{dx}x^2 = 2x says the same as "if f(x)=x2f(x) = x^2, then f′(x)=2xf'(x) = 2x". The units are output units per input unit, as in lesson 2.2.2.

The power rule

Lesson 2.2.2 worked out four derivatives from the limit and noticed a pattern. Written with every power showing:

f(x)f(x)x2x^2x3x^3x−1x^{-1}x1/2x^{1/2}
f′(x)f'(x)2x12x^{1}3x23x^{2}−1x−2-1x^{-2}12x−1/2\frac{1}{2}x^{-1/2}

Each time, the power comes down in front as a multiplier, and the power drops by one. The pattern holds for every power.

Rule: Power rule

ddx xn=n xn−1\frac{d}{dx}\,x^n = n\,x^{n-1}

Bring the power down in front, then lower it by one. This holds for every real power nn (whole numbers, negatives and fractions) wherever xnx^n is defined. So ddxx5=5x4\frac{d}{dx}x^5 = 5x^4.

A check by numbers: x4x^4 at 2

The rule says the slope of x4x^4 is 4x34x^3, so at x=2x = 2 it is 4×23=324 \times 2^3 = 32. The central difference from lesson 2.2.2 agrees.

gap hh0.10.010.001
central difference32.0832.000832.000008

Algebra explains the pattern. Expanding both powers, the central difference of x4x^4 at 2 is exactly 32+8h232 + 8h^2, which tends to 32 as h→0h \to 0. The limit of lesson 2.2.2 would need (x+h)4(x + h)^4 expanded; the rule needs one line.

Powers of every kind

  • Whole powers, including 1 and 0. x1x^1 has slope 1⋅x0=11 \cdot x^0 = 1: the line y=xy = x has slope 1. x0=1x^0 = 1 has slope 0⋅x−1=00 \cdot x^{-1} = 0: a flat line.
  • Negative powers. Write 1x2\frac{1}{x^2} as x−2x^{-2}. Its derivative is −2x−3=−2x3-2x^{-3} = -\frac{2}{x^3}. The power goes from −2-2 down to −3-3, further from zero.
  • Fractional powers. The cube root x3=x1/3\sqrt[3]{x} = x^{1/3} has derivative 13x−2/3=13x2/3\frac{1}{3}x^{-2/3} = \frac{1}{3x^{2/3}}, which is 112\frac{1}{12} at x=8x = 8. Likewise xx=x3/2x\sqrt{x} = x^{3/2} has derivative 32x1/2=32x\frac{3}{2}x^{1/2} = \frac{3}{2}\sqrt{x}.

So before using the rule, write every root and reciprocal as a power, using lesson 1.4.1.

Negative inputs

The slope formula works on both sides of 0, and the new power n−1n - 1 decides the sign there. For x3x^3 the slope 3x23x^2 has an even power, so it is positive on both sides. At −2-2 it is 12: x3x^3 rises there too.

For x4x^4 the slope 4x34x^3 has an odd power, so it changes sign at 0: it is −4-4 at x=−1x = -1 and 4 at x=1x = 1. The curve falls on the left of 0 and rises on the right.

Try it

The loop prints the central difference of x4x^4 at 2 for three gaps. Then sp.diff applies the power rule to each example above.

SymPy writes x−2x^{-2} as x**(-2), the cube root as x**(1/3) and xxx\sqrt{x} as x**(3/2).

⌘/Ctrl + Enter runs the cell

Where the power rule breaks

The slope formula nxn−1nx^{n-1} shows where a power has no slope. When n−1n - 1 is negative, xx ends up on the bottom of a fraction, and the formula fails at 0.

  • Negative powers at 0. 1x\frac{1}{x} and 1x2\frac{1}{x^2} have no value at x=0x = 0, so they have no slope there.
  • Powers between 0 and 1, at 0. 0=0\sqrt{0} = 0, but the slope 12x\frac{1}{2\sqrt{x}} has 0 on the bottom. Near 0 it grows without limit: 0.5 at x=1x = 1, 5 at x=0.01x = 0.01, 50 at x=0.0001x = 0.0001. The cube root's slope 13x2/3\frac{1}{3x^{2/3}} grows the same way, to about 33.33 at x=0.001x = 0.001.

The domain matters too. x\sqrt{x} has no real value for x<0x < 0 (lesson 1.4.1), so there is nothing to differentiate there.

A slope that grows without limit is the vertical tangent of lesson 2.2.2. The power rule predicts it from the formula, without computing any chords.

The tangents to y=xy = \sqrt{x} at 4, 1 and 0.25 have slopes 0.25, 0.5 and 1. Each time xx is four times smaller, the slope doubles. At 0 the tangent is vertical, and a vertical line has no slope.

When n≥1n \ge 1, as for x2x^2 or x3x^3, the slope formula has no xx on the bottom, and nothing breaks at 0.

Try it

The slope of x\sqrt{x} is 12x\frac{1}{2\sqrt{x}}. The cell evaluates it closer and closer to 0.

Each step makes xx a hundred times smaller and the slope ten times larger. There is no number for it to settle on.

⌘/Ctrl + Enter runs the cell

Constants

A constant multiplier stays. Multiply a function by cc and every height is multiplied by cc. Each rise is multiplied by cc and each run is not, so every slope is multiplied by cc.

So ddx(3x2)=3×2x=6x\frac{d}{dx}(3x^2) = 3 \times 2x = 6x. A negative multiplier flips the graph, and the sign of every slope: ddx(−x2)=−2x\frac{d}{dx}(-x^2) = -2x.

An added constant vanishes. Adding a constant moves the whole graph up or down. Every rise and every run stay the same, so every slope stays the same: ddx(x2+5)=2x\frac{d}{dx}(x^2 + 5) = 2x. A constant on its own, like y=7y = 7, is a flat line with slope 0.

Adding 3 to x2x^2 lifts the curve but leaves its tangent at x=1x = 1 with slope 2. Multiplying x2x^2 by 2 doubles every height, and the slope at x=1x = 1 doubles from 2 to 4.

Rule: Constant rules

ddx(c f(x))=c f′(x)ddx c=0\begin{gathered} \frac{d}{dx}\big(c\,f(x)\big) = c\,f'(x) \\[4pt] \frac{d}{dx}\,c = 0 \end{gathered}

A constant multiplier cc stays in front. A constant on its own has slope 0, because its graph is flat.

A constant multiplier often carries units. A stone dropped from rest falls about s=4.9t2s = 4.9t^2 metres in tt seconds. Its speed is dsdt=4.9×2t=9.8t\frac{ds}{dt} = 4.9 \times 2t = 9.8t metres per second: 9.8 after 1 second and 19.6 after 2.

Try it

SymPy confirms each constant example, then works out the stone's speed after 1, 2 and 3 seconds.

sp.Rational(49, 10) is 4.9 as an exact fraction, so SymPy prints the speed as 49*t/5, which is 9.8t9.8t.

⌘/Ctrl + Enter runs the cell

Sums and differences

When two functions are added, the rise of the sum is the sum of their rises. So the slope of a sum is the sum of the slopes.

Rule: Sum rule

(f+g)′=f′+g′(f−g)′=f′−g′\begin{gathered} \big(f + g\big)' = f' + g' \\[4pt] \big(f - g\big)' = f' - g' \end{gathered}

Differentiate a sum or difference one term at a time. With the constant rules, this differentiates any polynomial at sight.

Take 4x3−2x2+5x−94x^3 - 2x^2 + 5x - 9. Term by term, its derivative is 12x2−4x+512x^2 - 4x + 5, and the −9-9 disappears. At x=1x = 1 the slope is 12−4+5=1312 - 4 + 5 = 13; a central difference with h=0.01h = 0.01 gives 13.0004.

Rewrite first

Many functions become sums of powers after a little algebra. Then the rules above finish the job.

  • Expand a product. (x+1)2=x2+2x+1(x + 1)^2 = x^2 + 2x + 1, so its derivative is 2x+22x + 2.
  • Split a fraction whose bottom is a single power. x2+1x=x+x−1\frac{x^2 + 1}{x} = x + x^{-1}, so its derivative is 1−1x21 - \frac{1}{x^2}.

Two things these rules cannot do. A product is not differentiated factor by factor: x2⋅x3=x5x^2 \cdot x^3 = x^5 has slope 5x45x^4, not 2x⋅3x2=6x32x \cdot 3x^2 = 6x^3. Lesson 2.3.2 gives the product rule.

The power rule also needs a fixed power of xx itself. In 2x2^x the variable is the exponent (lesson 2.3.4), and (3x+1)5(3x + 1)^5 is a power of an expression (lesson 2.3.3, the chain rule).

Try it

The first lines differentiate the polynomial and evaluate its slope at 1. A central difference checks that slope.

For the rewrites, sp.expand first turns each function into a sum of powers, as above.

⌘/Ctrl + Enter runs the cell

Lesson 2.4.1 uses these rules to find where a function peaks. Case study 2.3.7 applies the power rule to every payment of a bond.

Common mistakes

  1. The power drops by one. x5x^5 gives 5x45x^4, not 5x55x^5.
  2. Negative powers move away from zero. x−2x^{-2} gives −2x−3-2x^{-3}, not −2x−1-2x^{-1}.
  3. Rewrite as a power first. 1x2\frac{1}{x^2} does not give 12x\frac{1}{2x}; write it as x−2x^{-2} and get −2x3-\frac{2}{x^3}.
  4. A constant on its own vanishes; a multiplier stays. x2+5x^2 + 5 gives 2x2x, but 5x25x^2 gives 10x10x.
  5. No slope where the formula breaks. 1x\frac{1}{x} has none at 0, and neither does x\sqrt{x}, whose tangent there is vertical.
  6. Not for products or variable powers. Do not differentiate a product factor by factor, and do not use the power rule on 2x2^x.

Power, constant and sum rules

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

  • ddx\frac{d}{dx} means "the derivative with respect to xx". A derivative is in output units per input unit.
  • Power rule: ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1} for any real nn. Write roots and reciprocals as powers first.
  • No slope where xnx^n or its slope formula is undefined: negative powers at 0, x\sqrt{x} at 0.
  • Constants: ddx(cf)=cf′\frac{d}{dx}(cf) = cf' and ddxc=0\frac{d}{dx}c = 0. Sums: (f±g)′=f′±g′(f \pm g)' = f' \pm g'.
  • So a polynomial is differentiated term by term. sp.diff(expr, x) checks any derivative.

Free further reading

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

  • Derivatives

    Paul's Online Notes. Notes.

    The definition of the derivative and every differentiation rule, one page per rule.

  • 18.01SC Single Variable Calculus

    MIT OpenCourseWare. Course.

    Full lectures, recitation videos and problem sets with solutions.