Differentiation from First Principles

In this section we define the derivative of a function.
Given a function \(f(x)\), its derivative is another function whose output value at any value of \(x\) equals the gradient of the curve \(y=f(x)\) at that same value of \(x\).

This is the "starting point" to our studies of calculus and more particularly of differentiation.

We start by learning what the derivative function is as well as gain some insight in what we'll be able to achieve with derivatives.
We then learn the formal definition of the derivative function \(f'(x)\) and see how to differentiate from first principles.

Tutorial

In the following tutorial we learn about the derivative function. In particular we learn what it is and what it is used for.
Although we don't learn how to find the derivative function in this tutorial it gives us a good understanding of what we'll be using derivatives and differentiation for. Make sure to watch it.

Derivatives & Differentiation

Given a function \(f(x)\), we define its derivative function as a second function whose value at any value of \(x\), say \(x=c\), equals to the gradient of the curve \(y=f(x)\) at the point along its curve at which \(x=c\).
Consequently, the derivative of a function (we usually just say "the derivative") is often referred to as its gradient function.

The derivative can be referred to using either of the following two notations: \[f'(x)\quad \text{or} \quad \frac{dy}{dx}\] Say we need to calculate the gradient of a curve \(y=f(x)\) at the point along its length with \(x\)-coordinate \(x=2\), we would calculate \(f'(2)\) and that would equal to the gradient of the curve at that point.

The process via which we find the derivative function is known as differentiation. We'll often see phrases such as "find the derivative", "differentiate the following function", or even "find the gradient function". Given a function \(f(x)\), all those phrases refer to the same task: finding the derivative function \(f'(x)\).

Exercise

The function defined by \(f(x)=\frac{x^3}{3}+x-2\) has derivative \(f'(x)=x^2+1\).
Using what you know so far about the derivate function, find the gradient of the curve \(y=\frac{x^3}{3}+x-2\) at:

  1. the point along its length with \(x\) coordinate \(x=1\)

  2. the point along its length with \(x\) coordinate \(x=-2\)

Answers Without Working

  1. The gradient at this point is \(f'(1) = 2\).
  2. The gradient at this point is \(f'(-2)=5\).

Solution With Working

To find the gradient of the curve at any value of \(x\), we use the derivative function \(f'(x)\).

  1. When \(x=1\), the derivative function, \(f'(x)=x^2+1\), is equal to: \[\begin{aligned} f'(1) &= 1^2+1 \\ &= 1+1 \\ f'(1)& = 2 \end{aligned}\] So the curve \(y=\frac{x^3}{3}+x-2\) has a gradient equal to \(2\), when at the point along its length with \(x\)-coordinate \(x=1\).

  2. When \(x=-2\), the derivative function is equal to: \[\begin{aligned} f'(-2) &= (-2)^2+1 \\ &= 4 + 1 \\ f'(-2) &= 5 \end{aligned}\] So at the point along its length with \(x\) coordinate \(x=-2\), the curve \(y=\frac{x^3}{3}+x-2\) has a gradient equal to \(5\).

Formula - Differentiation from first principles

The formula for differentiating functions from first principles, relies on the following fact:

The gradient of a curve at any point along its length equals to the gradient of the tangent to the curve at that same point.

Formula

Given a function \(f(x)\), its derivative function \(f'(x)\) can be obtained using the following: \[f'(x)=\lim_{h \to 0 } \begin{bmatrix} \frac{f\begin{pmatrix}x+h \end{pmatrix}-f \begin{pmatrix} x \end{pmatrix}}{h} \end{bmatrix}\] Using the fact that the derivative function can also be written \(\frac{dy}{dx}\), we'll sometimes see this definition of the derivative function written: \[\frac{dy}{dx}=\lim_{h \to 0 } \begin{bmatrix} \frac{f\begin{pmatrix}x+h \end{pmatrix}-f \begin{pmatrix} x \end{pmatrix}}{h} \end{bmatrix}\]

Exercise

  1. Differentiate the function defined by \(f(x)=x^2\) from first principles.


  2. Given the function \(f(x)=x^3\).

    1. Differentiate this function from first principles.

    2. Calculate the gradient of the curve \(y=x^3\) at the point along its curve at which \(x=2\).


  3. Given the function defined by the curve: \[y=3x^2+1\]

    1. Working from first principles, find \(\frac{dy}{dx}\).

    2. What is the gradient of the tangent to the curve \(y=3x^2+1\) when \(x=1\)?

Solution Without Working

  1. The derivative function is: \(f'(x)=2x\)


    1. The derivative function is \(f'(x)=3x^2\).

    2. The gradient of the curve at this point is \(f'(2)=12\).


    1. The derivative is \(\frac{dy}{dx} = 6x\).
    2. The tangent's gradient when \(x = 1\) is \(m = 6\).

Solution With Working

  1. Working from first principles, we write: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} \frac{f\begin{pmatrix}x+h \end{pmatrix}-f \begin{pmatrix} x \end{pmatrix}}{h} \end{bmatrix}\] Since \(f(x)=x^2\), \(f\begin{pmatrix}x+h\end{pmatrix}=\begin{pmatrix}x+h\end{pmatrix}^2\) and the definition leads us to: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} \frac{\begin{pmatrix}x+h \end{pmatrix}^2-x^2}{h} \end{bmatrix}\] We now simplify as much as possible: \[\begin{aligned} f'(x) & = \lim_{h \to 0 } \begin{bmatrix} \frac{\begin{pmatrix}x+h \end{pmatrix}^2-x^2}{h} \end{bmatrix} \\ & = \lim_{h \to 0 } \begin{bmatrix} \frac{x^2+2xh+h^2-x^2}{h} \end{bmatrix} \\ & = \lim_{h \to 0 } \begin{bmatrix} \frac{2xh+h^2}{h} \end{bmatrix} \\ f'(x) & = \lim_{h \to 0 } \begin{bmatrix} 2x+h \end{bmatrix} \end{aligned}\] The final step is to "take the limit".
    As \(h\) tends towards \(0\), \(2x+h\) will tend towards \(2x\) and so, in the limit: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} 2x+h \end{bmatrix} =2x\] So the derivative of \(f(x)=x^2\) is \(f'(x)=2x\).


    1. To differentiate from first principles we start from the definition of the derivative to write: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} \frac{f\begin{pmatrix}x+h \end{pmatrix}-f \begin{pmatrix} x \end{pmatrix}}{h} \end{bmatrix}\] Since \(f(x)=x^3\), \(f\begin{pmatrix}x+h\end{pmatrix} = \begin{pmatrix}x+h\end{pmatrix}^3\), so the definition of the derivative of \(f(x)\) is: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} \frac{\begin{pmatrix}x+h \end{pmatrix}^3-x^3}{h} \end{bmatrix}\] We now expand the \(\begin{pmatrix}x+h\end{pmatrix}^3\) term and simplify as much as possible: \[\begin{aligned} f'(x) &= \lim_{h \to 0 } \begin{bmatrix} \frac{\begin{pmatrix}x+h \end{pmatrix}^3-x^3}{h} \end{bmatrix}\\ & = \lim_{h \to 0 } \begin{bmatrix} \frac{x^3+3x^2h+3xh^2+h^3-x^3}{h} \end{bmatrix} \\ & = \lim_{h \to 0 } \begin{bmatrix} \frac{3x^2h+3xh^2+h^3}{h} \end{bmatrix} \\ f'(x) & = \lim_{h \to 0 } \begin{bmatrix} 3x^2+3xh+h^2 \end{bmatrix} \end{aligned}\] Finally, letting \(h\) tend towards \(0\), we can state that in the limit: \[f'(x) = \lim_{h \to 0 } \begin{bmatrix} 3x^2+3xh+h^2 \end{bmatrix} = 3x^2\] So the derivative of \(f(x)=x^3\) is \(f'(x)=3x^2\).

    2. The gradient of the curve \(y=x^3\) when \(x=2\) equals the value of the derivative function \(f'(x)\) at \(x=2\), that's: \[\begin{aligned} f'(2) &=3\times 2^2 \\ &= 3\times 4 \\ f'(2) &= 12 \end{aligned}\] We can now state that the gradient of the curve when \(x=2\) is equal to \(12\).

    1. We start from the definition of the derivative: \[\frac{dy}{dx}=\lim_{h \to 0 } \begin{bmatrix} \frac{f\begin{pmatrix}x+h \end{pmatrix}-f \begin{pmatrix} x \end{pmatrix}}{h} \end{bmatrix}\] Since \(f(x)=3x^2+1\), \(f\begin{pmatrix}x+h \end{pmatrix} = 3\begin{pmatrix}x+h\end{pmatrix}^2+1\).

      So the definition of the derivative leads to: \[\begin{aligned} \frac{dy}{dx} &=\lim_{h \to 0 } \begin{bmatrix} \frac{3\begin{pmatrix}x+h\end{pmatrix}^2+1- \begin{pmatrix} 3x^2+1 \end{pmatrix}}{h} \end{bmatrix}\\ &= \lim_{h \to 0 } \begin{bmatrix} \frac{3\begin{pmatrix}x^2+2xh+h^2\end{pmatrix}+1- 3x^2-1 }{h} \end{bmatrix} \\ &= \lim_{h \to 0 } \begin{bmatrix} \frac{3x^2+6xh+3h^2+1- 3x^2-1 }{h} \end{bmatrix} \\ &= \lim_{h \to 0 } \begin{bmatrix} \frac{6xh+3h^2}{h} \end{bmatrix} \\ \frac{dy}{dx} &= \lim_{h \to 0 } \begin{bmatrix} 6x+3h \end{bmatrix} \end{aligned}\] In the limit, letting \(h\) tend towards \(0\), we find the derivative: \[\frac{dy}{dx} = \lim_{h \to 0 } \begin{bmatrix} 6x+3h \end{bmatrix} = 6x\] We can now state: \[\frac{dy}{dx} = 6x\]

    2. By definition, the gradient of the tangent to the curve \(y=3x^2+1\) when \(x=1\) equals the gradient of the curve when \(x=1\), so it is equal to the value of the derivative when \(x=1\), that's: \[6\times 1 = 6\] The gradient of the tangent to the curve when \(x=1\) is equal to \(6\).