Derivative of a Function
In analysis, the derivative is a fundamental tool that is used to determine the rate of change of a function with respect to its independent variable. Along with limits and integrals, it is one of the core topics of a first course in real analysis.
To understand the core idea behind this mathematical operator, let us begin with a simple and informal example. Consider a car traveling along a road and suppose that the distance (denoted by the variable $s$) traveled by the car depends on time (denoted by the variable $t$).
Therefore, if we represent this distance as a function $f$ at a given time $t$, we can write:
$$ s = f(t) $$
Graphically, this is:

After an additional amount of time $h$, specifically at $t + h$, we measure the distance covered by the car again and we obtain:
$$ s' = f(t + h) $$
That is:

To determine the car’s covered distance during the time interval $h$, we can calculate:
$$ s' - s = f(t + h) - f(t) $$
Dividing this change in position by the length of the time interval gives:
$$ \frac{f(t+h) - f(t)}{h} $$
Specifically, this ration (known as the difference quotient) expresses the average rate of change of the function over the interval $[t, t + h]$. In our example, it represents the average velocity of the car over the time interval. Graphically, this is represented by:

However, this result only gives us the average rate of change over an interval. If our goal is instead to determine the instantaneous rate of change at a single instant $t$, we need a different approach. Specifically, we need to evaluate the limit of the difference quotient as $h \to 0$, that is:
$$ \lim_{h \to 0} \frac{f(t+h) - f(t)}{h} $$
Graphically, this corresponds to:

The limit of the difference quotient is called the derivative of the function $f$ at the point $t$ and it is denoted with one of the following notations:
$$ f'(t) = \frac{df}{dt} = \lim_{h \to 0} \frac{f(t+h) - f(t)}{h} $$
Moreover, notice that as $h \to 0$, both the numerator and the denominator tend to zero resulting in the an indeterminate form $[ 0/0 ]$.
Geometrical Interpretation
Let’s now go back to the last two diagrams and let’s try to formalize what the previous example conveys from a geometrical point of view. First of all, we notice that the line passing through the points of coordinates $(t, f(t))$ and $(t + h, f(t + h0)$ is a secant line whose slope measures the average rate of change in the interval $[t, t + h]$. In other words, this means that:
$$ m_{\text{sec}} = \frac{f(t+h) - f(t)}{h} $$
Let’s verify this analytically. From analytic geometry, we know that, given a line of equation:
$$ y = mx + q $$
the slope $m$ is determined by:
$$ m = \tan(\theta) = \frac{\Delta y}{\Delta x} = \frac{y_2 - y_1}{x_2 - x_1} $$
From the previous example, we have that:
- $y_1 = f(t)$ and $y_2 = f(t + h)$;
- $x_1 = t$ and $x_2 = t + h$.
And if we substitute these values on the previous fraction, we get:
$$ m_{\text{sec}} = \frac{f(t + h) - f(t)}{(t + h) - t} = \frac{f(t + h) - f(t)}{h} $$
Which is exactly what we wanted.
Now let’s study what happens when we take the limit as $h \to 0$ of $m_{\sec}$. Geometrically, this means that the point $(t + h, f(t + h))$ moves along the curve $f$ toward $(t, f(t))$ and that the secant line, as $h$ tends to zero, becomes a tangent line at $(t, f(t))$. Thus, the slope of the tangent line is exactly the limit of the slope of the secant line as $h \to 0$. In other words:
$$ m_{\text{tan}} = \lim_{h \to 0} m_{\text{sec}} = \lim_{h \to 0} \frac{f(t+h) - f(t)}{h} $$
But this is also the definition of the derivative. Hence, we can conclude that, from a geometrical interpretation, the derivative of a function at a point is precisely the slope of the tangent line to the curve at that point.
Definition
We are now ready to give a formal definition of a differentiable function.
Let $f : (a, b) \to \mathbb{R}$ be a function defined on an open interval $(a, b)$ and let $x \in (a, b)$ be a point. We say that the function $f$ is differentiable at $x$ if the following limit exists and is finite: $$ f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h} $$
When $f$ is differentiable $\forall x \in I \subseteq (a, b)$, we say that $f$ is differentiable on $I$.
Sometimes, it is also useful to consider one-sided derivatives; At a given point $x$, we can define the left-hand and right-hand derivatives of $f$ at $x$ whenever the following two limits exist:
$$ \lim_{h \to 0^-} \frac{f(x + h) - f(x)}{h}, \ \ \ \lim_{h \to 0^+} \frac{f(x + h) - f(x)}{h} $$
Furthermore, if the function $f$ is continuous at $x$ and both one-sided derivatives exist and are finite but:
$$ f_{-}'(x) \neq f_{+}'(x) $$
we say that the graph has a sharp corner at $x$. If, instead, the one-sided derivatives become infinite with opposite signs, that is:
$$ f_{-}'(x) = - \infty, \ \ \ f_{+}'(x) = + \infty $$
then, the graph may have a cusp at $x$.
Let’s now try to evaluate a derivative using the formal definition. For example, consider the following function:
$$ f(x) = x^2 + 3x $$
First of all, let’s determine $f(x + h)$:
$$ \begin{aligned} f(x + h) &= (x + h)^2 + 3(x + h)\\ &= (x^2 + 2xh + h^2) + (3x + 3h)\\ &= x^2 + 2xh + h^2 + 3x + 3h \end{aligned} $$
Now let’s subtract the original function $f(x)$ from this result:
$$ \begin{aligned} f(x + h) - f(x) &= (x^2 + 2xh + h^2 + 3x + 3h) - (x^2 + 3x)\\ &= 2xh + h^2 + 3h \end{aligned} $$
Finally, we divide this expression by $h$:
$$ \frac{2xh + h^2 + 3h}{h} = \frac{h(2x + h + 3)}{h} = 2x + h + 3 $$
This is the difference quotient. To calculate the derivative, let’s evaluate the following limit as $h \to 0$:
$$ \begin{aligned} f'(x) &= \lim_{h \to 0} (2x + h + 3)\\ &= 2x + 0 + 3\\ &= \boxed{2x + 3} \end{aligned} $$
As we saw, from a geometrically perspective, the derivative corresponds to the slope of the tangent line at any given point $x_0$. Let’s verify this analytically. First of all, let us choose a point $x_0 = 2$; thus, we can determine the equation of the tangent line using the following pencil of lines:
$$ y - y_0 = m(x - x_0) \iff y = y_0 + m(x - x_0) $$
In our case, this corresponds to:
$$ y = f(x_0) + f'(x_0)(x - x_0) $$
Let’s find out $f(x_0)$ and $f'(x_0)$:
$$ \begin{aligned} f(x_0) &= (2)^2 + 3(2) = 4 + 6 = 10,\\ f'(x_0) &= 2(2) + 3 = 4 + 3 = 7 \end{aligned} $$
Therefore, the equation of the tangent line is:
$$ \begin{aligned} y &= 10 + 7(x - 2)\\ &= 10 + 7x - 14\\ &\implies \boxed{y = 7x - 4} \end{aligned} $$
As we expected, the slope $m = 7$ equals the derivative $f'(x_0)$.
Algebraic Rules
Let’s now take a look at the main algebraic rules that allow us to quickly evaluate the derivatives of a function. Let’s start with the basic ones:
- Derivative of a constant: $\frac{d}{dx} [c] = 0$ with $c \in \mathbb{R}$;
- Derivative of $x$: $\frac{d}{dx} [x] = 1$;
- Derivative of a power: $\frac{d}{dx} [x^n] = nx^{n-1}$ with $n \in \mathbb{R}$;
- Derivative of the exponential: $\frac{d}{dx} [e^x] = e^x$;
Additionally, we can also evaluate the derivative of two or more functions. Formally:
Let $f, g : (a, b) \to \mathbb{R}$ be two functions defined on an open interval $(a, b)$ and let $x \in (a, b)$ be a point. If the functions $f$ and $g$ are both differentiable at $x$, then their sum, their product and their quotient are differentiable on $x$ as well.
In other words, this means that:
- Derivative of the sum/difference: $$ \frac{d}{dx} [f(x) \pm g(x)] = f'(x) \pm g'(x) $$
- Derivative of product: $$ \frac{d}{dx} [f(x) g(x)] = f'(x) g(x) + f(x) g'(x) $$
- Derivative of quotient: $$ \frac{d}{dx} \left[ \frac{f(x)}{g(x)} \right] = \frac{f'(x)g(x) - f(x) g'(x)}{g(x)^2}, \ \ \ g(x) \neq 0 $$
Let’s now look at some practical examples. Let us find the derivative of the following function:
$$ f(x) = 5x^4 - 3x^2 + 7 $$
This consists of a sum of powers, therefore:
$$ \begin{aligned} f'(x) &= \frac{d}{dx} [5x^4] - \frac{d}{dx} [3x^2] + \frac{d}{dx} [7]\\ &= \boxed{20x^3 - 6x} \end{aligned} $$
Another example:
$$ h(x) = x^2 \cdot \ln(x) $$
This is a product of functions where $f(x) = x^2$ and $g(x) = \ln(x)$, therefore we can apply the product rule. Let’s first compute $f'(x)$ and $g'(x)$:
$$ f'(x) = 2x, \ \ \ g'(x) = \frac{1}{x} $$
Therefore, we have that:
$$ \begin{aligned} h'(x) &= (2x)(\ln(x)) + (x^2) \left( \frac{1}{x} \right) \\ &= \boxed{2x \ln(x) + x} \end{aligned} $$
Last example:
$$ q(x) = \frac{\sin(x)}{x} $$
This is a fraction of functions where $f(x) = \sin(x)$ and $g(x) = x$; therefore we have that:
$$ f'(x) = \cos(x), \ \ \ g'(x) = 1 $$
Thus, we conclude that:
$$ q'(x) = \frac{x\cos(x) - \sin(x)}{x^2} $$
Another very useful rule is the so-called chain rule, which is used to evaluate the derivative of a composite function. It can be stated as follows:
Let $h(x) = (f \circ g)(x) = f(g(x))$, if $g$ is differentiable at $x$ and if $f$ is differentiable at $u = g(x)$, then: $$ h'(x) = f'(g(x)) \cdot g'(x) $$
Let us look at a simple example. Consider the function:
$$ h(x) = \ln(x^2 + 1) $$
Let $f(u) = \ln(u)$ be the outer function and let $g(x) = x^2 + 1$ with $u = g(x)$ be the inner function. Let’s start by taking the derivative of both the outer and the inner functions:
$$ f'(u) = \frac{d}{du} [ \ln(u) ] = \frac{1}{u} \implies f'(g(x)) = \frac{1}{x^2 + 1} $$
$$ g'(x) = \frac{d}{dx} [ x^2 + 1] = 2x $$
Finally, let’s apply the chain rule:
$$ \begin{aligned} h'(x) &= f'(g(x)) \cdot g'(x)\\ &= \frac{1}{x^2 + 1} \cdot 2x\\ &= \boxed{\frac{2x}{x^2 + 1}} \end{aligned} $$