Calculus You Forgot (Or Never Learned): Derivatives

Intuitive ideas about the derivative

Calculus You Forgot (Or Never Learned): Derivatives
Photo by Andrea Piacquadio from Pexels

If you went to college, it is a fair bet that you took some sort of calculus class. If you went for engineering or science, you probably took a LOT of calculus classes. Unfortunately, a lot of math teachers like to show you how smart they are and they make simple ideas pretty hard to understand. Plus, in school you have a lot of things — both academic and non-academic — competing for your attention. So it isn’t surprising that a lot of people don’t have an intuitive grasp of some calculus ideas. Sometimes, I think some of the professors don’t either and that’s part of the problem. It is one thing to know the notes on each piano key and another thing to be able to play the piano.

What is Calculus?

So what is calculus? Easy answer: it is the mathematics of change. Regular math lets us answer questions like “Which rug is larger?” or “How many eggs do we need every day to feed a certain number of people?” Algebra answers questions like “If we earn 8% interest on a bank account and after a year we have $1122, how much money did we start with?” Geometry and trigonometry answer questions about shapes and angles. Calculus answers questions about change.

Examples of questions you might answer with calculus are: If a pipe develops a 1mm leak that doubles in size every hour, how long does it take to empty a 300-gallon tank? Or, if a hockey stick snaps off the ice according to a math formula, what is the maximum acceleration it will sustain?

If you want to deal with stock or option trades, write amazing real-world computer simulations in 3D, or build skyscrapers, you are probably going to need calculus at some point. Good thing it isn’t as hard as people say.

What is a Derivative?

A derivative is simply the rate of change of something. That’s all it is. A ball standing still or a hose with the water faucet off all have a formula that describes them and the derivative of that formula is zero. Because they are not changing.

Sometimes, we really want to know about the actual rate of change. How fast is a rocket accelerating after its engine is on for 3 seconds? But sometimes we want to know the sign of the rate of change. For example, if we have a formula that approximates the cost of soybeans, we will note that the rate of change is positive when the price is going up, negative when it is going down, and zero at places where it changes from plus to minus or vice versa. Those zero points will be the minimum and maximum price of soybeans, at least according to our model.

So this is a useful math trick. When I was a student, I used to think “How did Newton and Libnietz figure this s*** out from scratch? Crazy!” But now I see that it is actually really simple if you want to ask those kinds of questions that you would work out this kind of math. We are going to work it out, probably like they did.

Start Simple

Let’s say we have a function f(x)=4. That means that any value of x you plug in, the answer is 4. This could be a math model for a ball sitting 4 meters off the ground on the floor of a big building. At time 0, the position is 4 meters. At time 1,000 the position is… 4 meters. It isn’t moving.

What’s the rate of change? Zero. The same goes for f(x)=20. Or f(x)=1000. No change based on x so therefore the rate of change — and, thus, the derivative is zero. Graphically, that looks like this:

f(x)=4 is boring

More Interesting

Look at this graph:

f(x)=4x

This is a bit more interesting. It is a line. You might remember that a line is y=mx+b where m is the slope and b is the y-intercept. In this case, b=0 and you can see that m=4, so the slope is 4. For a line, though, the slope is the rate of change. that is at every point on the line, a change in x of 1 will cause a change in y of 4 in the same direction.

If you didn’t know the formula for this line, you could compute the slope by measuring the rise over the run. What this means is you pick some run — a pair of x values. Find the y values for those two x’s. The difference in x values is the run and the difference in y values is the rise. The rise divided by the run is the slope.

So if we pick x=0 and x=1, we see that f(0)=0 and f(1)=4. So the run is 1–0 or 1. The rise is 4–0 or 4. The rise over the run is 4/1 = 4. Same result. But it doesn’t matter what numbers we pick. Since f(1)=4 and f(11)=44 we can see that for a run of 11–1=10 we have a rise of 44–4=40 and 40/10 is… 4. You can do that with any two numbers you care to name. It also would not matter if we added an offset because that won’t change the slope:

f(x)=4x+3

If you do the same math, the +3 term will cancel out when you subtract and so the slope of this line is still 4.

Since we can use any number we like as the difference in x — delta x, or we will call it d, we could write a formula:

slope = ((f(x+d)-f(x))/d

This is just what we did for x=0,1 or x=1,11, just written as a formula. No matter what d is, we get 4 for our example. So what if d were the smallest number we could have without being 0 (because, after all, we can’t divide by zero)? I don’t mean like 0.1, or 0.01, or even 0.001. I mean millions and millions of zeros followed by a 1. Such a small quantity won’t matter, but the answer will still come out to 4.

So let’s plug into our formula that f(x)=4x+3:

slope = (((4(x+d)+3)-(4x+3))/d
= (4x+4d+3–4x-3)/d
= 4d/d
= 4

That gives us a lot of confidence that our original formula, ((f(x+d)-f(x))/d is correct. It makes sense and it gives us an answer we know to be correct.

Double-Check

We know that the derivative of f(x)=10 is zero. If you think about it, it is really the formula where y=mx+b has values of m=0, b=10. Let’s try our formula there:

derivative=(10-10)/d 
= 0/d
= 0

Keep in mind that f(x+d)=10 not 10+d. So our formula still works.

Taking it to the Limit

In math, there’s the idea of taking a limit as something approaches something else. So, for example, if I told you g(x)=5/x, then x can’t be zero. But it can approach zero and as it does the result will be bigger and bigger. So 5/1=5 but 5/.1=50 and 5/.001 = 5000. So we would say the limit of 5/x as x approaches zero is infinity.

This can be a problem if you wind up with a result from the formula like 10/d. We have not seen that yet, but if we had, the answer to that is infinity because we are really taking the limit of the formula when d approaches zero. In most problems, the d part works itself out, but if we add or subtract d, it is so small we can ignore it. If we multiply by d, we can treat the result as zero. If we divide by d, treat the result as infinite.

Next Step

This all seems like a lot of work just to find the slope of a line. It is. But we can now take this formula and apply it to other functions and we have some confidence it will give us the rate of change at some value x, too. With a line, the rate of change never changes. But think about the function f(x)=x².

f(x)=x²

If you were going to try to approximate this curve using straight lines, you could say, well, from 0 to 1 the result is 0 and 1, so we can draw line with slope 1 for that part. From 1 to 2 the result is 2 and 4. That’s a rise/run of 2. Then from 2 to 3, the result is 4 and 9. That’s a slope of 5. If you looked at the negative x values, it would be the same but negative (that is, from -1 to 0 is a slope of -1).

Now if you did it from 0 to 0.1 and 0.1 to 0.2 you’d get a better approximation. If you did it from 0 to 0.01 and 0.01 to 0.02, it would be even better (but would take a long time).

Our formula should be able to tell us the rate of change between any x and an infinitely small increase from x. A rocket ship’s position between now and the infinitely tiny next time period is its acceleration, for example. We can also tell some things by looking at the slope. If I told you I took the derivative of f(x) at -1 and the slope was negative you could tell me that the line is descending at that point (look at the graph; it is). If I told you the derivative was positive, you know the line is going upwards. But if I told you the slope was negative, went to zero (at x=0), and then started going positive you would know the curve hits bottom at x=0. What if I told you the slope was positive, zero, then negative (it isn’t, but pretend).

That would mean you’d hit a peak, right? So if you have the math that describes, say, the price of some good based on input factors, you could use this to determine when the price is going to be lowest and when it is going to be highest.

We won’t try this function but imagine trying to work with sin(x)+(1/3 sin(3x))+1/5:

Lots of slope changes, peaks, and valleys. You can find them all using derivatives.

Rewind

Let’s go back to f(x)=x².

Here is a plot that includes a tangent line at x=0.25. The slope of that line is the rate of change at that point, just like if we were approximating with a straight line that was infinitely tiny. That slope is also the derivative of the function at x=0.25. You can see the slope is positive at that point; the line is lower on the left than it is on the right.

Red dot at x=0.25

Here’s the tangent line at x=-0.5:

Red dot at x=-0.5

Here the slope is negative. We can find the slopes of these lines using our formula.

f(x)=x²
=(f(x+d)-f(x))/d
=((x+d)²-x²)/d
=(x²+2xd+d²-x²)/d
=2xd/d
=2x

So if x=0.25, the slope of the tangent line, and thus the derivative, is 2*0.25 or 0.5. At x=-0.5 we get -1.

Just like with the line, adding a constant won’t matter. So if you plotted x²+10 or x²-33 you’d get the same answer. The derivative is 2x.

Knowing this, it is easy to ask where is 2x=0? That happens at 0 and that’s where the minimum is. Is there any place the slope changes from positive to negative? No. So this curve has no peaks.

In Real Life

You know that multiplying 4 x 5 is the same as saying 5+5+5+5, right? But no one really does it that way. Derivatives are the same. All the common cases are worked out and you either remember it or you look it up in a table. A lot of practical calculus is trying to rearrange things to look like a combination of things you can look up in a table.

There are also rules about how to combine things. So, for example, we know how to find the derivative of a square and a straight line, so what if we had:

f(x)=4x²+10x-3

We can show that a constant multiplication also affects the derivative, so the derivative of 4x² is 4(2x) = 8x. We know the derivative of 10x is 10. And the -3 doesn’t matter because the derivative is zero.

So f’(x) (a common way to write the derivative of a function) is 8x+10. The situation is more complex if you multiply things together or use trig functions, etc. But you can look up the rules for those very easily.

If you aren’t sure that the derivative of 4x² is the same as 4 times the derivative of x², consider this:

4x²=x²+x²+x²+x²

You can also convince yourself that if the derivative of, say, 10x is 10, 8x is 8, and 2x=2, then:

f(x)=10x
g(x)=8x
h(x)=2x
f(x)=g(x)+h(x)
f’(x)=g’(x)+h’(x) we want to know if this is true
10 = 8 + 2 yep, it is true!

Again, you can look up these rules instead of working them out each time. For example, here is a good set of rules: https://en.wikibooks.org/wiki/Calculus/Tables_of_Derivatives

Keep in mind that instead of writing f’(x), you may also see something like:

d/dx x²

That’s just another way of saying take the derivative of x².

If you want some practice problems, this site will make some up and check your work: https://homepages.bluffton.edu/~nesterd/apps/derivs.html

Of course, Wolfram Alpha is great and I used it to produce the graphs in this post. However, to get the full step-by-step results, you have to pay. A nice option that is free is from Microsoft. It will give you the answer, but also has a button that will reveal the work step by step:

Microsoft Math Solver shows its work

Wrap Up

I hope this has given you a better feeling for why we want to do derivatives and that the underlying concepts are pretty easy. Of course, it is easy to learn how to play tennis. It is hard to become Venus Williams. Some math problems are going to be hard for one reason or another. That’s why the pros practice, practice, practice.