User:IssaRice/Chain rule proofs: Difference between revisions

From Machinelearning
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
a differentiable function looks locally like a linear transformation. if you compose two differentiable functions, then it seems pretty obvious that locally, that composed map also looks like a linear transformation. but which linear transformation? well, you first apply the linear transformation that locally approximates the inner function. then you land in some target space, and you find what the outer function locally looks like at the place you land. and that's all the chain rule says.
a differentiable function looks locally like a linear transformation. if you compose two differentiable functions, then it seems pretty obvious that locally, that composed map also looks like a linear transformation. but which linear transformation? well, you first apply the linear transformation that locally approximates the inner function. then you land in some target space, and you find what the outer function locally looks like at the place you land. and that's all the chain rule says.
So Folland actually says this on page 109: "Since the product of two matrices gives the composition of the linear transformations defined by those matrices, the chain rule just says that ''the linear approximation of a composition is the composition of the linear approximations''." But... putting this short paragraph away after a proof, and only after you've already discussed two versions of the chain rule in previous chapters, is in my opinion not trying hard enough to communicate the central message. This should be in bold flashing letters at the TOP of the FIRST discussion of the chain rule.


==Using Newton's approximation==
==Using Newton's approximation==

Latest revision as of 01:01, 31 May 2020

a differentiable function looks locally like a linear transformation. if you compose two differentiable functions, then it seems pretty obvious that locally, that composed map also looks like a linear transformation. but which linear transformation? well, you first apply the linear transformation that locally approximates the inner function. then you land in some target space, and you find what the outer function locally looks like at the place you land. and that's all the chain rule says.

So Folland actually says this on page 109: "Since the product of two matrices gives the composition of the linear transformations defined by those matrices, the chain rule just says that the linear approximation of a composition is the composition of the linear approximations." But... putting this short paragraph away after a proof, and only after you've already discussed two versions of the chain rule in previous chapters, is in my opinion not trying hard enough to communicate the central message. This should be in bold flashing letters at the TOP of the FIRST discussion of the chain rule.

Using Newton's approximation

Main idea

The main idea of using Newton's approximation to prove the chain rule is that since f is differentiable at x0 we have the approximation f(x)f(x0)+f(x0)(xx0) when x is near x0. Similarly since g is differentiable at f(x0) we have the approximation g(y)g(f(x0))+g(f(x0))(yf(x0)) when y is near f(x0). Since f is differentiable at x0, it is continuous there also, so we know that f(x) is near f(x0) whenever x is near x0. This allows us to substitute f(x) into y whenever x is near x0. So we get

g(f(x))g(f(x0))+g'(f(x0))(f(x)f(x0))g(f(x0))+g'(f(x0))(f'(x0)(xx0))

Thus we get gf(x)gf(x0)+g(f(x0))f(x0)(xx0), which is what the chain rule says.

Slightly more formally:

f(x)=f(x0)+f(x0)(xx0)+o(xx0) when x is near x0

g(y)=g(f(x0))+g(f(x0))(yf(x0))+o(yf(x0)) when y is near f(x0)

f is continuous at x0 so f(x) is near f(x0) whenever x is near x0.

Thus if x is near x0

g(f(x))=g(f(x0))+g'(f(x0))(f'(x0)(xx0)+o(xx0))+o(f(x)f(x0))=g(f(x0))+g'(f(x0))f'(x0)(xx0)+g'(f(x0))o(xx0)+o(f(x)f(x0))

to complete the proof, we just need to show that the error g(f(x0))o(xx0)+o(f(x)f(x0)) is o(xx0). The former term clearly is. The latter term is o(f(x0)(xx0)+o(xx0)) so it is as well.

Proof

We want to show gf is differentiable at x0 with derivative L:=g(f(x0))f(x0). By Newton's approximation, this is equivalent to showing that for every ϵ>0 there exists δ>0 such that

|gf(x)(gf(x0)+L(xx0))|ϵ|xx0|

whenever |xx0|δ. So let ϵ>0.

Now we do some algebraic manipulation. Write

g(y)=g(y0)+g(y0)(yy0)+Eg(y,y0)

where Eg(y,y0):=g(y)(g(y0)+g(y0)(yy0)). This holds for every yY. Since f(x)Y we thus have

g(f(x))=g(f(x0))+g(f(x0))(f(x)f(x0))+Eg(f(x),f(x0))

Similarly write

f(x)=f(x0)+f(x0)(xx0)+Ef(x,x0)

where Ef(x,x0):=f(x)(f(x0)+f(x0)(xx0)).

Substituting the expression for f(x) in the expression for g(f(x)) we get

g(f(x))=g(f(x0))+g'(f(x0))(f'(x0)(xx0)+Ef(x,x0))+Eg(f(x),f(x0))=g(f(x0))+g'(f(x0))f'(x0)(xx0)+g'(f(x0))Ef(x,x0)+Eg(f(x),f(x0))

we can rewrite this as gf(x)(gf(x0)+L(xx0))=g(f(x0))Ef(x,x0)+Eg(f(x),f(x0))

Thus our goal now is to show |g(f(x0))Ef(x,x0)+Eg(f(x),f(x0))|ϵ|xx0|.

But by the triangle inequality it suffices to show |g(f(x0))Ef(x,x0)|+|Eg(f(x),f(x0))|ϵ|xx0|.

|g(f(x0))Ef(x,x0)||g(f(x0))|ϵ1|xx0| where we are free to choose ϵ1.

To get the bound for |Eg(f(x),f(x0))| (using Newton's approximation), we need to make sure |f(x)f(x0)| is small. But by continuity of f at x0 we can do this.

|Eg(f(x),f(x0))|ϵ2|f(x)f(x0)|=ϵ2|f'(x0)(xx0)+Ef(x,x0)|ϵ2(|f'(x0)||xx0|+|xx0|)=ϵ2(|f'(x0)|+1)|xx0|

where again we are free to choose ϵ2.

TODO: can we do this same proof but without using the error term notation?

TODO: somehow Folland does this without explicitly using continuity of f; i need to understand if he's using it implicitly somehow or he's actually proving it when bounding |h| using |u|

old proof

Since g is differentiable at y0, we know g(y0) is a real number, and we can write

g(y)=g(y0)+g(y0)(yy0)+[g(y)(g(y0)+g(y0)(yy0))]

(there is no magic: the terms just cancel out)

If we define Eg(y,y0):=g(y)(g(y0)+g(y0)(yy0)) we can write

g(y)=g(y0)+g(f(x0))(yy0)+Eg(y,y0)

Newton's approximation says that |Eg(y,y0)|ϵ|yy0| as long as |yy0|δ.

Since f is differentiable at x0, we know that it must be continuous at x0. This means we can keep |f(x)y0|δ as long as we keep |xx0|δ.

Since f(x)Y and |f(x)y0|δ, this means we can substitute y=f(x) and get

g(f(x))=g(y0)+g(f(x0))(f(x)y0)+Eg(f(x),y0)

Now we use the differentiability of f. We can write

f(x)=f(x0)+f(x0)(xx0)+[f(x)(f(x0)+f(x0)(xx0))]

Again, we can define Ef(x,x0):=f(x)(f(x0)+f(x0)(xx0)) and write this as

f(x)=f(x0)+f(x0)(xx0)+Ef(x,x0)

Now we can substitute this into the expression for g(f(x)) to get

g(f(x))=g(y0)+g(f(x0))(f(x0)(xx0)+Ef(x,x0))+Eg(f(x),f(x0))

where we have canceled out two terms using f(x0)=y0.

Thus we have

g(f(x))=g(y0)+g(f(x0))f(x0)(xx0)+[g(f(x0))Ef(x,x0)+Eg(f(x),f(x0))]

We can write this as

(gf)(x)((gf)(x0)+L(xx0))=[g(f(x0))Ef(x,x0)+Eg(f(x),f(x0))]

where L:=g(f(x0))f(x0). Now the left hand side looks like the expression in Newton's approximation. This means to show gf is differentiable at x0, we just need to show that |g(f(x0))Ef(x,x0)+Eg(f(x),f(x0))|ϵ|xx0|.

The stuff in square brackets is our "error term" for gf. Now we just need to make sure it is small, even after dividing by |xx0|.

But f is differentiable at x0, so by Newton's approximation,

|g(f(x0))Ef(x,x0)||g(f(x0))|ϵ1|xx0|

we also have

|Eg(f(x),f(x0))|ϵ2|f(x)f(x0)|=ϵ2|f(x0)(xx0)+Ef(x,x0)|

We can bound this from above using the triangle inequality:

|Eg(f(x),f(x0))|ϵ2|f'(x0)(xx0)|+ϵ2|Ef(x,x0)|ϵ2|f'(x0)||xx0|+ϵ2ϵ1|xx0|

Now we can just choose ϵ1,ϵ2 small enough.

Limits of sequences

Main idea

Let (xn)n=1 be a sequence taking values in X{x0} that converges to x0. Then we want to write

g(f(xn))g(f(x0))xnx0=g(f(xn))g(f(x0))f(xn)f(x0)f(xn)f(x0)xnx0

Now use the limit laws to conclude that the limit is g(f(x0))f(x0). The problem is that f(xn)f(x0) can be zero even when xnx0.

Proof

Let (xn)n=1 be a sequence taking values in X{x0} that converges to x0.

Define a function ϕ:YR by

ϕ(y):={yf(x0)g'(f(x0))y=f(x0)

The idea is that we want to say g(f(xn))g(f(x0))f(xn)f(x0) is going to g(f(x0)), so we just define it at the undefined points to already be at that limit.

Now we have

g(f(xn))g(f(x0))xnx0=ϕ(f(xn))f(xn)f(x0)xnx0

for all xn. (Why? Consider the cases f(xn)=f(x0) and f(xn)f(x0) separately.)

Differentiability of g at f(x0) says that if (yn)n=1 is a sequence taking values in Y{y0} that converges to f(x0), then g(yn)g(f(x0))ynf(x0)g(f(x0)) as n. What if (yn)n=1 is instead a sequence taking values in Y? Then we can say ϕ(yn)g(f(x0)) as n. To show this, let ϵ>0.

Now we can find N1 such that for all nN, if ynf(x0), then |ϕ(yn)g(f(x0))|=|g(yn)g(f(x0))ynf(x0)g(f(x0))|ϵ. (TODO: I think here we need to break off into two cases: one where there's an infinite number of yn such that ynf(x0), and one where there's only a finite number so that eventually the sequence is all just yn=f(x0). Only in the former case can we find N, by considering the subsequence that isn't equal to f(x0), but this is not a problem because in the latter case the sequence's tail is already at the place where we need it to be, so we don't even need to find N. The question is, is there some more elegant way to do this that doesn't break off into cases?)

But this means if nN, then we have two cases: either ynY and ynf(x0), in which case |ϕ(yn)g(f(x0))|ϵ as above, or else yn=f(x0), in which case ϕ(yn)=g(f(x0)) so |ϕ(y)g(f(x0))|=0ϵ.

Differentiability of f at x0 implies continuity of f at x0, so this means that f(xn)f(x0) as n. Since f(xn)Y for each n1, we can use (f(xn))n=1 as our sequence in Y to conclude that as n we have ϕ(f(xn))g(f(x0)).

Now by the limit laws

limng(f(xn))g(f(x0))xnx0=(limnϕ(f(xn)))(limnf(xn)f(x0)xnx0)=g'(f(x0))f'(x0)

Since the sequence (xn)n=1 was arbitrary, we can conclude that limxx0;xX{x0}g(f(x))g(f(x0))xx0=g(f(x0))f(x0).

g(f(xn))g(f(x0))f(xn)f(x0)g(f(x0))

TODO: Tao says that division by zero occurs when f(x0)=0, which seems strange to me.