Because $$f'(x)$$ (or $$dy/dx$$) is in general a function of $$x$$, it may be differentiated with respect to $$x$$. The result is called the second derivative of $$f$$ (or $$y$$) with respect to $$x$$ and is denoted by $$f^{\prime\prime}(x)$$ or $$\dfrac{d}{dx}\left(\dfrac{dy}{dx}\right)$$, which is commonly abbreviated into $$\dfrac{d^{2}y}{dx^{2}}.$$ Thus
$\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 $\frac{dy}{dx}=y’=f'(x)=3x^{2}-10x+3,$ and the second derivative of $$f$$ is the derivative of $$f'(x)$$:
$\frac{d^{2}y}{dx^{2}}=y^{\prime\prime}=f^{\prime\prime}(x)=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^{4}}=\frac{d^{4}f}{dx^{4}};$
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}}.$

Example 1

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

Solution

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

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

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 Section 4.4  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.