Jump to content

Computing derivatives – "Math for Non-Geeks"

From Wikibooks, open books for an open world

In the last chapter we defined the derivative function f′:D→ℝ of another differentiable function f:D→ℝ as follows: f′(x~):=limx→x~f(x)−f(x~)x−x~. However, evaluating this limit can be a very cumbersome way to determine the derivative. For example, take the function g:ℝ→ℝ with g(x)=x2⋅ln⁡(x). To calculate their derivatives we would have to determine limx→x~x2⋅ln⁡(x)−x~2⋅ln⁡(x~)x−x~ for every x~∈ℝ.

It would be great to apply some rules to directly find an expression for the derivative function, which saves us the differential quotient computation. And luckily there are indeed derivative rules that trace derivatives of a complicated function back to derivatives of some very basic functions that are known exactly.

Overview

[edit | edit source]

If f and g are differentiable functions, with the compositions af (with a∈ℝ), f+g, fg, fg and f∘g being all well-defined and differentiable, Then the following derivative rules apply:

Rule Formula
Factor rule (af)′=af′
Sum rule (f±g)′=f′±g′
Product rule (fg)′=f′g+fg′
Quotient rule (fg)′=gf′−fg′g2
Inverse rule (1g)′=−g′g2
Chain rule (f∘g)′=(f′∘g)⋅g′
Special cases of the chain rule (fn)′=nfn−1⋅f′(f)′=f′2f(exp⁡∘f)′=(exp⁡∘f)⋅f′(ln⁡∘f)′=f′f
derivative of the inverse function (f−1)′=1f′∘f−1

All rules at one glance

[edit | edit source]

The derivatives rules can be explained in simple words:

  • Factor rule (af)′=af′: The derivative is linear, so we can pull out any real (or even complex) number.
  • Sum and difference rule (f±g)′=f′±g′: The derivative is linear, so for a sum, we can take the derivative of both summands separately.
  • Product rule (fg)′=f′g+fg′: "Derive the first function and the second remains unchanged plus derive the second function and the first remains unchanged".
  • Quotient rule (fg)′=gf′−fg′g2: DDE-EDD is a simple memorization rule for the numerator ("denominator derivative enumerator minus enumerator derivative denominator")
  • Inverse rule (1g)′=−g′g2: This is the special case of the quotient rule with f≡1 (enumerator is constant 1).
  • Chain rule (f∘g)′=(f′∘g)⋅g′: "Derive the outer function times derive the inner function". Caution, the derivative of the outer function must be taken with the inner function inserted (f′(g(x))). The differentiation of the inner function must not be forgotten either.

Factor rule

[edit | edit source]
Theorem (Factor product)

Let f:D→ℝ be a differentiable function with derivative f′:D→ℝ and let λ∈ℝ be a scalar factor. Then (λf)′:D→ℝ is differentiable and

(λf)′=λf′

Proof (Factor product)

We need to show that limx→x~(λf)(x)−(λf)(x~)x−x~ exists and equals λf′. For x~∈D there is

limx→x~(λf)(x~)−(λf)(x)x~−x= limx→x~λf(x~)−λf(x)x~−x= limx→x~λf(x~)−f(x)x~−x↓ limx→aλg(x)=λlimx→ag(x)= λlimx→x~f(x~)−f(x)x~−x= λf′(x~)

So (λf)′=λf′.

Sum rule

[edit | edit source]

Theorem

[edit | edit source]

Now we want to determine the derivative of a function g+f, where g:D→ℝ and f:D→ℝ are both differentiable functions.

Theorem (Sum rule)

Let f,g:D→ℝ with D⊆ℝ be two differentiable functions with derivatives f′:D→ℝ and g′:D→ℝ. Then f+g:D→ℝ is differentiable and for all x∈D there is:

(f+g)′(x)=f′(x)+g′(x)

Proof (Sum rule)

We need to prove that the limit limx→x~(f+g)(x)−(f+g)(x~)x−x~ exists. We have

limx→x~(f+g)(x)−(f+g)(x~)x−x~= limx→x~f(x)+g(x)−f(x~)−g(x~)x−x~= limx→x~(f(x)−f(x~)x−x~+g(x)−g(x~)x−x~)↓ f and g are differentiable= limx→x~f(x)−f(x~)x−x~+limx→x~g(x)−g(x~)x−x~= f′(x~)+g′(x~)

So (f+g)′(x)=f′(x)+g′(x).

Example

[edit | edit source]
Example (Sums of lines)

We consider two straight lines f,g:ℝ→ℝ with f(x)=m1x+t1 and g(x)=m2x+t2. Then

(f+g)(x)=m1x+t1+m2x+t2=(m1+m2)x+(t1+t2)

The derivative of a function at the position x is the slope of the function at this position. The slope of the straight lines f and g are m1 and m2 respectively. So f′(x)=m1 and g′(x)=m2 for all x∈ℝ.

For the straight line f+g , the slope is m1+m2 . So we have (f+g)′(x)=m1+m2=f′(x)+g′(x). Hence, the summation rule holds for straight lines.

Difference rule

[edit | edit source]
Exercise (Difference rule)

Prove the difference rule for derivatives, in analogy to the summation rule: Let f,g:D→ℝ with D⊆ℝ be two differentiable functions with derivative f′:D→ℝ and g′:D→ℝ. Then f−g is also differentiable. And for all x∈D, there is:

(f−g)′(x)=f′(x)−g′(x)

Proof (Difference rule)

For x~∈D there is

limx→x~(f−g)(x)−(f−g)(x~)x−x~= limx→x~f(x)−g(x)−f(x~)+g(x~)x−x~= limx→x~(f(x)−f(x~)x−x~−g(x)−g(x~)x−x~)↓ f and g are differentiable= limx→x~f(x)−f(x~)x−x~−limx→x~g(x)−g(x~)x−x~= f′(x~)−g′(x~)

Product rule

[edit | edit source]
Theorem (Product rule)

Let f:D→ℝ and g:D→ℝ with D⊆ℝ be differentiable functions with known derivative functions f′,g′:D→ℝ. Then, f⋅g:D→ℝ,(f⋅g)(x):=f(x)⋅g(x) is differentiable and there is

(f⋅g)′:D→ℝ,(f⋅g)′(x)=f′(x)⋅g(x)+g′(x)⋅f(x)

Proof (Product rule)

Let x∈D. Then, there is:

limx→x~(f⋅g)(x)−(f⋅g)(x~)x−x~↓ definition of (f⋅g)= limx→x~f(x)g(x)−f(x~)g(x~)x−x~↓ −f(x~)g(x)+f(x~)g(x)=0= limx→x~f(x)g(x)−f(x~)g(x)+f(x~)g(x)−f(x~)g(x~)x−x~= limx→x~f(x)g(x)−f(x~)g(x)x−x~+f(x~)g(x)−f(x~)g(x~)x−x~↓ pull apart the limit= limx→x~f(x)g(x)−f(x~)g(x)x−x~+limx→x~f(x~)g(x)−f(x~)g(x~)x−x~↓ factor out g(x) and f(x~)= limx→x~g(x)f(x)−f(x~)x−x~+limx→x~f(x~)g(x)−g(x~)x−x~↓ limit theorems= limx→x~g(x)⏟→g(x~)⋅limx→x~f(x)−f(x~)x−x~⏟→f′(x~)+f(x~)⋅limx→x~g(x)−g(x~)x−x~⏟→g′(x~)= g(x~)⋅f′(x~)+f(x~)⋅g′(x~)

In order to justify that the limits may be pulled apart, one must look at the calculation from back to front. Since all sub-expressions converge, the limit sets are allowed to be used.

Alternative proof (Product rule)

We look at any x~∈D. Since f and g are differentiable according to the condition in x~, there are functions δf,δg:D→ℝ, such that for all x∈D there is

f(x)=f(x~)+f′(x~)⋅(x−x~)+δf(x)g(x)=g(x~)+g′(x~)⋅(x−x~)+δg(x)

In addition, there is limx→x~δf(x)x−x~=0 and limx→x~δf(x)x−x~=0. Hence, for all x∈D we have

f(x)⋅g(x)= (f(x~)+f′(x~)⋅(x−x~)+δf(x))⋅(g(x~)+g′(x~)⋅(x−x~)+δg(x))= f(x~)g(x~)+(f′(x~)g(x~)+g′(x~)f(x~))(x−x~)+δf(x)g′(x~)(x−x~)+δg(x)f′(x~)(x−x~)+f′(x~)g′(x~)(x−x~)2+f(x~)δg(x)+g(x~)δf(x)+δf(x)δg(x)

Now, we define the function δf⋅g:D→ℝ by

δf⋅g(x):=δf(x)g′(x~)(x−x~)+δg(x)f′(x~)(x−x~)+f′(x~)g′(x~)(x−x~)2+f(x~)δg(x)+g(x~)δf(x)+δf(x)δg(x)

So for all x∈D:

f(x)g(x)=f(x~)g(x~)+(f′(x~)g(x~)+g′(x~)f(x~))(x−x~)+δf⋅g(x)

If we can show that limx→x~δf⋅g(x)x−x~=0, then f⋅g is differentiable at x~ and (f⋅g)′(x~)=f′(x~)g(x~)+g′(x~)f(x~). It is sufficient to show that all summands of the term δf⋅g(x) converge faster than x−x~ towards 0:

limx→x~δg(x)f′(x~)(x−x~)x−x~=limx→x~δf(x)⏟→0g′(x~)=0limx→x~δg(x)f′(x~)(x−x~)x−x~=limx→x~δg(x)⏟→0f′(x~)=0limx→x~f′(x~)g′(x~)(x−x~)2x−x~=limx→x~f′(x~)g′(x~)(x−x~)⏟→0=0limx→x~f(x~)δg(x)x−x~=limx→x~f(x~)δg(x)x−x~⏟→0=0limx→x~g(x~)δf(x)x−x~=limx→x~g(x~)δf(x)x−x~⏟→0=0limx→x~δf(x)δg(x)x−x~=limx→x~δf(x)⏟→0δg(x)x−x~⏟→0=0

Quotient rule

[edit | edit source]
Theorem (Quotient rule)

Let f,g:D→ℝ be two differentiable functions with g(x)≠0 for all x∈D. Then the derivative of the function fg:D→ℝ, defined by (fg)(x)=f(x)g(x), is differentiable and for (fg)′:D→ℝ there is

(fg)′(x)=f′(x)g(x)−f(x)g′(x)g2(x)

Here, g2(x)=g(x)⋅g(x). In particular, we have the inverse rule:

(1g)′(x)=−g′(x)g2(x)

Proof (Quotient rule)

To prove the statement we first show that (1g)′(x)=−g′(x)g2(x) holds. Here, g:D→ℝ is a differentiable function with g(x)≠0 for all x∈D. Let now x~∈D. We consider limx→x~(1g)(x)−(1g)(x~)x−x~. There is

limx→x~(1g)(x)−(1g)(x~)x−x~= limx→x~1g(x)−1g(x~)x−x~= limx→x~g(x~)−g(x)g(x)⋅g(x~)x−x~= limx→x~g(x~)−g(x)g(x~)⋅g(x)(x−x~)= limx→x~(−g(x)−g(x~)x−x~⋅1g(x~)g(x))↓ limit theorems= limx→x~(−g(x)−g(x~)x−x~)⋅limx→x~1g(x~)g(x)↓ factor rule= −limx→x~g(x)−g(x~)x−x~⏟→g′(x~)⋅1g(x~)limx→x~g(x)⏟→g(x~)= −g′(x~)1g(x~)g(x~)= −g′(x~)g2(x~)

In the end, we see that all sub-expressions converge. That is why the limit theorems are allowed to be used. Now we derive the quotient rule for fgg from this. Here we have f,g:D→ℝ and g(x)≠0 for all x∈D. The quotient rule can then be derived from the product rule:

(fg)′(x)=(f(x)g(x))′=(f(x)⋅1g(x))′↓ product rule= f′(x)⋅1g(x)+f(x)(−g′(x)g2(x))= f′(x)g(x)−f(x)g′(x)g2(x)

Chain rule

[edit | edit source]
Theorem (Chain rule)

Let f:A→B and g:C→D be two real-valued and differentiable functions with A,B,C,D⊆ℝ and f(A)⊆C. Then, for the derivative function of g∘f:A→D, there is:

(g∘f)′:A→ℝ,(g∘f)′(x)=g′(f(x))⋅f′(x)

How to get to the proof? (Chain rule)

We could first try to conduct the proof directly via the differential quotient:

limx→x~(g∘f)(x)−(g∘f)(x~)x−x~= limx→x~(g(f(x))−(g(f(x~))x−x~↓ expand by f(x)−f(x~)= limx→x~(g(f(x))−(g(f(x~))f(x)−f(x~)⋅f(x)−f(x~)x−x~↓ limit theorems= limx→x~(g(f(x))−(g(f(x~))f(x)−f(x~)⏟→g′(f(x~))⋅limx→x~f(x)−f(x~)x−x~⏟→f′(x~)= g′(f(x~))⋅f′(x~)

These arithmetic steps reflect the basic idea behind a proof of the chain rule. But this argumentation is problematic (i.e. wrong) for several reasons:

  • We expand by f(x)−f(x~). But what happens if f(x~)=f(x)? Then we have expanded by zero, which is not allowed. So the found limit value doesn't need to be correct any more.
  • In the last step we claim that limx→x~g(f(x))−(g(f(x~)f(x)−f(x~)=g′(f(x~)) would hold. All we know is that limf(x)→f(x~)g(f(x))−(g(f(x~)f(x)−f(x~)=g′(f(x~)), but we cannot say anything about how this limit value behaves in the limit x→x~ instead of f(x)→f(x~).

To save the proof, we take a way around, using an auxiliary function. This function will be well-defined at the position x~, so we avoid the extension with f(x)−f(x~).

Proof (Chain rule)

Let x~∈A. We define the following auxiliary function:

g~:C→ℝ,u↦{g(u)−g(f(x~))u−f(x~);u≠f(x~)g′(f(x~));u=f(x~)

Then, there is for all u∈C:

g(u)−g(f(x~))=g~(u)⋅(u−f(x~))

Further, g~ is continuous at all u≠f(x~): it is just a combination of continuous functions.g~ is even continuous at u=f(x~), since differentiability of g implies

limu→f(x~)g~(u)=limu→f(x~)g(u)−g(f(x~))u−f(x~)=g′(f(x~))=g~(f(x~))

So:

limx→x~(g∘f)(x)−(g∘f)(x~)x−x~= limx→x~(g(f(x))−(g(f(x~))x−x~↓ g(f(x))−(g(f(x~))=g~(f(x))⋅(f(x)−f(x~))= limx→x~g~(f(x))⋅(f(x)−f(x~))x−x~↓ limit theorems= limx→x~(f(x)−f(x~))x−x~⏟→f′(x~)⋅limx→x~g~(f(x))= f′(x~)⋅limx→x~g~(f(x))↓ g~ is continuous= f′(x~)⋅g~(limx→x~f(x))↓ f is continuous = f′(x~)⋅g~(f(x~))= f′(x~)⋅g′(f(x~))

Alternative proof (Chain rule)

Let x~∈A. Since f and g are differentiable , there are functions δf:A~:={a−x~|a∈A}→ℝ and δg:C~:={c−f(x~)|c∈C}→ℝ, such that for all h∈A~ and all i∈C~ there is

f(x~+h)=f(x~)+f′(x~)⋅h+δf(h)g(f(x~)+i)=g(f(x~))+g′(f(x~))⋅i+δg(i)

In addition, limh→0δf(h)h=0 as well as limi→0δg(i)i=0. So:

(g∘f)(x~+h)= g(f(x~)+f′(x~)⋅h+δf(h))= g(f(x~))+g′(f(x~))⋅(f′(x~)⋅h+δf(h))+δg(f′(x~)⋅h+δf(h))= g(f(x~))+g′(f(x~))f′(x~)h+g′(f(x~))δf(h)+δg(f′(x~)⋅h+δf(h))

We now define

δg∘f:A~→ℝ,x↦g′(f(x~))δf(h)+δg(f′(x~)⋅h+δf(h))

In order to prove that g∘f is differentiable at x~ with (g∘f)′(x~)=g′(f(x~))f′(x~) we need to show that limh→0δg∘f(h)h=0 holds. There is:

limh→0δg∘f(h)h= limh→0g′(f(x~))δf(h)+δg(f′(x~)⋅h+δf(h))h↓ pull apart the limit= limh→0g′(f(x~))δf(h)h+limh→0δg(f′(x~)⋅h+δf(h))h= g′(f(x~))limh→0δf(h)h+limh→0δg(f′(x~)⋅h+δf(h))h↓ limh→0δf(h)h=0= g′(f(x~))⋅0+limh→0δg(f′(x~)⋅h+δf(h))h= limh→0δg(f′(x~)⋅h+δf(h))h

To calculate this limit, we consider any sequence (hn)n∈ℕ in ℝ∖{0} which converges towards 0. For all n∈ℕ with f′(x~)⋅hn+δf(hn)=0 , there is δg(0)=0 so δg(f′(x~)⋅hn+δf(hn))hn=0.

If only there are finally many n∈ℕ with δg(f′(x~)⋅hn+δf(hn))hn≠0, then we have limn→∞δg(f′(x~)⋅hn+δf(hn))hn=0. So let us consider the case that for infinitely many n∈ℕ there is δg(f′(x~)⋅hn+δf(hn))hn≠is0. Let (hnk)k∈ℕ be the subsequence of elements of (hn)n∈ℕ with δg(f′(x~)⋅h+δf(h))≠0. There is

limk→∞δg(f′(x~)⋅hnk+δf(hnk))hnk= limk→∞δg(f′(x~)⋅hnk+δf(hnk))f′(x~)⋅hnk+δf(hnk)⋅f′(x~)⋅hnk+δf(hnk)hnk↓ pull apart the limit= limk→∞δg(f′(x~)⋅hnk+δf(hnk))f′(x~)⋅hnk+δf(hnk)⋅limk→∞f′(x~)⋅hnk+δf(hnk)hnk↓ sincelimk→∞hnk=0 there is limk→∞f′(x~)⋅hnk+δf(hnk)=0= limĥ→0δg(ĥ)ĥ⋅(limk→∞f′(x~)⋅hnkhnk+limk→∞δf(hnk)hnk)↓ limĥ→0δg(ĥ)ĥ=0 and limk→∞hnk=0= 0⋅(f′(x~)+limh~→0δf(h~)h~)↓ limh~→0δg(h~)h~=0 = 0⋅(f′(x~)+0)= 0

So we have

limh→0δg(f′(x~)⋅h+δf(h))h=0

Hint

Using the chain rule, we may prove the inverse rule (1f)′=−f′f2 . If we set the "outer function" g(x)=1x, then there is g′(x)=−1x2. So we have

(1f)′(x)=(g∘f)′(x)=g′(f(x))⋅f′(x)=−1f2(x)⋅f′(x)=−f′(x)f2(x)

We used this rule above to derive the quotient rule. That means, the quotient rule can be shown with the chain rule and the product rule at hand. Conversely, we may prove the product rule using the chain rule. For the exercise, we recommend our exercises.