In the previous video,
I presented some examples of how to use the chain rule in computations.
I assume you have watched it first.
In this video, I will write the statement of the chain rule for arbitrary functions,
explain the notation, and try to prove it.
Here is the equation for arbitrary functions f and g.
The derivative of the composition of f and g, evaluated at x,
equals the derivative of f evaluated at g(x),
times the derivative of g evaluated at x.
I know that some students find calculations with specific functions easy,
but get confused when I write the chain rule this way.
I will try to unpack this formula slowly with an example.
Let's say I want to take the derivative of √(x³ + 1) with respect to x.
This should be familiar if you have watched the previous video.
I can write this quantity as f(g(x)), where f(x) = √x, and g(x) = x³ + 1.
f(g(x)) is the same as (f∘g)(x).
I know not everyone is comfortable with this notation for composition,
so let's clarify it first.
For this video,
I want to be very strict and distinguish between the name of a function,
and the value of that function at x, which should be a number.
For example, I may call a function f, and then its value at x is f(x).
Notice that if x is a number, f(x) is also a number.
f(x) is not the name of the function. The name of the function is just f.
For example, there is a function called sine.
Sine by itself is not a number. It is the name of the function.
But sin(x) is the value of this function at x, which will be a number.
Now let's get to composition.
For functions f and g, f(g(x)) will be a number (as long as the domains are right).
But what is the name of this function?
We normally write it f ∘ g, and we read this f composed with g.
So the name of the function is f ∘ g, the value of the function at x is f(g(x)).
You may think I am being overly pedantic in making this distinction,
and I admit that it is common to abuse notation and confuse f and f(x),
but there are a few situations where we have to be very careful
with this distinction, and this is one of them, as I will explain in a moment.
Okay, back to what I was doing.
In this example, what is each one of these three quantities?
First, I have the derivative of the composition.
The composition at x is this quantity.
When I take the derivative of the full function,
it is the derivative with respect to x.
So this first term is the derivative with respect to x of √(x³ + 1).
Second, I have the derivative of f, evaluated at g(x).
f(x) is √(x,) so f'(x) is 1/2√x,
but instead of at x, I need to evaluate it at g(x), which is x³ + 1.
So I get 1/2√(x³ + 1).
And the third piece is the easiest. g(x) is x³ + 1, so g'(x) is 3x².
That's it. This is the chain rule.
Notice that I do not have any way to write this first term nicely,
other than using the notation for composition.
And that's why I was being strict with the notation.
This formula summarizes the chain rule,
but if I want to think of it as a theorem and prove it,
I need to be yet a little bit more careful, as usual.
Here is the chain rule as a theorem. I begin by introducing the notation.
a is a real number, f and g are functions.
At the bottom, I wrote the equation for the chain rule.
I wrote it at a,
because we can study differentiability at a single point at a time.
The theorem, like most theorems, is an if-then statement.
What are the hypotheses? In order for this formula to be true, I need to assume
that each one of these derivatives exists.
So I assume that g is differentiable at a,
and I assume that f is differentiable at g(a).
Then I conclude that f ∘ g is differentiable at a
and that the equation is true.
But notice that if f or g are not differentiable,
then the composition may or may not be differentiable.
We cannot conclude anything in that case,
and we cannot use the chain rule in that case.
We have a theorem. Shall we try to prove it?
I can write the derivative of the composition at a
using the definition of derivative as a limit.
I am going to multiply numerator and denominator by g(x) - g(a),
which shouldn't change anything.
And then I can use a limit law to write this limit of a product,
as a product of limits, assuming the two individual limits exist.
Look at the second limit first. This is g'(a).
And I can say so because we are assuming g is differentiable at a.
The first limit will be a bit more interesting.
I am hoping that this is f'(g(a))?
Let's write f'g(a)) as a limit.
I will use a different variable, u, so as not to get confused.
It is lim_(u → g(a)) [f(u) - f(g(a))] ÷ [u - g(a)].
It looks similar enough. Notice that g(a) is just a number.
In this new limit, the variable is u. In the original limit, I instead have g(x).
I am tempted to say that u = g(x), and as x → a, u → g(a),
because g is continuous.
Strictly speaking, what I would be doing is
composing the function in this limit with the function g.
Limits of compositions are a bit delicate, but before making sure that this works,
I should pay attention to an even bigger problem.
Right here in the second step, I multiplied and divided by g(x) - g(a).
What if I divided by zero?
We know when x → a that x is not a, but g(x) may still be g(a).
For this proof to work, I need an additional condition.
I need that when x is close to a but not a, g(x) is not g(a).
And unfortunately, this is not always true.
For example, for this function, on every small open interval centered at 0,
there are plenty of values x where g(x) equals g(0).
The proof would not work for this function at all.
Sadly, this is not a proof. I still find it an interesting argument to consider,
because it is such a natural thing to try.
And for most of the functions we usually work with, it would be a valid proof.
This argument can be fixed into a correct proof, but it is cumbersome.
There are better options. There are cleaner proofs that are fully rigorous,
using more sophisticated tools.
I won't write them here.
If you study multivariable calculus, you will probably learn one of them.
To finish the video, I want to rewrite the chain rule using Leibniz notation.
This will come in handy in physical applications.
Here is the formula again.
This time,
let's assume we are working with physical quantities, and let's give them names.
I will say u = g(x), and y = f(u), which is also f(g(x)).
With this notation, g'(x) is du/dx.
What is f'(g(x))? It is dy/du.
And finally, the derivative of the composition is dy/dx.
And that's the chain rule in Leibniz notation.
This notation is very suggestive; it suggests "just cancel the du's!"
But of course, it is not that simple.
du/dx is notation.
It does not mean that I divide a number du over another number dx.
The notation has to be understood in terms of limits.
Still, it is a convenient way to remember the statement of the chain rule.