Calculus/Differentiation/Differentiation Defined

What is Differentiation?
Differentiation is a process of finding a function that outputs the rate of change of one variable with respect to another variable.

Informally, we may suppose that we're tracking the position of a car on a two-lane road with no passing lanes. Assuming the car never pulls off the road, we can abstractly study the car's position by assigning it a variable, $$x$$. Since the car's position changes as the time changes, we say that $$x$$ is dependent on time, or $$x=f(t)$$. This tells where the car is at each specific time. Differentiation gives us a function $$\frac{dx}{dt}$$ which represents the car's speed, that is the rate of change of its position with respect to time.

Equivalently, differentiation gives us the slope at any point of the graph of a non-linear function. For a linear function, of form $$f(x)=ax+b$$, $$a$$ is the slope. For non-linear functions, such as $$f(x)=3x^2$$, the slope can depend on $$x$$ ; differentiation gives us a function which represents this slope.

The Definition of Slope
Historically, the primary motivation for the study of differentiation was the tangent line problem: for a given curve, find the slope of the straight line that is tangent to the curve at a given point. The word tangent comes from the Latin word tangens, which means touching. Thus, to solve the tangent line problem, we need to find the slope of a line that is "touching" a given curve at a given point, or, in modern language, that has the same slope. But what exactly do we mean by "slope" for a curve?

The solution is obvious in some cases: for example, a line $$y=mx+c$$ is its own tangent; the slope at any point is $$m$$. For the parabola $$y=x^2$$, the slope at the point $$(0,0)$$ is $$0$$ ; the tangent line is horizontal.

But how can you find the slope of, say, $$y=\sin(x)+x^2$$ at $$x=1.5$$ ? This is in general a nontrivial question, but first we will deal carefully with the slope of lines.

The Slope of a Line
The slope of a line, also called the gradient of the line, is a measure of its inclination. A line that is horizontal has slope 0, a line from the bottom left to the top right has a positive slope and a line from the top left to the bottom right has a negative slope.

The slope can be defined in two (equivalent) ways. The first way is to express it as how much the line climbs for a given motion horizontally. We denote a change in a quantity using the symbol $$\Delta$$ (pronounced "delta"). Thus, a change in $$x$$ is written as $$\Delta x$$. We can therefore write this definition of slope as:
 * $${\rm Slope}=\frac{\Delta y}{\Delta x}$$

An example may make this definition clearer. If we have two points on a line, $$P(x_1,y_1)$$ and $$Q(x_2,y_2)$$, the change in $$x$$ from $$P$$ to $$Q$$ is given by:
 * $$\Delta x=x_2-x_1$$

Likewise, the change in $$y$$ from $$P$$ to $$Q$$ is given by:
 * $$\Delta y=y_2-y_1$$

This leads to the very important result below.

Alternatively, we can define slope trigonometrically, using the tangent function:
 * $${\rm Slope}=\tan(\alpha)$$

where $$\alpha$$ is the angle from the rightward-pointing horizontal to the line, measured counter-clockwise. If you recall that the tangent of an angle is the ratio of the y-coordinate to the x-coordinate on the unit circle, you should be able to spot the equivalence here.

Of a graph of a function
The graphs of most functions we are interested in are not straight lines (although they can be), but rather curves. We cannot define the slope of a curve in the same way as we can for a line. In order for us to understand how to find the slope of a curve at a point, we will first have to cover the idea of tangency. Intuitively, a tangent is a line which just touches a curve at a point, such that the angle between them at that point is 0. Consider the following four curves and lines:

 The line $$L$$ crosses, but is not tangent to $$C$$ at $$P$$ . The line $$L$$ crosses, and is tangent to $$C$$ at $$P$$ . The line $$L$$ crosses $$C$$ at two points, but is tangent to $$C$$ only at $$P$$ . There are many lines that cross $$C$$ at $$P$$, but none are tangent. In fact, this curve has no tangent at $$P$$ . 

A secant is a line drawn through two points on a curve. We can construct a definition of a tangent as the limit of a secant of the curve taken as the separation between the points tends to zero. Consider the diagram below.



As the distance $$h$$ tends to 0, the secant line becomes the tangent at the point $$x_0$$. The two points we draw our line through are:
 * $$P(x_0,f(x_0))$$

and
 * $$Q(x_0+h,f(x_0+h))$$

As a secant line is simply a line and we know two points on it, we can find its slope, $$m_h$$, using the formula from before:
 * $$m=\frac{y_2-y_1}{x_2-x_1}$$

(We will refer to the slope as $$m_h$$ because it may, and generally will, depend on $$h$$ .) Substituting in the points on the line,
 * $$m_h=\frac{f(x_0+h)-f(x_0)}{(x_0+h)-x_0}$$

This simplifies to
 * $$m_h=\frac{f(x_0+h)-f(x_0)}{h}$$

This expression is called the difference quotient. Note that $$h$$ can be positive or negative — it is perfectly valid to take a secant through any two points on the curve — but cannot be $$0$$.

The definition of the tangent line we gave was not rigorous, since we've only defined limits of numbers — or, more precisely, of functions that output numbers — not of lines. But we can define the slope of the tangent line at a point rigorously, by taking the limit of the slopes of the secant lines from the last paragraph. Having done so, we can then define the tangent line as well. Note that we cannot simply set $$h$$ to 0 as this would imply division of 0 by 0 which would yield an undefined result. Instead we must find the limit of the above expression as $$h$$ tends to 0:

This last equation is just the point-slope form for the line through $$(x_0,f(x_0))$$ with slope $$m$$.

Exercises
Solutions

The Rate of Change of a Function at a Point
Consider the formula for average velocity in the $$x$$ direction, $$\frac{\Delta x}{\Delta t}$$, where $$\Delta x$$ is the change in $$x$$ over the time interval $$\Delta t$$. This formula gives the average velocity over a period of time, but suppose we want to define the instantaneous velocity. To this end we look at the change in position as the change in time approaches 0. Mathematically this is written as: $$\lim_{\Delta t\to 0}\frac{\Delta x}{\Delta t}$$, which we abbreviate by the symbol $$\frac{dx}{dt}$$. (The idea of this notation is that the letter $$d$$ denotes change.) Compare the symbol $$d$$ with $$\Delta$$. The idea is that both indicate a difference between two numbers, but $$\Delta$$ denotes a finite difference while $$d$$ denotes an infinitesimal difference. Please note that the symbols $$dx$$ and $$dt$$ have no rigorous meaning on their own, since $$\lim_{\Delta t\to 0}\Delta t=0$$, and we can't divide by 0.

(Note that the letter $$s$$ is often used to denote distance, which would yield $$\frac{ds}{dt}$$ . The letter $$d$$ is often avoided in denoting distance due to the potential confusion resulting from the expression $$\frac{dd}{dt}$$.)

The Definition of the Derivative
You may have noticed that the two operations we've discussed — computing the slope of the tangent to the graph of a function and computing the instantaneous rate of change of the function — involved exactly the same limit. That is, the slope of the tangent to the graph of $$y=f(x)$$ is $$\frac{dy}{dx}$$. Of course, $$\frac{dy}{dx}$$ can, and generally will, depend on $$x$$, so we should really think of it as a function of $$x$$. We call this process (of computing $$\frac{dy}{dx}$$) differentiation. Differentiation results in another function whose value for any value $$x$$ is the slope of the original function at $$x$$. This function is known as the derivative of the original function.

Since lots of different sorts of people use derivatives, there are lots of different mathematical notations for them. Here are some:
 * $$f'(x)$$ (read "f prime of x") for the derivative of $$f(x)$$ ,
 * $$D_x[f(x)]$$ ,
 * $$Df(x)$$ ,
 * $$\frac{dy}{dx}$$ for the derivative of $$y$$ as a function of $$x$$ or
 * $$\frac{d}{dx}\big[y\big]$$, which is more useful in some cases.

Most of the time the brackets are not needed, but are useful for clarity if we are dealing with something like $$D(f\cdot g)$$, where we want to differentiate the product of two functions, $$f$$ and $$g$$.

The first notation has the advantage that it makes clear that the derivative is a function. That is, if we want to talk about the derivative of $$f(x)$$ at $$x=2$$, we can just write $$f'(2)$$.

In any event, here is the formal definition:

Examples
Example 1

The derivative of $$f(x)=\frac{x}{2}$$ is
 * $$f'(x)=\lim_{\Delta x\to 0}\left(\frac{\frac{x+\Delta x}{2}-\frac{x}{2}}{\Delta x}\right)=\lim_{\Delta x\to 0}\left(\frac{\frac{x}{2}+\frac{\Delta x}{2}-\frac{x}{2}}{\Delta x}\right)=\lim_{\Delta x\to 0}\left(\frac{\frac{\Delta x}{2}}{\Delta x}\right)=\lim_{\Delta x\to 0}\left(\frac{\Delta x}{2\Delta x}\right)=\lim_{\Delta x\to 0}\left(\frac12\right)=\frac12$$

no matter what $$x$$ is. This is consistent with the definition of the derivative as the slope of a function.

Example 2

What is the slope of the graph of $$y=3x^2$$ at $$(4,48)$$ ? We can do it "the hard (and imprecise) way", without using differentiation, as follows, using a calculator and using small differences below and above the given point:

When $$x=3.999$$, $$y=47.976003$$.

When $$x=4.001$$, $$y=48.024003$$.

Then the difference between the two values of $$x$$ is $$\Delta x=0.002$$.

Then the difference between the two values of $$y$$ is $$\Delta y=0.048$$.

Thus, the slope $$\frac{\Delta y}{\Delta x}=24$$ at the point of the graph at which $$x=4$$.

But, to solve the problem precisely, we compute



We were lucky this time; the approximation we got above turned out to be exactly right. But this won't always be so, and, anyway, this way we didn't need a calculator.
 * $$\lim_{\Delta x\to 0}\frac{3(4+\Delta x)^2-48}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{(4+\Delta x)^2-16}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{16+8\Delta x+(\Delta x)^2-16}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{8\Delta x+(\Delta x)^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}(8+\Delta x)$$
 * $$=3(8)$$
 * $$=24$$
 * }
 * $$=3\lim_{\Delta x\to 0}(8+\Delta x)$$
 * $$=3(8)$$
 * $$=24$$
 * }
 * $$=3(8)$$
 * $$=24$$
 * }
 * $$=24$$
 * }
 * }

In general, the derivative of $$f(x)=3x^2$$ is


 * $$f'(x)$$
 * $$=\lim_{\Delta x\to 0}\frac{3(x+\Delta x)^2-3x^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{(x+\Delta x)^2-x^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{x^2+2x\Delta x+(\Delta x)^2-x^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}\frac{2x\Delta x+(\Delta x)^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}(2x+\Delta x)$$
 * $$=3(2x)$$
 * $$=6x$$
 * }
 * $$=3\lim_{\Delta x\to 0}\frac{2x\Delta x+(\Delta x)^2}{\Delta x}$$
 * $$=3\lim_{\Delta x\to 0}(2x+\Delta x)$$
 * $$=3(2x)$$
 * $$=6x$$
 * }
 * $$=3(2x)$$
 * $$=6x$$
 * }
 * $$=6x$$
 * }
 * $$=6x$$
 * }

Example 3

If $$f(x)=|x|$$ (the absolute value function) then $$f'(x)=\frac{x}{|x|}$$, which can also be stated as
 * $$f'(x)=\left\{\begin{matrix}-1&x<0\\ {\rm undefined}&x=0\\ 1&x>0\end{matrix}\right.$$

Finding this derivative is a bit complicated, so we won't prove it at this point.

Here, $$f(x)$$ is not smooth (though it is continuous) at $$x=0$$ and so the limits $$\lim_{x\to 0^+}f'(x)$$ and $$\lim_{x\to 0^-}f'(x)$$ (the limits as 0 is approached from the right and left respectively) are not equal. From the definition, $$f'(0)=\lim_{\Delta x\to 0}\frac{|\Delta x|}{\Delta x}$$, which does not exist. Thus, $$f'(0)$$ is undefined, and so $$f'(x)$$ has a discontinuity at 0. This sort of point of non-differentiability is called a cusp. Functions may also not be differentiable because they go to infinity at a point, or oscillate infinitely frequently.

Understanding the derivative notation
The derivative notation is special and unique in mathematics. The most common notation for derivatives you'll run into when first starting out with differentiating is the Leibniz notation, expressed as $$\frac{dy}{dx}$$. You may think of this as "rate of change in $$y$$ with respect to $$x$$". You may also think of it as "infinitesimal value of $$y$$ divided by infinitesimal value of $$x$$". Either way is a good way of thinking, although you should remember that the precise definition is the one we gave above. Often, in an equation, you will see just $$\frac{d}{dx}$$, which literally means "derivative with respect to x". This means we should take the derivative of whatever is written to the right; that is, $$\frac{d}{dx}(x+2)$$ means $$\frac{dy}{dx}$$ where $$y=x+2$$.

As you advance through your studies, you will see that we sometimes pretend that $$dy$$ and $$dx$$ are separate entities that can be multiplied and divided, by writing things like $$dy=x^4dx$$. Eventually you will see derivatives such as $$\frac{dx}{dy}$$, which just means that the input variable of our function is called $$y$$ and our output variable is called $$x$$ ; sometimes, we will write $$\frac{d}{dy}$$ , to mean the derivative with respect to $$y$$ of whatever is written on the right. In general, the variables could be anything, say $$\frac{d\theta}{dr}$$.

All of the following are equivalent for expressing the derivative of $$y=x^2$$
 * $$\frac{dy}{dx}=2x$$
 * $$\frac{d}{dx}x^2=2x$$
 * $$dy=2x\,dx$$
 * $$f'(x)=2x$$
 * $$D(f(x))=2x$$

Exercises
Solutions

Differentiation Rules
The process of differentiation is tedious for complicated functions. Therefore, rules for differentiating general functions have been developed, and can be proved with a little effort. Once sufficient rules have been proved, it will be fairly easy to differentiate a wide variety of functions. Some of the simplest rules involve the derivative of linear functions.

Derivative of a constant function
For any fixed real number $$c$$ , $\frac{d}{dx}[c]=0$

Intuition
The graph of the function $$f(x)=c$$ is a horizontal line, which has a constant slope of 0. Therefore, it should be expected that the derivative of this function is zero, regardless of the values of $$x$$ and $$c$$.

Proof
The definition of a derivative is
 * $$\lim_{\Delta x\to 0}\frac{f(x+\Delta x)-f(x)}{\Delta x}$$

Let $$f(x)=c$$ for all $$x$$. (That is, $$f$$ is a constant function.) Then $$f(x+\Delta x)=c$$. Therefore
 * $$\frac{d}{dx}[c]=\lim_{\Delta x\to 0}\frac{c-c}{\Delta x}=\lim_{\Delta x\to 0}\frac{0}{\Delta x}$$

Let $$g(\Delta x)=\frac{0}{\Delta x}$$. To prove that $$\lim_{\Delta x\to 0}g(\Delta x)=0$$, we need to find a positive $$\delta$$ such that, for any given positive $$\varepsilon$$ , $$\Big|g(\Delta x)-0\Big|<\varepsilon$$ whenever $$0<|\Delta x-0|<\delta$$. But $$\Big|g(\Delta x)-0\Big|=0$$, so $$\Big|g(\Delta x)-0\Big|<\varepsilon$$ for any choice of $$\delta$$.

Examples

 * 1) $$\frac{d}{dx}[3]=0$$
 * 2) $$\frac{d}{dx}[z]=0$$

Note that, in the second example, $$z$$ is just a constant.

Derivative of a linear function
For any fixed real numbers $$m$$ and $$c$$ , $\frac{d}{dx}[mx+c]=m$ The special case $$\frac{dx}{dx}=1$$ shows the advantage of the $$\frac{d}{dx}$$ notation—rules are intuitive by basic algebra, though this does not constitute a proof, and can lead to misconceptions to what exactly $$dx$$ and $$dy$$ actually are.

Intuition
The graph of $$y=mx+c$$ is a line with constant slope $$m$$.

Proof
If $$f(x)=mx+c$$, then $$f(x+\Delta x)=m(x+\Delta x)+c$$. So,


 * $$f'(x)$$
 * $$=\lim_{\Delta x\to 0}\frac{m(x+\Delta x)+c-mx-c}{\Delta x}$$
 * $$=\lim_{\Delta x\to 0}\frac{m(x+\Delta x)-mx}{\Delta x}$$
 * $$=\lim_{\Delta x\to 0}\frac{mx+m\Delta x-mx}{\Delta x}$$
 * $$=\lim_{\Delta x\to 0}\frac{m\Delta x}{\Delta x}$$
 * $$=m$$
 * }
 * $$=\lim_{\Delta x\to 0}\frac{mx+m\Delta x-mx}{\Delta x}$$
 * $$=\lim_{\Delta x\to 0}\frac{m\Delta x}{\Delta x}$$
 * $$=m$$
 * }
 * $$=m$$
 * }
 * $$=m$$
 * }

Constant multiple and addition rules
Since we already know the rules for some very basic functions, we would like to be able to take the derivative of more complex functions by breaking them up into simpler functions. Two tools that let us do this are the constant multiple rule and the addition rule.

The Constant Rule
For any fixed real number $$c$$ , $\frac{d}{dx}\big[c\cdot f(x)\big]=c\cdot\frac{d}{dx}\big[f(x)\big]$ The reason, of course, is that one can factor $$c$$ out of the numerator, and then of the entire limit, in the definition. The details are left as an exercise.

Example

We already know that
 * $$\frac{d}{dx}\big[x^2\big]=2x$$

Suppose we want to find the derivative of $$3x^2$$




 * $$\frac{d}{dx}\big[3x^2\big]$$
 * $$=3\frac{d}{dx}\big[x^2\big]$$
 * $$=3\cdot2x$$
 * $$=6x$$
 * }
 * $$=3\cdot2x$$
 * $$=6x$$
 * }
 * $$=6x$$
 * }

Another simple rule for breaking up functions is the addition rule.

The Addition and Subtraction Rules
$\frac{d}{dx}\big[f(x)\pm g(x)\big]=\frac{d}{dx}\big[f(x)\big]\pm\frac{d}{dx}\big[g(x)\big]$

Proof

From the definition:

By definition then, this last term is $$ \frac{d}{dx} \left[f(x)\right] \pm \frac{d}{dx}\left[g(x)\right] $$
 * $$\lim_{\Delta x\to 0}\left[\frac{\big[f(x+\Delta x)\pm g(x+\Delta x)\big]-\big[f(x)\pm g(x)\big]}{\Delta x}\right]$$
 * $$=\lim_{\Delta x\to 0}\left[\frac{\big[f(x+\Delta x)-f(x)\big]\pm\big[g(x+\Delta x)-g(x)\big]}{\Delta x}\right]$$
 * $$=\lim_{\Delta x\to 0}\left[\frac{f(x+\Delta x)-f(x)}{\Delta x}\right]\pm\lim_{\Delta x\to 0}\left[\frac{g(x+\Delta x)-g(x)}{\Delta x}\right]$$
 * }
 * $$=\lim_{\Delta x\to 0}\left[\frac{f(x+\Delta x)-f(x)}{\Delta x}\right]\pm\lim_{\Delta x\to 0}\left[\frac{g(x+\Delta x)-g(x)}{\Delta x}\right]$$
 * }

Example

What is the derivative of $$3x^2+5x$$ ?


 * $$\frac{d}{dx}\big[3x^2+5x\big]$$
 * $$=\frac{d}{dx}\big[3x^2+5x\big]$$
 * $$=\frac{d}{dx}\big[3x^2\big]+\frac{d}{dx}\big[5x\big]$$
 * $$=6x+\frac{d}{dx}\big[5x\big]$$
 * $$=6x+5$$
 * }
 * $$=6x+\frac{d}{dx}\big[5x\big]$$
 * $$=6x+5$$
 * }
 * $$=6x+5$$
 * }
 * $$=6x+5$$
 * }

The fact that both of these rules work is extremely significant mathematically because it means that differentiation is linear. You can take an equation, break it up into terms, figure out the derivative individually and build the answer back up, and nothing odd will happen.

We now need only one more piece of information before we can take the derivatives of any polynomial.

The Power Rule
$\frac{d}{dx}\big[x^n\big]=nx^{n-1}$ This has been proved in an example in Derivatives of Exponential and Logarithm Functions where it can be best understood.

For example, in the case of $$x^2$$ the derivative is $$2x^1=2x$$ as was established earlier. A special case of this rule is that $$\frac{dx}{dx}=\frac{dx^1}{dx}=1x^0=1$$.

Since polynomials are sums of monomials, using this rule and the addition rule lets you differentiate any polynomial. A relatively simple proof for this can be derived from the binomial expansion theorem.

This rule also applies to fractional and negative powers. Therefore


 * $$\frac{d}{dx}\big[\sqrt x\big]$$
 * $$=\frac{d}{dx}\big[x^\frac12\big]$$
 * $$=\frac12x^{-\frac12}$$
 * $$=\frac{1}{2\sqrt x}$$
 * }
 * $$=\frac12x^{-\frac12}$$
 * $$=\frac{1}{2\sqrt x}$$
 * }
 * $$=\frac{1}{2\sqrt x}$$
 * }

Derivatives of polynomials
With these rules in hand, you can now find the derivative of any polynomial you come across. Rather than write the general formula, let's go step by step through the process.
 * $$\frac{d}{dx}\big[6x^5+3x^2+3x+1\big]$$

The first thing we can do is to use the addition rule to split the equation up into terms:
 * $$\frac{d}{dx}\big[6x^5\big]+\frac{d}{dx}\big[3x^2\big]+\frac{d}{dx}\big[3x\big]+\frac{d}{dx}[1]$$

We can immediately use the linear and constant rules to get rid of some terms:
 * $$\frac{d}{dx}\big[6x^5\big]+\frac{d}{dx}\big[3x^2\big]+3+0$$

Now you may use the constant multiplier rule to move the constants outside the derivatives:
 * $$6\frac{d}{dx}\big[x^5\big]+3\frac{d}{dx}\big[x^2\big]+3$$

Then use the power rule to work with the individual monomials:
 * $$6(5x^4)+3(2x)+3$$

And then do some algebra to get the final answer:
 * $$30x^4+6x+3$$

These are not the only differentiation rules. There are other, more advanced, differentiation rules, which will be described in a later chapter.

Exercises

 * Find the derivatives of the following equations:

Solutions