Whenever I get the opportunity to talk to someone about to go into calculus in school, I give them this calculus rant. It quickly goes through the main results of most of high school and early college math, from first principles. It's better than the usual presentation, in the sense that the usual presentation is presented as a bunch of unrelated facts that are later somehow magically related. This presentation goes through in a different order, defining everything in terms of things already known, so the relations follow by definition rather than by magic.

The Calculus Rant

Derivatives

Derivatives are the slope of a function at a particular point. You already know the slope of a line: (f(x2)-f(x))/(x2-x). If x2 = x+d, then (f(x2)-f(x))/(x2-x) = (f(x+d)-f(x))/(x+d-x) = (f(x+d)-f(x))/d. If you do that for a line, you get the same slope no matter which x and x2 you pick. If you do that for some other function f(), where f() is fairly smooth, then for any x, (f(x+d)-f(x))/d is always about the same value if d is small enough. That value is the slope of f() at x, and is also called the derivative of f() at x.

If you can calculate f(x), you can approximate the derivative with your calculator. Suppose the f(x) you are looking at is x3, and you want its derivative at 1. You can calculate that 1.13 = 1.331, 1.013 = 1.030301, 1.0013=1.003003001. And the corresponding slopes are f(1.1)-f(1)/.1 = 3.31, (f(1.01)-f(1))/.01 = 3.0301, (f(1.001)-f(1))/.001 = 3.003001. You can see the derivative at f(1) is probably 3.

One place derivatives are used in real life is in finding best answers: the minimum and maximum values of functions always have a slope of 0, meaning the derivatives there are 0. Solving for the roots of the derivatives tells you where to find the minimums and maximums of the original function. For example, the derivative of x3-3x is 3x2-3, so the minima and maxima of x3-3x are the roots of 3x2-3. Since 3x2-3 = 3(x+1)(x-1), the minima and maxima of x3-3x are at -1 and 1.

Derivatives and integrals of polynomials

Using algebra, you can find the exact derivative for any xn. You know (x+d)n = xn + nxn-1d + (n choose 2)xn-2d2 + (n choose 3)xn-3d3 et cetera. So the slope is going to be ((xn + nxn-1d + d2(stuff)) - xn)/d. The two xn cancel out. A d cancels out. That leaves nxn-1 + d*(stuff). For example the derivative of x3 is 3x2 + d*(3x + d). If d is small enough (a millionth, a trillionth), "stuff" can't matter, so you're left with nxn-1. The derivative of xn is nxn-1. That's the most important thing in calculus, at least half of its total worth to the rest of your life, so remember that.

An integral is the opposite of a derivative: since the derivative of x3 is 3x2, that tells you that the integral of 3x2 is x3. (Plus a constant. Since the derivative of every constant is 0, the integral of 0 can be any constant.) What's the integral of x2? Using algebra, it's x3/3 (plus a constant). The integral of xn is xn+1/(n+1) (plus a constant). The derivative of the integral of f(x) is f(x). The integral of the derivative of f(x) is f(x) (plus a constant).

A polynomial is a sum of powers of x, like x3 + 4x2 + 3. The derivative of the whole is the sum of the derivatives of each of the terms, like in this case 3x2 + 8x + 0. The integral of the whole is the sum of the integrals of each of the terms (plus a constant).

The reason this is so useful is that any smooth function can be split into pieces, and you can approximate each piece with a polynomial. The derivative of the function is then approximated by the derivatives of the polynomials for each piece, and the integral of the function is approximated by the integrals of the polynomials for each piece. Since you know how to do derivatives and integrals of polynomials, you know how to approximate derivates and integrals of everything.

e

Define e(x) as the function where e(0) = 1 and the derivative at e(x) is e(x).You recall ex? It turns out e(x) is ex, the derivative of ex is ex, and the integral of ex is ex (plus a constant).

You can approximate any function with polynomials, so let's approximate e(x) near 0 with some polynomial. What's that polynomial?

That tells you that e(x) = 1 + x + x2/2 + x3/6 + x4/24 + x5/120 + x6/760 + x7/5040 + etc. If e(x) really is an exponential, it also defines e as e = e1 = e(1) = 1 + 1 + 1/2 + 1/6 + 1/24 + 1/120 + 1/760 + 1/5040 + etc. That happens to come out to e = 2.71828... . (Todo: show e(x) is actually ex.) This polynomial approximation is how computers really go about calculating ex: they have to keep adding terms to the sum until the remaining terms are smaller than the desired precision. The later terms always get small enough eventually. That's because n! eventually grows faster than xn. But terms get small fastest when x is near 0. So computers use more math to make it go faster, for example they use ex+1 = e*ex to choose an x near 0.

Complex numbers, Cosine, and Sine

You know the real numbers, like -0.123, and square roots. And you know there is no real-number square root of negative numbers.

Define i to be the square root of -1. There is no real-number square root of -1, so i is some other type of number, call it an imaginary number. i2 = -1, i3 = -i, and i4 = 1. Multiplying i by a real-numbered coefficient gives you more imaginary numbers, like -0.123i. A complex number is any sum of a real number and imaginary number, for example 1.2, -3.4i, or 5 + 6.7i. You can draw complex numbers on a graph, using the real component for x (horizontal) and the imaginary component for y (vertical).

What is the polynomial approximation of ebi? Remember that i2 = -1, and plug bi into the polynomial appromation of e(x): 1 + bi - b2/2 - b3i/6 + b4/24 + b5i/120 - b6/720 - b7i/5040 + etc.

You can define sin(b) and cos(b) (b in radians) this way: ebi = cos(b) + isin(b). (So far sine and cosine are just some defined functions.) If you plot ebi on a graph, it forms a circle of radius 1 around the origin, with cos(b) as the real coordinate and sin(b) as the imaginary coordinate. π is defined as the smallest positive real number where eπi = -1. That happens to come out to π = 3.14159... . Note eπi/2 = i, eπi = -1, ei/2 = -i, and ei = 1, matching what the powers of i should be.

You can separate the terms of ebi into imaginary numbers (multiplied by i) and real numbers (not multiplied by i): ebi = (1 - b2/2 + b4/24 - b6/720) + ...) + i(b - b3/6 + b5/120 - b7/5040 + ...). Every even term is real, every odd term is imaginary. This gives you a way to calculate sine and cosine with polynomials, rather than using the trigonometry buttons on your calculator:

This is how computers really go about calculating sine and cosine. They add terms until the remaining terms are too small to matter for the desired precision. Well OK they make use of some trigonometric identities too so that b is close to 0, but it's basically this.

It also tells you what the derivative of sine and cosine are. Look at the polynomial approximation of sine, take its derivative, and compare the result to the polynomial approximation of cosine. The derivative of sin(x) is cos(x), and the derivative of cos(x) is -sin(x). This isn't a coincidence: it has to be that way because e(x) was defined based on being its own derivative.

Exponentials of complex numbers are always complex numbers: ea+bi = eaebi = ea(cos(b)+isin(b)).

You can square those series above to see what cos2(b) and sin2(b) actually are:

From that, it is clear that cos2(b) + sin2(b) = 1 for all b, because the bn terms of cos2(b) and sin2(b) all cancel out except for the b0 term, which is 1 for cosine and 0 for sine. Since a circle of radius 1 centered on the origin is defined as the set of points where x2+y2 = 1, this shows that ebi really does form a unit circle centered on the origin. (Todo: show that ebi progresses around the circle at a steady rate.) You can also tell by inspecting the series that cos2(b) = (1 + cos(2b))/2, and sin2(b) = (1 - cos(2b))/2.

Interpolation (actually calculating sine)
Linear regression (it uses derivatives)
Table of Contents