# Derivatives

The derivative of a function gives its instantaneous rate of change at any point. This is analogous to the slope of a line parallel to the function there, which, together with the concept of limits, formulate the definition of the derivative: $$f'(x) = \lim_{h \to 0}\frac{f(x+h) - f(x)}{h}$$ ## Intro

During the COVID-19 pandemic, many countries adopted the flattening the curve strategy.

The goal was to slow the spread of the illness, so the public healthcare system wouldn't collapse.

Public healthcare officials put the spread of COVID-19 on the -axis and the time on the -axis to get a feel for how quickly the illness spread.

All of a sudden, people grew obsessed with curves and rates of change!

## Concept

The strategy, flattening the curve, is all about decreasing the derivative.

The derivative is a measure of how quickly a function increases or decreases at a given point. If the derivative is small at some specific point, that means that the function doesn't change much there.

It can also be thought of as the slope of the tangent at that point.

The derivative gives the slope of a function at a particular point  ## Math

To calculate the derivative, imagine taking a tiny step in the direction. The function value will then change by some value , which can be positive, negative or . The slope is given by the ratio of our change in the direction over our step in the direction, . Thus, the derivative may be thought of as the rise over run for a tiny run.

## Definition of the derivative

As you're sitting on a flight, you're struck by how fast airplanes are, right? Indeed, the steward says you're moving at something like km/h.

But obviously, the plane doesn't advance at a constant speed. If there's a strong gust of wind, you might move forward at km/h.

The derivative, denoted by this funny symbol , lets us find the velocity at given time. So if is your position as a function of time, then is your speed.

And since you're moving so quickly, your position changes a lot in a small time interval. This means that is huge.

### Calculating derivatives

The way we go about finding the derivative actually resembles the way we calculate velocity.

To calculate the velocity, we'll focus our attention on a small time interval . The velocity, then, is simply the distance divided by the time,

You may actually think of the derivative as the function value of the velocity, the speed at which the function value changes. Imagine standing on the axis, and then taking a tiny step to the right. We call the step . This causes a change in the function value, which turns into . The change in the function value is:

But it wouldn't make sense to only measure the value , since it depends on the size of . To account for the size of , let's divide by .

If is small, so is , but it's compensated by the division with .

This thing describes the rate of change within a tiny interval, from to . It's our

However, we want to compute the rate of change at a particular point, not within an interval.

Provided that is defined on an interval around , the derivative of in the point is

and is written as .

A word of warning. Remember that is a regular number, not . That's why the computation above works out.

## Differentiable functions

To differentiate a function at a point is to find the derivative, or the slope, of the function at that point.

What we'd like to do is to define a function mapping each point in the domain of to its derivative. We call the derivative function of .

This is not always possible, since a function may not have a slope at every point. When this happens, the derivative does not exist, and we say that the function is not differentiable.

A differentiable function is a function whose derivative exists at each point in its domain

Have a look at these two curves:

1. 2. They share their general shape, but while the first one is differentiable at the top, the second one is not.

Recall the definition of the derivative:

For this limit, and hence the derivative, to exist at a point , the limit of the derivative function must be the same as approaches from both above and below:

Now that we understand what it mean for a function to be differentiable at a point, let's look at what makes a function differentiable in general:

Let be a real-valued function. Then is differentiable if and only if its derivative exist at each point in its domain.

To enhance our understanding of differentiability, let's turn to some examples of real-valued functions:

First, look at: Whatever point we look at, we can find the derivative of the function, so this is an example of a differentiable function.

As an example of a non-differentiable function, have a look at this one: The function can also be defined piece-wise as:

If we take the limit of as approaches from above, we get , the slope of the right line.

Similarly, by taking the limit of as approaches from below, we get , the slope of the left line.

Then:

we conclude that the derivative does not exist at . This one point is enough to make a non-differentiable function.

As a closing remark, differentiability is connected to continuity in the way that if a function is not continuous on an interval, it will not be differentiable on that interval.

The opposite is not always true though. As we saw in the example of , a function can be continuous on its full domain yet non-differentiable.

## Higher order derivatives

### Second derivative

If a function is differentiable, its derivative will be another function . Now who's to say that we cannot take the derivative of ?

As long as is differentiable as well, we can take the derivative to produce , known as the second derivative of .

If we let be the position of an airplane as a function of time, its derivative will be the airplane's velocity at any time.

Acceleration is the derivative of the velocity, and the second derivative of the position

Now the derivative of , which is the derivative of the velocity function and the second derivative of the position function, produces a function of the acceleration of the airplane.

### Higher order derivatives

The derivative can be found for any differentiable function, and so there is no limit to how many derivatives we can take as long as the differentiability property persists.

There is, however, a limit to how many prime symbols we put after the , if is the function we are differentiating.

The third derivative is generally denoted as but for any derivatives of higher order than so, we start using the order number, put in a parenthesis.

Hence, the fourth derivative of becomes , the fifth will be , and so on.

## Tangent lines

Say you want to do a mental calculation of . Kind of hard, eh?

However, using calculus, we can find a reasonable approximation.

Take a moment to think about the graph of . We know that . Then we take a tiny step, , in the direction. This brings about a change in the direction.

For values near we could approximate by drawing a straight line through the point , which is the point , with the same slope as . This kind of line, which just touches the function graph at a given point, is called a tangent line.

The tangent line just touches the function graph at a given point

How can we find the tangent line?

The generic recipe for a line is

where is the slope and is some constant.

If the slope of the line should align with the slope of the graph, must equal the derivative of at .

Let's go ahead and calculate . The derivative of happens to be , and . This means that .

Moreover, we want our line to touch in the point . Plugging in and into our recipe for a straight line, we get:

This means that .

Given that is close to . Evaluating in will give a good estimate of . Thus:

My calculator says that , so we did quite well.

This hack is known as linear approximation.

## Differentials and Leibniz's notation

### Differentials

When talking about the derivative, we keep mentioning tiny changes. As changes a tiny bit, what happens to ?

However fluffy it may sound, there is actually mathematical notation for describing infinitesimal changes in a quantity. We call them differentials.

The rigorous definition is buried under a large pile of theory far outside our scope. But, fortunately, the informal definition is almost always good enough.

The differential of a variable is denoted , and it can be defined informally as follows:

is a small change in , even smaller than any real number.

The main concern with this definition is that real numbers can be arbitrarily small, which makes it doubtful whether differentials exist or not. Still, it proves extremely useful to just accept them as some really tiny change.

A differential represents a tiny change in some quantity

Analogously, if our variable is time, denoted , then the differential would be . This refers to a very small time interval. We can also use it for functions: given a function , the corresponding differential would be .

If confronted with an equation containing differentials, one may treat the differential as a regular variable. For example, we can add, multiply and divide with differentials.

### Leibniz's Notation

So far, given a function , we have referred to its derivative as . Leibniz's notation introduces a new way of writing derivatives.

Let . Then, is the tiny change in , as changes with a tiny quantity . Written with Leibniz's notation, the derivative of is:

As with the definition of the derivative using limits, we don't mean to divide by , only to compare them.

Note that this is just a new way of writing. So:

But why do we want this?

Well, Leibniz's notation makes it possible to separate the from the . That may seem dodgy, but it will turn out to be incredibly useful for solving certain types of equations.  