1 Week 1

To start our exploration of the calculus, we start in lecture 1 with a look at the concept of limits of functions. We then consider the definition of the derivative of a function from first principles before looking at a few simple rules that enable us to evaluate some derivatives more easily than by first principles.

1.1 Limits

In some cases, the value of a function at a point is undefined or cannot be determined. For example \[ f(x) = \frac{x^2-9}{x-3}\tag{1} \] has the value \(\frac00\) for \(f(3)\), which is undetermined. However the function may still “behave well” around that point. In such cases it is convenient to introduce the idea of a limit or a limiting value.

Informally, a limit is a value which \(f(x)\) gets closer and closer to, but may never actually reach.

For example, the function \(f(x) = e^{-x}\) as it approaches the \(x-\)axis (Figure 1.1).

$e^{-x}$

Figure 1.1: \(e^{-x}\)

In function (1) above, we can try to determine the limit \(f(x)\) as \(x\) gets closer to \(3\). \[ f(x) = \frac{x^2-9}{x-3} = \frac{(x-3)(x+3)}{x-3} = x+3. \] (However, the last “\(=\)” is only valid for \(x\not=3\)!)

Now if \(x\) gets closer to \(3\), then \(x+3\) gets closer to \(6\). Formally we write \[ \lim\limits_{x\to3} f(x) = 6 \] and we say “in the limit, if \(x\) tends to \(3\) then \(f(x)\) tends to 6”.

We can approach this in a slightly different way, by first letting \(x = a+3\) so that \[\begin{align*} f(x) &= f(a+3) = \frac{(a+3)^2-9}{(a+3)-3} = \frac{a^2+6a + 9 - 9}{a} =\\ &= \frac{a^2+6a}{a} = a+6. \end{align*}\] Now we can observe, that \(a\) gets closer to \(0\) if and only if \(x\) gets closer to \(3\). As \(a\) approaches \(0\) then \(f(a+3)\) approaches \(6\). So \[ \lim\limits_{x\to3}f(x) = \lim\limits_{a\to0}f(a+3) = 6. \]

(Why would we do this?)

Note that the limit is not the same thing as substituting the value of \(x=3\) into the function \(f(x)\), as \(f(x)\) is not defined at the value \(x=3\). We say that \(f\) is “discontinuous” at \(x=3\).

A function \(f\) of \(x\) is said to be continuous at the value \(x=a\) if:

  • \(f\) is defined at \(a\), and
  • the value of the limit of \(f(x)\) as \(x\) tends to \(a\) is equal to \(f(a)\).

In other words \[ \lim\limits_{x\to a}f(x) = f(a). \]

Formally, a function \(f\) of \(x\) is said to be discontinuous at \(x=a\) if it is not continuous at \(x=a\).

Example 1.1 Determine the limit of \[ \frac{2x^2-5x-3}{x-3} \] as \(x\) tends to \(3\).

Solution. Let \(x = a+3\) so that as \(a\) tends to \(0\) then \(x\) tends to \(3\). Then \[ f(a+3) = \frac{2(a+3)^2-5(a+3)-3}{(a+3)-3}=\frac{2a^2+12a+18-5a-15-3}{a}=\frac{2a^2+7a}{a} = a+7. \] So \[ \lim\limits_{x\to3}\frac{2x^2-5x-3}{x-3} = \lim\limits_{x\to3}f(x) = \lim\limits_{a\to0}f(a+3) = \lim\limits_{a\to0}2a+7 = 7. \] Alternatively, you may spot that \(2x^2-5x-3 = (x-3)(2x+1)\) so that \[ \lim\limits_{x\to 3}f(x) = \lim\limits_{x\to3}\frac{(x-3)(2x+1)}{x-3} = \lim\limits_{x\to3}2x+1 = 7. \]

1.2 Differentiation from 1st Principles

For a straight line we can consider the slope or gradient. This is a measure of how steep the line is, see Figure 1.2.

gradient of a line

Figure 1.2: gradient of a line

The gradient is defined to be the number \[ \frac{\Delta y}{\Delta x} = \frac{y_2-y_1}{x_2-x_1}. \] For the line above, which has equation \(y = 2x-1\) then \[\begin{align*} \frac{\Delta y}{\Delta x} &= \frac{(2x_2-1)-(2x_1-1)}{x_2-x_1} = \frac{2(x_2-x_1)-1+1}{x_2-x_1}\\ &= \frac{2(x_2-x_1)}{x_2-x_1} = 2. \end{align*}\]

Suppose now we are given a curve with equation \(y=f(x)\) and want to find the gradient of a line segment joining two points on the curve (Figure 1.3).
line segment of a curve

Figure 1.3: line segment of a curve

The gradient of this line segment is given by \[ \frac{\Delta y}{\Delta x} = \frac{f(x+h)-f(x)}{h}. \]

Notice that when \(h=0\) then this would have the indeterminate value of \(0/0\), and so the gradient is undefined when the two points on the line coincide. However, the limit of this expression, as \(h\to0\), may exist and it is instructive to imagine what the limit would represent geometrically (Figure 1.4):

Press the button and see what happens to the line segment as \(h\to0\).

With some thought, it should be clear that the line segment tends to a line that just meets the curve at the point \((x,f(x))\), and we call this line the tangent to the curve at the point \((x,f(x))\).

line segment of a curve

Figure 1.4: line segment of a curve

We call the slope of the tangent line the derivative of the function \(y=f(x)\) at the point \(x\) and write \[ \frac{\mathrm{d} f}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} \] and we refer to the process of calculating this limit as differentiation by 1st principles.

Example 1.2 Find the derivative by 1st principles for the function \(f(x) = x^2\) at the point \(x\).

Solution. \[\begin{gather*} \frac{\mathrm{d} f}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} = \lim\limits_{h\to0}\frac{(x+h)^2 - x^2}{h} = \lim\limits_{h\to0}\frac{(x^2+2xh+h^2)-x^2}{h}\\ = \lim\limits_{h\to0}\frac{2xh+h^2}{h} = \lim\limits_{h\to0}(2x+h) = 2x. \end{gather*}\]

Example 1.3 Find the derivative by 1st principles for the function \(f(x) = x^3\) at the point \(x\).

Solution. \[\begin{gather*} \frac{\mathrm{d} f}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} = \lim\limits_{h\to0}\frac{(x+h)^3 - x^3}{h} = \lim\limits_{h\to0}\frac{(x^3+3x^2h+3xh^2+h^3)-x^2}{h}\\ = \lim\limits_{h\to0}\frac{3x^2h+3xh^2+h^3}{h} = \lim\limits_{h\to0}(3x^2+3xh+h^2) = 3x^2. \end{gather*}\]

Example 1.4 Find the derivative by 1st principles for the function \(f(x) = 1/(2x-1)\) at the point \(x\).

Solution. Notice that \[\begin{gather*} f(x+h)-f(x) = \frac{1}{2(x+h)-1} - \frac{1}{2x-1} =\\ \frac{2x+1-\left(2(x+h)-1\right)}{\left(2(x+h)-1\right)\left(2x-1)\right)} = \frac{-2h}{(2x+2h-1)(2x-1)}, \end{gather*}\] and so \[\begin{gather*} \frac{f(x+h)-f(x)}{h} = \frac{-2h}{h(2x+2h-1)(2x-1)} = \frac{-2}{(2x+2h-1)(2x-1)}. \end{gather*}\] Hence \[\begin{gather*} \frac{\mathrm{d} f}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} = \lim\limits_{h\to0}\frac{-2}{(2x+2h-1)(2x-1)} = \frac{-2}{(2x-1)(2x-1)} = \frac{-2}{(2x-1)^2}. \end{gather*}\]

1.3 Differentiation by Rule

To summarise: we can differentiate a function by calculating a certain limit.

Can we do “better” so that we don’t have to do this every time?

If we denote \(y = f(x)\), there are a few ways to denote the derivative: \[ \frac{\mathrm{d} f}{\mathrm{d} x} = \frac{\mathrm{d} y}{\mathrm{d} x} = f'(x). \] These all mean the same thing, namely the derivative of \(y=f(x)\) at the point \(x\), which is defined to be (recall) \[ \frac{\mathrm{d} f}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h}. \]

1.3.1 Rule for differentiation

Consider the differentiation of \(y = x^n\) from first principles. We have \(f(x+h) = (x + h)^n\).

Expanding the right-hand side using the binomial theorem gives \[ f(x+h) = x^n + nx^{(n-1)}h+\frac{n(n-1)}{2!}x^{n-2}h^2+\ldots+h^n \] So that \[ f(x+h)-f(x) = xn^{n-1}h+\frac{n(n-1)}{2!}x^{n-2}h^2+\ldots + h^n, \] and thus \[ \frac{f(x+h)-f(x)}{h} = xn^{n-1}+\frac{n(n-1)}{2!}x^{n-2}h+\ldots + h^{n-1}, \] Now, taking limit we have \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} = nx^{n-1}. \] Therefore, in general, we can differentiate \(x^n\) for all values of \(n\) using the rule \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{\mathrm{d} (x^n)}{\mathrm{d} x} = nx^{n-1}. \] This is known as the rule for differentiation (well, one of the rules, there is a number of them for various types of functions).

Example 1.5 Find the derivative by rule for the function \(y = x^4\) at the point \(x\).

Solution. \[\begin{gather*} \frac{\mathrm{d} y}{\mathrm{d} x} = 4x^3. \end{gather*}\]

In words, the rule is: multiply the function by the exponent and then reduce the value of the exponent by one.

In fact this rule is also true for any real number in the exponent, not just when it is a positive integer.

1.3.2 Differentiation of \(ax^n\).

Where a power of \(x\) is multiplied by a constant, that constant remains unchanged by the process of differentiation. For example \[ y = ax^n \Rightarrow \frac{\mathrm{d} y}{\mathrm{d} x} = nax^{n-1}. \]

Example 1.6 Find the derivative by rule for the function \(y = 3x^4\) at the point \(x\).

Solution. \[\begin{gather*} \frac{\mathrm{d} y}{\mathrm{d} x} = 3\times4x^3 = 12 x^3. \end{gather*}\]

Note that the derivative of \(ax\) and of \(a\) also follow the rule. For \(ax\) we may write \(ax = ax^1\). So differentiating by rule \[ \frac{\mathrm{d} y}{\mathrm{d} x} = a\times1x^0 = a. \] For \(a\) we may write \(a = ax^0\) and hence differentiating by rule we have \[ \frac{\mathrm{d} y}{\mathrm{d} x} = a\times0x^{-1} = 0. \] That is to say, the derivative of a constant value is always zero.

The above rule works in a more general situation. If \(f(x) = ag(x)\) where \(a\) is a constant and \(g(x)\) is a function, then \[\begin{align*} \frac{\mathrm{d} f}{\mathrm{d} x} &= \lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h} = \lim\limits_{h\to0}\frac{ag(x+h)-ag(x)}{h} \\ &= a\lim\limits_{h\to0}\frac{g(x+h)-g(x)}{h} = a\frac{\mathrm{d} g}{\mathrm{d} x}. \end{align*}\]

1.3.3 Differentiation of a sum of terms

If we have to differentiate more terms added together, then we differentiate each term separately and add them together. This is illustrated with the following example.

Example 1.7 Find the derivative by rule for the function \(y = 4x^5+3x^2-6x\) at the point \(x\).

Solution. \[\begin{gather*} \frac{\mathrm{d} y}{\mathrm{d} x} = 4\times5x^4 + 3\times 2x^1 - 6\times1 = 20x^4+6x-6 \end{gather*}\]

To summarise, so far we have the following rules for differentiation:

\[\begin{align*} \frac{\mathrm{d}(x^n)}{\mathrm{d} x} &= nx^{n-1}\text{ for }n\in{\mathbb R}\\ \frac{\mathrm{d}(ag(x))}{\mathrm{d} x} &= a\frac{\mathrm{d} g}{\mathrm{d} x}\\ \frac{\mathrm{d}(f(x)+g(x))}{\mathrm{d} x} &= \frac{\mathrm{d} f}{\mathrm{d} x}+\frac{\mathrm{d} g}{\mathrm{d} x}. \end{align*}\]

1.4 Standard Derivatives

The derivatives in the following table are well-known and may be quoted without having to explain where they come from.

\(\mathbf{f(x)}\) \(\mathbf{f'(x)}\)
\(e^x\) \(e^x\)
\(\ln(x)\) \(\frac{1}{x}\)
\(\sin(x)\) \(\cos(x)\)
\(\cos(x)\) \(-\sin(x)\)
\(\tan(x)\) \(\sec^2(x)\)
\(\csc(x)\) \(-\csc(x)\cot(x)\)
\(\sec(x)\) \(\sec(x)\tan(x)\)
\(\cot(x)\) \(-\csc(x)\)