# Introduction to Calculus: Differentiation

## Recommended Posts

Prerequisites

There's only so much I can do: I'm assuming that you've got a solid basis in algebra, and I will start from about the level of maths GCSE. I assume that you will understand the concept of a function (e.g. $f(x) = x^2$) and understand various concepts such as graphing techniques. For the later stages, I assume some knowledge in the area of trigonometry, mainly the sine and cosine functions. For the more advanced calculus, I will be working in radians instead of degrees for the measurement of angles.

There is one other thing: GRADIENTS - know that the definition of a gradient of a straight line between two points (x1, y1) and (x2, y2) is [imath]\frac{y_2 - y_1}{x_2 - x_1}[/imath]. (Some people know gradients as "slope." They're the same thing.)

Here's a list of the topics covered in the rest of this tutorial, with links to those posts:

Lesson 1 - The basics of limits

So what actually is a limit? It's a very hard concept to define in layman's terms (although relatively easy from a strictly analytical point of view). I think the best way to think of it is in terms of sequences.

Imagine you have a sequence of numbers that goes like this: 1, 1/2, 1/3, 1/4, 1/5, ... and so on. If we call the nth number an, then it's fairly clear to see that a1 is 1, a2 is 1/2, and so on. The mathematical definition for the nth number is obviously an = 1/n.

Now we look at what happens as we get bigger and bigger values of n. We can notice that each term in the sequence gets progressively smaller as we increase the value of n, and it doesn't take a genius to work out that as we get really big values of n, we get excruciatingly small values for an. Eventually, with incredibly huge numbers, an will be almost 0 (but it never will actually be 0). So we can say that the "limit" of an is 0 as n gets really big (i.e. as n tends to infinity).

Don't start crying just yet over how complex this all is; it's an abstract concept to understand, and it'll take some time just to understand the idea, let alone how it all works. A quick remark on this: we won't be using limits that tend to infinity much in calculus at all, I just used it as an example.

A very important idea to understand is the fact that we're not actually saying that the sequence will ever hold a value of 0 - what we are saying is that if you were to go on and extend the sequence forever, then you'd be continually getting closer and closer to zero.

Quickly, some notation. You won't be using this every day, but it's handy to know. The situation described above could be represented like this:

$\lim_{x \to \infty} \frac{1}{x} = 0$

meaning that as we put bigger and bigger numbers in to [imath]\frac{1}{x}[/imath], the answer approaches 0.

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

Lesson 2 - The basics of differentiation

So now onto first principles of differentiation: this is where I tell you how to actually go about differentiating something and what we actually mean by the term 'differentiation'.

A classic math problem is to sketch a curve out (like the classic y = x2) and then they say to you: "draw a tangent to the curve at the point x = 1, and hence find the gradient at that point". And you grudgingly scrawl out a quick graph, shove a quick tangent on and get an approximate value for the gradient. After all, we all know it's dead easy to find the exact gradient between two points on a straight line, but on a curve? Bah, impossible. You just have to approximate.

But this is not so.

Let's draw ourselves a graph of y= x2, and have a look at a better way of doing things. Take a look at this graph:

We have a point P at the position (1,1) and then a point Q at position (1+h, (1+h)2). I initially got confused here: basically, we're looking at a point where x = 1, and then a point a little bit further down the x-axis at x = 1+h, where h is some value (we don't really care all that much what it is).

(If you're wondering where (1+h)2 came from, remember the equation we're graphing: y=x2. If x = 1+h, y = (1+h)2.)

Let's suppose we're asked to find the gradient at P. We could draw a line between point P and point Q and find its gradient, which will give us a rough approximation of the gradient at point P. We could repeat this over and over, moving Q closer to P every time (and thus getting an answer closer to the real value of the gradient at x = 1).

Let's look at the gradient of the line PQ. This is equal to:

$\frac{y_2 - y_1}{x_2 - x_1} = \frac{(1+h)^2 - 1}{(1+h) - 1} = \frac{(1+h)^2 - 1}{h}$

Now just a second. We want to find the limit of this (the answer) as we decrease h to practically nothing. In other words, we want to find the gradient of the line when we move P and Q incredibly close together. So close together that they're actually the same point. That should give us the gradient at x = 1.

But we've got a silly h lying around all by itself on the bottom of the equation, meaning that if we just stick h=0 into here, we get something divided by zero - we can't do that. We don't want to just stick a tiny number in for h because that would just be approximating. But wait! There's a way to make h = 0 - which would mean that we're finding the gradient of PQ where P and Q are the same. That would tell us the gradient of the curve at x = 1, which is exactly what we're looking for.

So now we have to play around a bit with the fraction, and this is the key operation of this lesson. Make sure you watch very, very carefully and understand each step in the minutest of detail. First of all, notice that (1+h)2 = 1 + 2h + h2. So now we have the gradient equal to:

$\frac{(1+h)^2 - 1}{h} = \frac{1 + 2h + h^2 - 1}{h} = \frac{2h + h^2}{h} = \frac{h(2 + h)}{h} = 2 + h$

Hurrah! Now we have something that we can work with. Notice that if we shrink h to zero as we intended, the gradient of PQ will tend to 2+0 = 2. Or, in other words, the gradient at x = 1 is 2. That's not an approximation, that's the exact answer. To use the appropriate terminology, we have just differentiated the function to find its derivative.

So we have a method for finding the exact value of the gradient at a certain point. All those hours of drawing tangents to curves wasted whilst your teacher can work out the answer in his head...

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

Lesson 3: The formal definition of differentiation and some basic shortcuts

So now we've figured out how to differentiate a basic function using the methods above. You'll notice how tedious and boring they were to work out (if you don't think it was tedious, wait until you try more difficult functions). Surely there are some shortcuts.

There are. But first, we'll formalize what we know about differentiation into a simple equation:

$\frac{d}{dx}f(x) = \lim_{h \to 0} \left( \frac{f(x+h) - f(x)}{h} \right)$

You're probably now wondering "what does that [imath]\frac{d}{dx}[/imath] thing mean and why is it up there?" In short, that's the notation to describe a derivative of a function - it means "the derivative with respect to x of the function f(x)." (The d is not a variable, it's an operator, so you can't cancel it out of that fraction.) You may also see things like f'(x) (pronounced "f prime of x"), which also indicates a derivative.

Anyway, the fancy limit above is essentially the same as the equation we used before. You'll see why we used the limit - you can't plug in 0 for h, but you certainly can evaluate the limit as h gets infinitesimally close to 0. (Re-read lesson 2 if you don't quite understand.)

Shortcuts

In Lesson 2, we plugged numbers into an equation and differentiated it. Suppose we want to find the slope at several points on the same graph. We'd have to do all that tedious factoring and simplifying every single time - or not. It turns out that the formula above can work on the equation you're differentiating even without real values in it. In other words, you can leave the x variable in and differentiate and get an equation that will give you the slope at any given point on the curve.

Let's try it for the function f(x) = x2.

We can see that this is true:

$\frac{(x+h)^2 - x^2}{h} = \frac{x^2 + 2xh + h^2 - x^2}{h} = \frac{2xh + h^2}{h} = \frac{h(2x + h)}{h} = 2x + h$

That means that the limit simplifies rather nicely:

$\frac{d}{dx}x^2 = \lim_{h \to 0} \left( \frac{(x+h)^2 - x^2}{h} \right) = \lim_{h \to 0} (2x+h) = 2x$

(If you don't get that last step, remember that we're making h approach 0. When h is no longer on the bottom of a fraction, we can safely make it zero without "breaking" the equation.)

So what's this mean? It means that at any point on the curve x2, the slope of the curve is 2x. You could say that

$\frac{d}{dx} x^2 = 2x$

But I want to do it faster!

But wait, there are yet more shortcuts!

If you try differentiating a few simple equations, you might notice a pattern. Take a look:

$\frac{d}{dx} x^2 = 2x$

$\frac{d}{dx} x^3 = 3x^2$

$\frac{d}{dx} 2x^2 = 4x$

Notice a pattern? Basically, if you have a function of the form axn, the derivative is

$\frac{d}{dx} ax^n = anx^{n - 1}$

This rule also applies for longer equations. Suppose I have the equation [imath]f(x) = x^3 - 2x^2 + 2x - 3[/imath]. The derivative of that equation is equal to the derivatives of all the parts, added together, like so:

$f'(x) = 3x^2 - 4x + 2$

You may have noticed that the term "- 3" vanished from the equation, and you're right: it has no variable in it, so we can leave it out of the derivative. The 2x became a 2 for similar reasons. Watch what happens when we take the derivative of 2x with our rule: [imath]\frac{d}{dx} 2x^1 = 1 \times 2x^0 = 2[/imath] (because x0 = 1).

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

• 4 weeks later...

Lesson 4: The Product Rule

From this point forward, all you have left to learn is more sophisticated ways of finding derivatives. The first is called the Product Rule.

Let's say I give you this equation:

$f(x) = (x - 2)(x + 4)$

and I ask you for its derivative. You've got two choices: plug it in to the big limit in Lesson 3, or try to use our easy rule. The first choice would be a pain, and the rule just doesn't work -- this isn't a function of the form axn. You might also expand the equation out, but that gets to be a pain with more complicated functions.

In steps the Product Rule.

The Product Rule takes effect when you have two "chunks" multiplied with each other in the equation. In this case, our "chunks" are (x - 2) and (x + 4). Let's give each chunk a name to make things easier:

$u = (x - 2)$

$v = (x + 4)$

The product rule says the derivative of [imath](x - 2)(x + 4)[/imath], otherwise known as [imath]u \cdot v[/imath], is equal to [imath]\frac{d}{dx}u \cdot v + \frac{d}{dx}v \cdot u[/imath]. So to find the derivative of f(x), we'd do this:

$\frac{d}{dx} (x-2)(x+4) = \frac{d}{dx} (u \cdot v) = \frac{d}{dx}u \cdot v + \frac{d}{dx}v \cdot u$

and then find the derivatives of the parts:

$\frac{d}{dx}u \cdot v + \frac{d}{dx}v \cdot u = \frac{d}{dx}(x-2) \cdot (x + 4) + \frac{d}{dx}(x+4) \cdot (x - 2)$

And since we can find the derivative of things like (x - 2):

$1 \cdot (x + 4) + 1 \cdot (x - 2) = (x + 4) + (x - 2) = 2x + 2$

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

• 3 months later...

Lesson 5: The Quotient Rule

By now you should have a good grasp of basic differentiation. (If you don't, I suggest you try to work it out rather than plowing ahead.) However, there are still a few cases that you don't yet know how to handle.

For example, what's the derivative of this?

$f(x) = \frac{x-2}{x+4}$

None of the rules and shortcuts so far tells you how to do that. In steps the Quotient Rule. First, let's separate our function into two parts:

$u = x - 2$

$v = x + 4$

meaning that

$f(x) = \frac{u}{v}$

The quotient rule tells us that the derivative of that equation is this:

$f'(x) = \frac{u'\cdot v - v'\cdot u}{v^2}$

(Remember that u' is the shorthand for the derivative of u.)

So now you just need to find the derivatives of each of the parts -- the derivatives of u and v. You just apply the rules you learned before and find that they're both 1.

So that means that:

$f'(x) = \frac{1 (x + 4) - (1 (x - 2))}{(x + 4)^2}$

(You need to remember the parentheses after the minus sign. That negative distributes over everything in the parentheses, so remember to change the signs when you're working out the subtraction.)

There's some more math you can do to simplify that out, but it's not really necessary. You get the idea.

And that's all there is to the Quotient Rule.

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

• 3 weeks later...

Lesson 6: The Chain Rule

The Chain Rule helps you solve another important type of equation. This kind:

$g(x) = 4(x^2 - 7)^6$

You have a choice: you could expand the equation out (which would take a very long time) and apply the other rules of differentiation, or you could use the chain rule.

Let's break that above equation into two separate functions, a and b:

$a(x) = 4x^6$

$b(x) = x^2 - 7$

That means we can redefine g(x) like this:

$g(x) = a(b(x))$

For those of you who don't see how g(x) can be a(b(x)), try it. a(b(x)) is a(x) with b(x) stuck in wherever there's an x, like this:

$g(x) = a(b(x)) = 4(b(x))^6 = 4(x^2 - 7)^6$

We simply inserted x2 - 7 where there was an x.

How do you find the derivative? The rule says it's this:

$\frac{d}{dx} g(x) = a'(b(x)) \cdot b'(x)$

So it's as simple as finding the derivatives of a(x) and b(x) using all the rules we learned before and substituting them back into the problem.

$a'(x) = 24x^5$

$b'(x) = 2x$

Then we substitute those back in:

$\frac{d}{dx} g(x) = 24(b(x))^5 \cdot 2x$

$\frac{d}{dx} g(x) = 24(x^2 - 7)^5 \cdot 2x$

From there you can simplify the equation any way you'd like.

So the chain rule is as simple as breaking the equation down into parts. Try a few below. The answers are at the end of this post.

1. $g(x) = 2(x + 4)^3 + 7x$
2. $q(x) = ((x + 4)^4)^2$

1. You could split g(x) into [imath]a(x) = x + 4[/imath] and [imath]b(x) = 2x^3[/imath], making [imath]g(x) = b(a(x)) + 7x[/imath]. You can safely leave the 7x sitting around and derive it by itself because it's being added, not multiplied.
2. q(x) should be split into [imath]a(x) = x + 4[/imath], [imath]b(x) = x^4[/imath], and [imath]c(x) = x^2[/imath]. That makes [imath]q(x) = c(b(a(x)))[/imath]. How do you solve that? Easy. [imath]q'(x) = c'(b(a(x))) \cdot b'(a(x)) \cdot a'(x)[/imath]. Remember, it's "the derivative of the outer function, times the derivative of the inner function." You just have to apply the chain rule to the inner function to find its derivative.

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

• 5 months later...

Lesson 7: Derivatives of Trigonometric Functions

Often times you'll see something like this:

$f(x) = \sin(4x^2)$

and be asked to find the derivative. This leads to the obvious question: what's the derivative of a trig function? How do you derive sin?

There's no easy method to do so (save a lot of math you haven't learned yet), but it is easy to memorize:

$\frac{d}{dx} \sin x = \cos x$

$\frac{d}{dx} \cos x = -\sin x$

$\frac{d}{dx} \tan x = \sec^2 x$

$\frac{d}{dx} \sec x = \sec x \tan x$

$\frac{d}{dx} \csc x = - \csc x \cot x$

$\frac{d}{dx} \cot x = -\csc^2 x$

(Helpful memorization hint: The derivative of any trig function starting with a "c" is negative. The rest are positive.)

You'll have to memorize that and practice a bit to make sure you know them.

Ah, you ask, but what about [imath]f(x) = \sin(4x^2)[/imath]? Is the derivative just [imath]\cos(4x^2)[/imath]?

No.

It's a chain rule question again. The derivative of [imath]\sin x[/imath] is certainly [imath]\cos x[/imath], but when you put in the [imath]4x^2[/imath] it becomes a chain rule question. Think of it this way:

$f(x) = 4x^2$

$\frac{d}{dx} \sin(f(x)) = \cos(f(x)) \cdot f'(x)$

That looks a lot like the chain rule stuff from above, right? You split it into two functions, sin and x, and apply the chain rule as I explained in the previous lesson. So the answer would be:

$\frac{d}{dx} \sin(4x^2) = \cos(4x^2) \cdot 8x$

Remember, if you need help understanding any of this, you can just ask in our calculus forum.

Edited by Cap'n Refsmmat
##### Share on other sites

• 2 years later...

Lesson 8: Basic Applications: Finding the Maximum and Minimum Values of a Function:

This lesson was contributed by SFN member Daedalus, who did an excellent job putting it together. If you find this helpful, be sure to thank Daedalus!

The derivative of a function defines the slope of a line tangent to the curve. Normally, derivatives are used in calculations where the rate of change is needed. However, the derivative can also be used to find the extremum (singular) or extrema (plural) of a function.

There are two types of extrema called the global extrema and local extrema. The global extrema defines the overall maximum and / or minimum value(s) in the range of a function. The local extrema, sometimes referred to as the relative extrema, defines the maximum and / or minimum value(s) in the range of a function within a given region.

To find the extrema of a function, we must find the stationary points of a function where a horizontal line is tangent to the curve. This involves finding the roots of the first derivative which is the same as setting the first derivative equal to zero and solving for $x$.

$f'(x)=0$

A stationary point may be the minimum, maximum, or an inflection point on the curve. We can see that in this example:

The labeled points have slopes of zero (as shown by the tangent lines) and show where the function "flattens out." This happens at minima and maxima, but also at inflection points, where the function increases, stops, then increases again (or the reverse).

To make sure that we have found the extrema, we can use the first derivative test which states:

For any stationary point $x_{s}$ on a continuous function $f(x)$ we can determine if the stationary point is a minimum, maximum, or inflection point of the function according to the following rules:

1. Local Minimum (Possibly Global): $f'(x)<0$ to the left of $x_{s}$ and $f'(x)>0$ to the right.
2. Local Maximum (Possibly Global): $f'(x)>0$ to the left of $x_{s}$ and $f'(x)<0$ to the right.
3. Inflection Point: The sign of $f'(x)$ is the same on both sides of $x_{s}$.

Applying The Derivative:

Now that we have discussed how to find the extrema of a function, we will apply this knowledge to solve a problem that anyone who grows a garden will appreciate.

A farmer has decided to plant a garden and would like to build a fence around it to keep the animals from eating the crops. Being an experienced farmer, he decided to place the garden up against his barn because he only has 100 ft of fence and he wants to enclose the largest possible area. The following image illustrates the problem:

We can see that the area of the garden is defined by:

$A=x \times y$

We can also see that the perimeter of the fence is equal to:

$P=2\, x + y$

However, the equation for the area of the garden is not in a form that is useful to us. We'd like the equation in a form that only uses one variable, to make it easier to work with. Let's use the variable $x$. If we look at the equation for the perimeter of the fence, we can solve for $y$ and substitute that result into the equation for the area of the garden:

$y=P - 2\, x$

Replacing the variable $y$ with $P-2\, x$ in the equation for the area of the garden yields:

$A=x \, (P - 2\, x) = x\, P - 2\, x^2$

Now, as stated in the problem, we know the farmer has 100 feet of fence to work with, so $P=100$. We can see there are many possible areas for the garden, depending on the length of the sides -- there could be a very long, skinny garden with almost no space, or a broad garden with plenty of space. If we plot $A$, we see that it forms a parabola:

However, we are only interested in the largest possible area that can be enclosed by the fence. This means we must find the number $x$ which gives the maximum value of $A$ in our function. To do this we will locate our stationary point(s) by taking the first derivative of our function, setting it equal to zero, and solving for $x$:

The derivative of our area function as provided by the power rule:

$A'(x)=P - 4\, x$

We search for horizontal tangents by setting $A'(x)=0$:

$P - 4\, x=0$

Solving for $x$:

$x=\frac{P}{4}$

We can check this point to see if it is the maximum by using the first derivative test:

$P- 4\, \left (\frac{P}{4} - 0.01\right) = 0.04$

$P- 4\, \left (\frac{P}{4} + 0.01\right) = -0.04$

The stationary point is indeed the maximum because the slope to the left of the stationary point is positive and the slope to the right is negative. (That is, the function goes up, reaches this maximum point, and then goes down -- it doesn't go up again.) Furthermore, by looking at the graph we can conclude that this stationary point is the global maximum of the function, since it only goes down on each side.

We know that the farmer only has 100 ft. of fence which is equal to the perimeter that we have defined in the equations. With $P=100 \mbox{ft}$, we can let the farmer know that the width of his garden needs to be $25 \mbox{ft}$ :

$\frac{P}{4}=\frac{100 \mbox{ft}}{4}=25 \mbox{ft}$

The length of his garden needs to be $50\mbox{ft}$ :

$y=P - 2\, x=100 \mbox{ft} - 2\, (25 \mbox{ft})= 50 \mbox{ft}$

This gives the farmer a maximum $1250 \mbox{ft}^2$ of area to plant his garden :

$x \times y=25 \mbox{ft} \times 50 \mbox{ft}=1250 \mbox{ft}^2$

or

$x \times y=\frac{P}{4} \times \left(P-2\, \left(\frac{P}{4}\right)\right)=\frac{P^2}{8}=\frac{10000 \mbox{ft}^2}{8}=1250 \mbox{ft}^2$

If the farmer decided to place his garden away from the barn such that he had to use the entire length of fence to enclose the garden (rather than letting one wall of the barn fence in the garden), what would be the maximum area he could enclose?

Would this area be a rectangle or would it be a square?

The area enclosed by the fence:

$A=x \times y$

The perimeter of the fence:

$P=2\, x + 2\, y$

Solve for $y$ in the perimeter function:

$y=\frac{P-2\, x}{2}=\frac{P}{2} - x$

Substitute this result into the equation for the area:

$A=x \left(\frac{P}{2} - x\right)=x \left(\frac{P}{2}\right) - x^2$

Set the first derivative equal to zero and solve for $x$

$A'(x)=\frac{P}{2} - 2\, x$

$\frac{P}{2} - 2\, x = 0$

$x=\frac{P}{4}$

If we had 100 ft. of fence, the width of the garden would be:

$\frac{P}{4}=\frac{100 \mbox{ft}}{4}=25 \mbox{ft}$

The length of the garden would be:

$y=\frac{P}{2} - x=\frac{100 \mbox{ft}}{2} - 25 \mbox{ft}=25 \mbox{ft}$

The largest area possible is:

$x \times y=25 \mbox{ft} \times 25 \mbox{ft}=625 \mbox{ft}^2$

or

$x \times y=\frac{P}{4} \times \left(\frac{P}{2} - \left(\frac{P}{4}\right)\right)=\frac{P^2}{16}=\frac{10000 \mbox{ft}^2}{16}=625 \mbox{ft}^2$

The shape of the garden would be a square:

$25 \mbox{ft} \times 25 \mbox{ft}$

##### Share on other sites

• 1 year later...

Hi Cap'n Refsmmat,

At high school we studied 2 years of calculus and here are some things that I found made differentiation/integration a bit easier to understand.

In its simplest form differentiation is the application of n * x ^ (n - 1) to all elements of x in equations of the form of a * x^2 + b * x + c = 0.

The roots of the basic form are - b +/- the square root of (b^2 - 4 * a * c)/2a:

$x=\frac{-b \pm \sqrt{b^2 - 4 ac}}{2a}$

The first differential of this basic form is 2 * a * x + b = 0 and the integral of this first differential is the original basic form because integration is the exact opposite of differentiation (the application of x^(n+1) / n to all elements of x + add a constant (x^0, which may = 0)).

The units of acceleration M / second^2, speed M / second and distance travelled M all have a pure integral/differential relationship (between M with respect to time) that gets right to the heart of Newtons calculus and his mechanics. These proofs from first principles are good examples of pure applied calculus.

Finally, in the basic form the last differential always goes to 0 and the first integral is the same and also goes to 0, unless you use a modified calculus, so make sure you don't overshoot on the way down or the way up.

Edited by Cap'n Refsmmat
fix typo
##### Share on other sites

This topic is now closed to further replies.
×