Friday, December 12, 2014

Basic Physics: Part 0, Section 5: Derivatives--Exponential Function

In the last post we covered all the rules we needed for calculating derivatives, but I mentioned that there were two special case functions that weren't really special cases that we needed to cover. They are usually thought of as special cases because the way we habitually use and write them hides what's actually going on when we take their derivatives. The first case is the exponential function, and the second is the trig functions sine and cosine. 

The exponential function is something you may or may not have run across directly, depending on how far you got in math or how nerdy your friends are. But it affects or models nearly everything in your life, from population growth to radioactive decay, and is integral to oscillatory functions and nearly every branch of mathematically describable knowledge. The 'natural' number \(e\) is a transcendental number (meaning it's not the root of any integer polynomial) and it's irrational--meaning it never repeats a sequence and it doesn't 
end:
 $$ e = 2.718281828459045235360287471352662497757247093699959574966967... $$ More importantly, it seems to be kinda built into the fabric of the universe because like \(\pi\) it shows up everywhere. Also, it is integral to one of the most beautiful equations in ever--Euler's Identity: $$e^{i \pi} + 1 = 0$$ What's so special about this you ask? Well, it includes 5 of the most basic and important concepts in math and relates them all in an absurdly simple, beautiful way*. The natural number (\(e\)), \(\pi\) and the complex number \(i\) are the most important numbers you've never heard of or used. One and zero are so fundamental explaining why they are fundamental usually leads you in circles. It's also a bit off topic. Back to derivatives!

 The exponential function, the most basic form of which is $$ e^{x} $$ though you can put other stuff (sometimes a lot of stuff) in that exponent. It's usually cited as a special case for derivatives because if you write it the way most people do, it seems like it is it's own derivative:
$$f(x) = e^x$$
$$\frac{df}{dx}= e^x$$
which is weird and uncomfortable and shouldn't be, should it?

This seems to completely violate all the rules we set out, except that it actually follows all the rules and you can demonstrate it three ways. Firstly, if you have enough time and a graphing calculator capable of finding tangents to curves, you can manually (and tediously) show that \(e^x\) is a weird curve whose slope is described by itself. I'm going to skip this way.

Another way to go is to use the power series expansion. This way feels like cheating to me, because in the strictest sense of things, it's an approximation unless I expand the series to infinite terms, but it's also the clearest way for a lot of people.

Let's first start by discussing what a series expansion is. Have you ever wondered how mathematicians can calculate things like thousands of digits of Pi or the natural number when they aren't simple fractions? The answer is power series. Series let you expression something very very complicator or long in a compact format of a bunch of additions. The catch is that, unless you take it out to infinite terms, it's only an approximation. The good news is, you don't need to take it out to infinity for most intents and purposes, because you don't need an infinite amount of precision. You just need 5 or 10 or 100 decimal places worth of precision, which you can get with way less than infinite terms.

The power series expansion for \( e^x \) is
$$e^x = \sum_{n=0}^{\inf} \frac{x^n}{n!}$$
Which looks like a lot of gibberish, but is just mathematician shorthand for
$$e^x = 1 + \frac{x}{1} + \frac{x^2}{1*2} + \frac{x^3}{1*2*3}+\frac{x^4}{1*2*3*4}+....$$
and on and on forever. That ellipsis at the end indicates that it just keeps going like that.

Fortunately, this is something that we know how to deal with, using the rules we learned in section 4.
$$e^x = 1 + x + \frac{1}{2} x^2+ \frac{1}{6}x^3+\frac{1}{24}x^4+....$$
$$\frac{d}{dx} e^x = 0 + 1 + \frac{1}{2} x^1 * 2 +\frac{1}{6}x^2 *  3 + \frac{1}{24}x^3 * 4 + ...$$
$$\frac{d}{dx} e^x = 1 + x+\frac{1}{2}x^2 + \frac{1}{6}x^3  + ...$$

Which is right back where we started! This is a neat and useful property of the exponential function.

The third way is to engage a rule that we didn't discuss last time because it doesn't show up very much, but it's very similar to the chain rule--it's called the power rule and having shown I wasn't lying about the things in part 4, I hope you can just trust me on this one. It's a little messy at the beginning, but just hang with me until the end.

 The power rule goes like this. For a function that has the form of [constant] to the power of [function of variable], like \( f(x) = a^{u_x}\) where \(u_x\) just denotes that \(u\) is a function of \(x\) (yes, a function within a function, it's perfectly legal and it doesn't look as weird as it sounds when you say it out loud...er write it out verbally?), the derivative is
$$\frac{df}{dx} = a^{u_x} *\ln{a} * \frac{du}{dx} $$
Which...looks pretty awful, doesn't it? Just hang with me a little longer. Let's look at a test case. Let's let our \(f(x) = 3^{4x^2}\).
$$\frac{df}{dx} = 3^{4x^2} *\ln{3} * (4*2x) $$
$$\frac{df}{dx} =(8 x) (3^{4x^2}) *\ln{3}  $$
$$\frac{df}{dx} = 8x \ln{3} 3^{4x^2}$$

So, what happens when we apply this to \(e^x\)? Let's see:
$$\frac{d}{dx}(e^x) = e^x * \ln{e} *1$$
Now, the natural log (\(\ln\)) and the natural number are inverses of sorts, so \( \ln(e) =  1\). So that just leaves us with
$$\frac{d}{dx}(e^x) = e^x$$
A perfectly law abiding, if funky looking, function. In reality, it mainly looks weird when we take the derivative because we leave out that \( \ln{e} \) step. Think of it like how a native speaker will use contractions.

Let's test this out on a few more examples to get the hang of it. How about \( g(x) = e^{2x}\)?
$$\frac{dg}{dx} = e^{2x} * \frac{d}{dx} (2x)$$
$$\frac{dg}{dx} = e^{2x} * 2$$
$$\frac{dg}{dx} =2 e^{2x} $$

Still a little weird looking, but not bad from an execution standpoint. Let's do one more for practice.
$$h(x) = 3 e^{4x^2} $$
$$\frac{dh}{dx} = 3 e^{4x^2} * \frac{d}{dx}(4x^2) $$
$$\frac{dh}{dx} = 3 e^{4x^2} * 4*2*x$$
$$\frac{dh}{dx} = 24 x e^{4x^2} $$

Hopefully this has helped you to see that even things that are "special cases" are not exceptions to the rules. If anything is still unclear, please let me know in the comments! Next time, we'll deal with one more "special case", that of trig function derivatives.

*And one of the reasons I will never, ever support tau replacing pi. I don't care if it removes a factor of two from some calculations--it ruins the beauty of Euler's identity to have to divide the exponent by 2.

Updated 12/12/14 8 pm: Corrected the first example. Thanks to @Lacci for alerting me to the problem. 

No comments: