Tuesday, January 28, 2014

Calculus review: derivatives

In the excellent novel The Poisonwood Bible, the self-taught main character says that "Calculus is the mathematics of change."  Heraclitus, an ancient Greek philosopher, wrote that "Change is the only constant," (and has been unwittingly quoted by many motivational speakers since), and so calculus is ubiquitous in mathematical descriptions of nature.  Calculus intrinsically is neither easy nor hard: it's just a language---becoming fluent requires practice.  The focus of this course will be to do things in the least mathematical way possible, so don't get too stressed about calculus, but it is a good thing to have in one's toolkit moving forwards.

Derivatives
A derivative just describes how much one quantity changes as you vary another quantity that it depends on.  Graphically, if you have a curve, the derivative at a point gives the slope of the line touching the curve (tangent) at that point.  Here we'll just describe how to compute most of the cases you'll ever need.

Formula
$$\frac{d}{dx}x^n=nx^{n-1}$$
Proof
Use definition of derivative as the limit of a difference:
$$\frac{d}{dx}x^n=\lim_{\Delta x\to 0}\frac{(x+\Delta x)^n-x^n}{\Delta x}.$$
Since we are taking the limit as $$\Delta x\to 0,$$ we can treat it as very small compared to $$x,$$ and rewrite the above as
$$\lim_{\Delta x\to 0}\frac{x^n(1+\Delta x/x)^n-x^n}{\Delta x}\approx \lim_{\Delta x\to 0}\frac{n x^n\Delta x/x}{\Delta x}$$
$$=nx^{n-1}.$$

The approximate equality comes from using the "most useful approximation ever" we showed in the Basic Math Review:
$$\big[1+\epsilon\big]^n\approx 1+n\epsilon.$$

Formula
$$\frac{d}{dx}e^x=e^x$$
Proof
Write
$$e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!}$$ and differentiate each term using the previous formula to find
$$\frac{d}{dx}e^x=\sum_{n=1}^{\infty}\frac{x^{n-1}}{(n-1)!}+0$$
where the 0 comes from the $$n=0$$ term in the original series, which has derivative zero.
Then re-index the sum to again start at 0, by transforming $$n-1\;\rm{to}\;n.$$  The result then follows.

Note: the formula for e as a sum above is super-useful! 
It immediately gives you the approximation for e at small x by just dropping terms that are quadratic or above in x:
$$e^x\approx 1+x$$
as well as an approximation for $$\ln\big[1+x\big]$$
by taking the natural log of both sides of $$e^x\approx 1+x$$
to get
$$x\approx \ln\big[1+x\big]$$ for small x.

Incidentally, the series for e can also be used, by comparison with the series expansions for sine and cosine, to prove Euler's formula! (substitute in $$x=i\theta$$ and just algebra it out!)

Chain Rule
A very useful way to do derivatives of compositions of functions.  What is a composition of functions?  Well, $$\big[1+x\big]^2$$ is one example!  Inside the brackets, you take x to 1+x.  That's one function:
$$f(x)=1+x.$$  Then outside the brackets, you take that function, f, to its square: $$g(f)=f^2.$$
So we can write the initial expression as g of f.  What if we want to do the derivative of something of that form?  It is
$$\frac{d}{dx}\big[g\circ f\big]=\frac{dg}{df}\frac{df}{dx}$$
An easy way to remember this is to imagine the df's canceling out, much like how one would write out unit conversions, e.g. meters to feet as $$1\; \rm{m} \times \frac{3\;\rm{ft}}{\rm{m}}=3\;\rm{ft}.$$  We won't prove this formula here---maybe you can think of a proof!

Formula
$$\frac{d\ln x}{dx}=\frac{1}{x}$$
Proof
Write x as
$$x=e^{\ln x},$$ which is true by the definition of ln.  Then differentiate both sides, using Chain Rule for the righthand side:
$$1=e^{\ln x}\frac{d\ln x}{dx}.$$
Then simplify using that $$e^{\ln x}=x,$$ and divide both sides by x:
$$\frac{1}{x}=\frac{d\ln x}{dx}.$$

Formula
$$\frac{d\sin x}{dx}=\cos x,\;\frac{d\cos x}{dx}=-\sin x.$$
Proof
Use Euler's formula to write sin and cos as complex exponentials.
Then
$$\frac{d\sin x}{dx}=\frac{d}{dx}\bigg(\frac{1}{2i}\big[e^{ix}-e^{-ix}\big]\bigg)=\frac{1}{2i}\big[ie^{ix}+ie^{-ix}\big].$$
The second equality above is using Chain Rule to differentiate $$e^{ix}.$$
Simplifying the righthand side, we have
$$\frac{1}{2}\big[e^{ix}+e^{-ix}\big]=\cos x.$$
It's nearly the same to compute the derivative of cos: try it for yourself!


No comments:

Post a Comment