# Caclulus is easy

# Table of Contents

- Table of Contents
- Function of a line
- Weird looking graphs
- Now we want to find a gradient
- Limits
- Differentiating Functions
- To my classmates
- Recap
- Turning Points, Second Derivative, Maxima and Minima Values
- Second Derivative
- Revisiting Maxima and Minima
- Antiderivative
- Connect with me

In this guide I attempt to distill university level calculus at a very basic level to allow as many people as possible to understand and love calculus.

Calculus is the mathematics of continuous change. That’s so cool. Do you know how many things continually change? Cars, aeroplanes, bikes, mouths, transactions, vocal tones, cooking. Continuous change is literally almost everything in this world and there is some beautiful mathematics to describe continuous change. If you understand calculus, even at a simple level you will understand some amazing topics.

There are some things you need to know before we go into calculus. You need to know function TK and some basic algebra.

# Function of a line

So we all know what functions are, but functions of a line?

Well as it turns out all functions can be represented as a line. If all functions can be represented as a line than can all lines be represented as a function? Yes! And in this section we try to work out what that function is.

To work out the function of a line you need to find out how steep the line is, y, and find out what point should be on the line when x = 0, we’ll call this c.

This gives us the formula:

## Gradience

We can find the gradient using this formula:

Or in other words

How much Y should change relative to how much X has changed.

In order to use this formula, we need to know 2 points on the line. The two points are represented as

## Finding the offset

So we already know some facts:

<0, c> is on the line but we don’t know where.

is on the line

We know line has gradient M

We know this gradient does not change, as it is a line.

So the gradient from <0, c> to <x1, y1> is the same as the gradient from <x1, y1> to <x2, y2>

In other words, C must be (when x = 0)

# Weird looking graphs

Let’s say you have a graph that looks like this:

How do you calculate the line function of that graph?

We start with some function, we’ll call it F(x)

We choose two places, x = a and x = b and find the values of F(a) and F(b)

Then we use the line connecting <a, F(a)> to <b, F(b)> to “reason about” F(x).

If we use this method we can approximate lines like so:

The line joining <−10,F(−10)> to <5,F(5)> doesn’t seem to tell us much about F(x).

Well, that’s a bit rubbish isn’t it?

The line doesn’t tell us anything about the function.

What we’re seeking is how F(x) (the curve) behaves as a line when x = 5.

The “closer” <x,x2> is to <5,25> the “better” the quality of information the line between the two points provides about the gradient of the “line touching” the curve at <5,25>. But we cannot use the line from <5,25> to <5,25> itself because if you attempt to calculate the gradient of this line the gradient will be 0.

We want to know what’s going on at the point <5,25>. We look at the line between <5,25> and <x,x2> with x getting “close to” 5: That is, set x= 5 +d and let d become “very very small”.[In general for a point (<x,x^2>) we look at points (<x+d,(x+d)^2>)].

In other words, we take the original equation and we multiply each component by d (but we do not let d = 0) so the second equation gets “closer and closer to” the original without them ever becoming the same equation.

We do this because we cannot reason the equation of a graph that looks like (X^2). Okay, professional hat off. We cannot reason the equation of some whacky out of this world graph with lines going which way and every where all at once, so we use a normal line to attempt to represent these weird looking graphs.

Even then we cannot reason about the whole graph, only on the information of a part of a line that is touching the curve.

# Now we want to find a gradient

We want to find the gradient of the line joining <5, 25> to (<5 + d, (5 + d)^2>). Earlier we learnt that for any 2 points in a plane (the graph) there exists a unique line connecting these 2 points and the line (<5 + d, (5 + d)^2>) is a point that is ever so close to the original point.

And with a bit of rearranging we get

So we know that the nearer d gets to 0, the nearer the line gets to 10. This is simply seen in the equation (10 + d). If d was 1, the line would be at 11. But obviously d is very very small. Minute, almost. If d gets smaller and smaller than the line touching the curve gets closer and closer.

Let’s try another example.

Let’s say we have 2 points:

.

The gradient formula for any line is

And we know for a fact that there is always a unique line between 2 points.

Then we can use the gradient formula to work it out.

The gradient of the line touching on the curve approaches the value 2x, but it never becomes 2x because of the value d (where d can never be 0). The idea is to learn something about a curve by creating a straight line that gets ever so slightly close to a point on the curve without ever touching the exact point on the curve.

We do this because it’s easier to reason about straight lines than it is to reason about curved lines.

I highly suggest taking the two points and trying to find the gradient yourself using the formula

# Limits

The gradient of the line touching the point (<x,x^2>) on the curve (f(x) = x^2) is ‘best described by’ the value of the function f(x) = 2x

Or in other words:

The term (\lim_{d \to 0) is just like our notation of choosing a point (<x+d, (x+d)^2>) “closer and closer” to our original point (<x, x^2>). Letting d become as close to (without reaching) 0.

This is referred to as a “limit”.

# Differentiating Functions

For a function the notion of:

“the function for the gradient of the line touching the point <x, f(x)>” is referred to as the

first derivativeof the function f(x).

So previously we have seen how to calculate the gradient of a line with 2 points, but now we want to calculate the gradient of a line touching an x coordinate that is also touching the line function f(x).

The formula to calculate that f’(x)=2x for (f(x) = x^2) can be rewritten to be used by any function like so:

If you look, you’ll notice it’s very very similar to what we were playing with earlier. Limits are extremely useful because it’s like saying “ignoring what happens when we get there, look at what happens as we approach there”.

When “we get there” the equation becomes 0 / 0, and you never want to divide anything by 0, yet alone 0 divided by 0. But, on the way there we can see some cool things. Like the closer we get to 0, the more and more a function reaches the number 2. So you would expect that when we reach 0, the function hits the number 2. But because of the whole 0 divided by 0 thing we can’t actually just calculate that straight off the bat.

# To my classmates

Luckily Paul said you don’t need to know any of this, just the general “how to do it”, not any specifics. The derivatives of functions have already been found. In the exam you will be provided with a table that shows you the answers to any questions like these. See slide 29 of 3rd powerpoint on his website for this table.

You do *not* need to memorise these tools. You only need to *learn how to use them*.

In short, you make a line that gets “closer and closer” to a curve without ever reaching the same coordinates of the curve. Over time you’ll start to see the line getting “closer and closer” to an arbitrary value, that value will be the first derivative.

# Recap

The first derivative f’(x) of a function f(x) describes the *gradient* of the line touching the point <x, f(x)> for (the graph or plot of) the function f(x).

f’(x) is itself a function. The first derivative is a function.

The idea of a first derivative raises an extraordinary question. If there is a first, there has to be a second, right?

# Turning Points, Second Derivative, Maxima and Minima Values

The line with gradient 0 touches the curve f(x) = x^2 at <0, 0>.

When x < 0 all lines touching <x, x^2> have negative gradients.

When x > 0, all lines touching <x, x^2> have positive gradients.

When x = 0 the curve is at a *turning point*. It’s value is a minimum.

So in this image we have 2 functions. One function is a fancy (f(x) = x^2) and the other function is a straight line ((2*c)x - (c*c)).

The value c changes from 5 all the way through to -5. When the gradient of this second line is positive (where m > 0) all the lines (that’s every single possible gradience from 0 through to 10) which are touching the curve at (x, x^2) are positive (they’re above 0) and every similar line that has a negative gradience is negative (below 0). The line at exactly 0 gradience is the minimum. You can clearly see that the second line is always touching the (x^2) curve.

In the words of Professor Dunne himself:

What you should notice is that (regardless of what the value c is) these always touch the x^2 curve (in fact for a given c, the line (2c)x-(c*c) will touch the point (c,c^2) ).

You should also see that “in order to keep contact” (bit of a loose way of phrasing it) the slope of the line changes, the “turning point” is precisely the position where the slope goes from decreasing (before) to increasing (after). For this behaviour to happen then at the turning point the slope must be zero (and from the decreasing->increasing pattern is a minimum); if the the pattern where s(increasing->turn->decreasing) the turning point would be a maximum.

This looks extremely easy, because you just look at the graph, see the line of gradience 0 and say “that’s the minimum”. But if it was that easy this wouldn’t be taught. You have to find the minimum of lines and curves that you cannot see or visualise.

# Second Derivative

The second derivative, f’‘(x) is the derivative of f’(x). The second derivative is the derivative of the first derivative.

The second derivative of (x^2) is a constant which is positive. This tells us that 0 (the value of f’(x) =2 where the line touching (<x, x^2>) is horizontal) is a local minimum for the function. That is: every value of x (with x != 0) is such that f(x) > f(0). In fact (for this function) x = 0 is also a global minimum.

This is extremely confusing so to simpilfy:

Comptute f’(x) - the first derivative.

Find the value(s) of x for which f’(x) = 0.

These give the turning points of f(x) and where local minima and maxima occur.

Comptute f’‘(x) - the *second* derivative.

For each turning point, t, computer the value f’‘(t): if f’‘(t) < 0 then f(t) is a local maximum if f’‘(t) > 0 then f(t) is a local minimum if f’‘(t) = 0 then we cannot make any conclusions.

# Revisiting Maxima and Minima

Functions can have a minimum value which is the lowest value the graph touches. You’ll notice in the previous graph that the function (x^2) does not go below 0. The maximum value is the value it does not go above.

Local maximum and minimum values are specified in a set interval and there can be more of 1 each. Global maximum and minimum values are the absolute highest of that fraph.

Let’s work through an example. Let’s say a ball is thrown into the air. Its height at any time, t, is given by:

What is its maximum height?

Well, using derivatives we can work out the slope of this function. The slop is (14 - 10t). How do we know this? Well, we just use a handy derivative table to tell us.

We can use these derivative rules for this specific fuction:

- The slope of a constant value (like 3) is 0.
- The slope of a line like 2x is 2, so 14t has a slope of 14.
- A square function like (t^2) has a slope of 2t, so (5t^2) has a slope of 5(2t).
- And then we add them up: 0 + 14 - 5(2t)

So we get the answer 14 - 5(2t).

Now we need to find when the slope is equal to 0. So we simply do this:

The slope is zero at *t = 1.4*.

And the height of that time (which is just taking the height equation given to us earlier)

The maximum height of this funtion is *12.8m* at 1.4 seconds.

This kind of begs the question of “how can we prove it is the maximum (or minimum) value?”

Take the derivative of the slope (the second derivative of the first function) so the derivative of 14 - 10t is -10. This means that the slope starts out positive, goes through 0 and then the slope becomes negative (at -10) which means is a maximum value. This is called the second derivative test.

Let’s try another example.

Find the maxima and minima values for:

The derivative is:

Which is quadratic with roots of:

Could these values be minima or maxima?

The second derivative is y’’ = 30x + 4

At x = -3/5: y’’ = 30(-3/5) + 4 = -14 it is less than 0, so -3/5 is a local maximum.

At x = +1/3: y’’ = 30(1/3) + 4 = 14 It is greater than 0, so 1/3 is a local maximum.

# Antiderivative

The *antiderivative* is *any* function, F(x) with the property F’(x) = F(x).

Antiderivatives are extremely useful in measuring areas under sloping lines. For exampke, what’s the area of these two functions?

We can measure a smaller area, such as the area between x = 6 and x = 14 for the function f(x) = x^2.

We can make an estimation of the area by creating rectangles under the curve. As the rectangle base gets smaller and smaller our estimates get smaller and smaller resulting in our lower and upper estimates differences getting smaller and smaller.

The upper value is just a sum of rectangle areas: all have base length h and for each k between 1 and N = (b - a)/h there is a rectangle with height F(a + kh). In other words:

In order to find the area c overed by the function F(x) between the values x = a, x = b it is enough to know the antiderivative of F(z).

If F(x) is the antiderivative of f(x), then the area is F(b) - F(a).

It is a little wearisome to constantly repeat the phrase “anti derivative of f(x)”. The standard notation used is the integral sign. The expression “F(x) is the antiderivative of f(x)” is written as:

This is called an *indefinite integral* since we do not have enough information about F(x) uniquely to define its behavior. For the area applications when a and b are supplied, we use:

# Connect with me

upscribe

linkedlin twitter githib

Don’t like this article or want to add something? Submit a pull request here:

My goal is to create easy to understand guides to computer science topics. If you want to contribute anything, feel free to!