We have learned the meaning of the first derivative of a function. Now we want to know what the second, the third, and the n-th derivatives of a function are defined and how we can calculate them.

If $s(t)$ is the position of an object moving on a straight line, then the derivative of s is the velocity of the object $v(t)=s'(t)$. The derivative of the velocity is the acceleration of the object $a(t)$. So $a(t)=v'(t)$ or $a(t)=(s’)'(t)$, which is often written simply as $a(t)=s^{\prime\prime}(t)$.We say the acceleration is the second derivative of the position. In physics, acceleration plays an important role as it appears in Newton’s second law $F=ma$.

In general, if we take the derivative of $y=f(x)$, we obtain a new function $f’$ (also denoted by $y’$ or $dy/dx$). We can take the derivative of $f’$ and obtain another function called the second derivative of $f$ (or $y$). The second derivative of $f(x)$ is denoted by $$f^{\prime\prime}(x)$$ or $$\dfrac{d}{dx}\left(\dfrac{dy}{dx}\right)$$, which is commonly abbreviated to $$\dfrac{d^{2}y}{dx^{2}}.$$ Thus $f^{\prime\prime}=(f’)^\prime$ or
$\bbox[#F2F2F2,5px,border:2px solid black]{f^{\prime\prime}(x)=\lim_{\Delta x\to0}\frac{f'(x+\Delta x)-f'(x)}{\Delta x}.\tag{a}}$
The second derivative is also indicated by $$y^{\prime\prime}$$ or $$\dfrac{d^{2}f}{dx^{2}}$$.

For example, if $$f(x)=x^{3}-5x^{2}+3x-1$$, then the first derivative is $y’=f'(x)=\frac{dy}{dx}=\frac{df}{dx}=3x^{2}-10x+3,$ and the second derivative of $$f$$ is the derivative of $$f'(x)$$:
$y^{\prime\prime}=f^{\prime\prime}(x)=\frac{d^{2}y}{dx^{2}}=\frac{d^2f}{dx^2}=6x-10.$

In a similar fashion, we can define the third derivative as the derivative of the second derivative. It is denoted by
$y^{\prime\prime\prime}=f^{\prime\prime\prime}(x)=\frac{d^{3}y}{dx^{3}}=\frac{d^{3}f}{dx^{3}};$
the fourth derivative is the derivative of the third derivative, and is denoted by
$y^{(4)}=f^{(4)}(x)=\frac{d^{4}y}{dx^{4}}=\frac{d^{4}f}{dx^{4}},$ and so on. In general, the $$n$$-th derivative of $$y=f(x)$$ is indicated by one of the following symbols:
$y^{(n)}=f^{(n)}(x)=\frac{d^{n}y}{dx^{n}}=\frac{d^{n}f}{dx^{n}}.$

• If $f^{(n)}(x_0)$ exists, then it is said that $f$ is $n$-times differentiable at $x_0$.
Example 1

If $$y=\sin x$$, find $$y^{(4)}.$$

Solution

\begin{align} y & =\sin x\\ y’&=\cos x\\ y^{\prime\prime}&=\frac{d}{dx}\cos x=-\sin x\\ y^{\prime\prime\prime} & =\frac{d}{dx}(-\sin x)=-\frac{d}{dx}\sin x=-\cos x\\ y^{(4)}&=\dfrac{d}{dx}(-\cos x)=-\dfrac{d}{dx}\cos x=-(-\sin x)=\sin x.\end{align}

Therefore, $y^{(4)}=y=\sin x$.

Example 2

For $$f(x)=-x^{5}+3x^{3}+2x^{2}-1$$, find $$f'(x),f^{\prime\prime}(x),f^{\prime\prime\prime}(x)$$, and $$f^{(4)}(x)$$.

Solution

\begin{align}f^{\prime}(x) &=-5x^{4}+9x^{2}+4x\\ f^{\prime\prime}(x) &=-20x^{3}+18x+4\\ f^{\prime\prime\prime}(x) &=-60x^{2}+18\\ f^{(4)}(x) &=-120x.\end{align}

Example 3

Determine $$a,b$$, and $$c$$ such that $$f^{\prime\prime}(x)$$ exists everywhere if
$f(x)=\begin{cases} x^{3} & \text{when }x\leq1\\ ax^{2}+bx+c & \text{when }x>1 \end{cases}.$

Solution

Because the second derivatives of $y=x^3$ and $y=ax^2+bx+c$ exist everywhere, no matter what $a, b$, and $c$ are $f^{\prime\prime}(x)$ exists everywhere, except possibly at $x=1$ where the formula of $f$ changes. So if we want to make $f$ twice differentiable everywhere, we have to choose $a, b$, $c$ such that $f^{\prime\prime}(1)$ exists.

We have three unknowns: $$a,b,c$$ and hence we need three equations. For $$f$$ to have a second derivative at $$x=1$$, we need

(1) $$f$$ to be continuous at $$x=1$$,
(2) $$f$$ to have a derivative at $$x=1$$ or $$f’_{-}(1)=f’_{+}(1)$$, and
(3) $$f_{+}^{\prime\prime}(1)=f_{-}^{\prime\prime}(1)$$.

Now

(1) The continuity of $$f$$ at $$x=1$$ implies $f(1)=1^{3}=a\cdot1^{2}+b\cdot1+c.\tag{i}$ (2) $$f$$ has a derivative at $$x=1$$. Thus
\begin{align} f’_{-}(1) & =f’_{+}(1)\\ \left.3x^{2}\right|_{x=1} & =\left.2ax+b\right|_{x=1}\\ 3 & =2a+b.\tag{ii}\end{align}
(3) $$f$$ has a second derivative at $$x=1$$. Thus
\begin{align} f^{\prime\prime}_{-}(1) & =f^{\prime\prime}_{+}(1)\\ \left.6x\right|_{x=1} & =\left.2a\right|_{x=1}\\ 6 & =2a\tag{iii }\end{align}

From (i), (ii), and (iii), we conclude
$a=3,\qquad b=-3,\quad\text{and}\quad c=1.$

• If a function is differentiable, its derivative is not necessarily differentiable. In other words, from the existence of $$f'(x_{0})$$, we cannot infer the existence of $$f^{\prime\prime}(x_{0})$$. For instance, see the following example.
Example 4

Let
$f(x)=\begin{cases} x^{2}\sin\frac{1}{x} & x\neq0\\ 0 & x=0 \end{cases}.$
Does $$f'(0)$$ exist? Is $$f'(x)$$ continuous at $$x=0$$?

Solution

To find $$f'(0)$$, we need to apply the definition of a derivative directly:
\require{cancel}\begin{align} f'(0) & =\lim_{\Delta x\to0}\frac{f(0+\Delta x)-\overset{0}{\cancel{f(0)}}}{\Delta x}\\ & =\lim_{\Delta x\to0}\frac{(\Delta x)^{2}\sin\dfrac{1}{\Delta x}}{\Delta x}\\ & =\lim_{\Delta x\to0}\left(\Delta x\sin\dfrac{1}{\Delta x}\right)\\ & =0.\end{align}
[Recall that $$\lim_{h\to0}h\sin\frac{1}{h}=0$$. See the Section on Theorems for Calculating Limits  for more information.]

When $$x\neq0$$, we can find $$f'(x)$$ by using differentiation rules:
$f(x)=\underbrace{x^{2}}_{u}\underbrace{\sin\frac{1}{x}}_{v}$
$f'(x)=\underbrace{2x}_{u’}\underbrace{\sin\frac{1}{x}}_{v}+\underbrace{x^{2}}_{u}\underbrace{\frac{d}{dx}\sin\frac{1}{x}}_{v’}\tag{i}$
To find $$\frac{d}{dx}\sin\frac{1}{x}$$ let $$w=\frac{1}{x}$$
\begin{align} \frac{d}{dx}\sin\frac{1}{x} & =\frac{d}{dx}\sin w\\ & =\frac{d}{dw}(\sin w)\times\frac{dw}{dx}\\ & =(\cos w)\left(-\frac{1}{x^{2}}\right)\\ & =\left(\cos\frac{1}{x}\right)\left(-\frac{1}{x^{2}}\right)\end{align}
[$$\frac{d}{dx}\frac{1}{x}=\frac{d}{dx}x^{-1}=-x^{-2}=-\frac{1}{x^{2}}$$]

Now we can simply plug the formula for $$\frac{d}{dx}\sin\frac{1}{x}$$ in (i)
\begin{align} f'(x) & =2x\sin\frac{1}{x}+x^{2}\left(-\frac{1}{x^{2}}\right)\left(\cos\frac{1}{x}\right)\\ & =2x\sin\frac{1}{x}-\cos\frac{1}{x}\quad(x\neq0)\end{align}
Therefore,
$f'(x)=\begin{cases} 2x\sin\frac{1}{x}-\cos\frac{1}{x} & \text{if }x\neq0\\ 0 & \text{if }x=0 \end{cases}.$
Because $$\cos(1/x)$$ moves up and down so quickly as $$x\to0$$, it does not approach a number, and $$\lim_{x\to0}\cos(1/x)$$ does not exists. Thus
\begin{align} \lim_{x\to0}f'(x) & =\lim_{x\to0}\left(2x\sin\frac{1}{x}-\cos\frac{1}{x}\right)\\ & =2\lim_{x\to0}x\sin\frac{1}{x}-\lim_{x\to0}\cos\frac{1}{x}\\ & =2(0)-DNE\end{align}
does not exists, and consequently $$f’$$ is not continuous at $$x=0$$.

• In the above example, $$f$$ is differentiable (= $$f'(x)$$ exists) everywhere. But because $$f'(x)$$ is not continuous at $$x=0$$, $$f^{\prime\prime}(0)$$ does not exist.