7.4: Differentiability
- Page ID
- 178858
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)As we gain more confidence in our ability to take the derivative limit, a natural question arises: will this limit always exist?
In \(\displaystyle{f'(a)=\lim_{x\to a}\frac{f(x)-f(a)}{x-a}}\), the denominator always goes to zero: \(\displaystyle{\lim_{x\to a} (x-a)=(a-a)=0}\)
That means if the numerator goes to anything besides zero, then \(f'(a)\) cannot be finite.
In order for \(f(x)\) to be differentiable at \(a\), (that just means \(f'(a)\) exists and is finite), we must have
\(\displaystyle{\lim_{x\to a} f(x)-f(a)=0}\)
Adding \(f(a)\) to both sides turns this into a familiar sight: \(\displaystyle{\lim_{x\to a} f(x)=f(a)}\)
A function must be continuous at \(a\) to be differentiable at \(a\)
For example if \(\textcolor{red}{f(x)=\left\{\begin{array} {ll} x & x\ne 2 \\ 5 & x=2 \end{array} \right. } \)

As you drag a blue dot toward \(x=2\), the slope becomes very large and negative
\(\textcolor{blue}{\displaystyle{\lim_{x\to 2^+} \frac{f(x)-f(2)}{x-2}=\lim_{x\to 2^+} \frac{x-5}{x-2}=\frac{-3}{0^+}=-\infty}}\)
As you drag a brown dot toward \(x=2\), the slope becomes very large and positive
\(\textcolor{brown}{\displaystyle{\lim_{x\to 2^-} \frac{f(x)-f(2)}{x-2}=\lim_{x\to 2^-} \frac{x-5}{x-2}=\frac{-3}{0^-}=+\infty}}\)
Since \(\displaystyle{ \textcolor{blue}{\lim_{x\to2^+}\frac{f(x)-f(2)}{x-2}} \ne \textcolor{brown}{ \lim_{x\to 2^-} \frac{f(x)-f(2)}{x-2}}}\) we know \(\textcolor{red}{f'(2)=\displaystyle{\lim_{x\to 2} \frac{f(x)-f(2)}{x-2}=DNE}}\)
Any type of discontinuity (removable, jump, infinite, or oscillating) at \(x=a\) will ensure that \(f'(a)\) does not exist, so \(f(x)\) is not differentiable at that point.
But does this mean that all continuous functions are differentiable?
Consider the absolute value function \(\textcolor{red}{f(x)=|x|=\left\{ \begin{array} {ll} x & x\ge 0 \\ -x & x<0 \end{array} \right. }\)
We can see from the graph that this function is continuous everywhere (including \(x=0\))

But is it differentiable? We can check by taking some limits:
For \(a>0\), we get \(\displaystyle{f'(a)=\lim_{x\to a} \frac{|x|-|a|}{x-a}=\lim_{x\to a} \frac{x-a}{x-a}=\lim_{x\to a}1=1}\)
This is because for positive \(a\), \(f(x)\) acts like \(y=x\) which has slope \(1\)
For \(a<0\), \(\displaystyle{f'(a)=\lim_{x\to a} \frac{|x|-|a|}{x-a}=\lim_{x\to a} \frac{(-x)-(-a)}{x-a}=\lim_{x\to a}\frac{-(x-a)}{x-a}=\lim_{x\to a} -1=-1}\)
This is because for negative \(a\), \(f(x)\) acts like \(y=-x\) which has slope \(-1\)
That only leaves \(a=0\): \(\displaystyle{f'(0)=\lim_{x\to 0} \frac{|x|-|0|}{x-0}=\lim_{x\to 0} \frac{|x|}{x}}\)
But \(\displaystyle{\lim_{x\to 0^+} \frac{|x|}{x}=\lim_{x\to 0^+}\frac{x}{x}=\lim_{x\to 0^+}1=1}\) and \(\displaystyle{\lim_{x\to 0^-} \frac{|x|}{x}=\lim_{x\to 0^-}\frac{-x}{x}=\lim_{x\to 0^-}-1=-1}\)
Therefore \(f'(0)=DNE\) and \(f(x)\) is not differentiable at \(x=0\).
So not all continuous functions are differentiable (but all differentiable functions must be continuous!)
Anytime your function \(f(x)\) has a sharp turn where the slope on the left and right side of \((a,f(a))\) changes instantly, the limit for \(f'(a)\) will not exist.
Thus, any function with a sharp turn will not be differentiable at that point.
Another example of a continuous but not differentiable function is \(\textcolor{red}{f(x)=\sqrt[3]{x}}\):
For \(a\ne 0\) we can calculate:
\(f'(a)=\displaystyle{\lim_{x\to a} \frac{\sqrt[3]{x}-\sqrt[3]{a}}{x-a}\cdot \textcolor{purple}{\frac{\sqrt[3]{x^2}+\sqrt[3]{ax}+\sqrt[3]{a^2}}{\sqrt[3]{x^2}+\sqrt[3]{ax}+\sqrt[3]{a^2} }} =\lim_{x\to a} \frac{(\sqrt[3]{x})^3-(\sqrt[3]{a})^3}{(x-a)\left(\sqrt[3]{x^2}+\sqrt[3]{ax}+\sqrt[3]{a^2}\right)}}\)
\(=\displaystyle{\lim_{x\to a} \frac{x-a}{(x-a)\left(\sqrt[3]{x^2}+\sqrt[3]{ax}+\sqrt[3]{a^2}\right)} =\lim_{x\to a} \frac{1}{ \sqrt[3]{x^2}+\sqrt[3]{ax}+\sqrt[3]{a^2} }=\frac{1}{3\sqrt[3]{a^2}}} \)
But when \(a=0\), this looks like:
\(f'(0)=\displaystyle{\lim_{x\to a} \frac{\sqrt[3]{x}-\sqrt[3]{0}}{x-0}=\lim_{x\to 0} \frac{\sqrt[3]{x}}{x}=\lim_{x\to 0} \frac{1}{\sqrt[3]{x^2}}=\frac{1}{0^+}=+\infty} \)

While there is still a tangent line to this function at \((0,0)\), it is a vertical line (which has no slope).
In this scenario we still say that \(f'(0)\) is undefined, since functions must output finite values.
A function is not differentiable at \((a,f(a))\) if it has an infinite slope.
Therefore a function is differentiable at a point as long as both:
(i) it is continuous,
(ii) it does not have a sharp turn or infinite slope.
Keep those rules in mind when taking the derivative of a piecewise function:
Find the derivative of \(f(x)=\left\{ \begin{array} {ll} x^2+x & x\ge 1 \\ 3x-1 & x<1 \end{array} \right.\)
Solution
First consider \(a>1\):
\(f'(a)=\displaystyle{\lim_{h\to 0} \frac{f(a+h)-f(a)}{h}=\lim_{h\to 0} \frac{\left((a+h)^2+(a+h)\right)-(a^2+a)}{h}}\)
\( =\displaystyle{\lim_{h\to 0} \frac{\left(a^2+2ah+h^2+a+h\right)-(a^2+a)}{h}=\lim_{h\to 0} \frac{ 2ah+h^2 +h }{h}=\lim_{h \to 0} (2a+h+1)=2a+1}\)
Then consider \(a<1\):
\(f'(a)=\displaystyle{\lim_{h\to 0} \frac{f(a+h)-f(a)}{h}}=\displaystyle{\lim_{h\to 0} \frac{\left(3(a+h)-1\right)-(3a-1)}{h}} =\displaystyle{\lim_{h\to 0} \frac{3h}{h}=\lim_{h\to 0} 3 =3}\)
Lastly when \(a=1\):
\(\displaystyle{\lim_{x\to 1^+} \frac{f(x)-f(1)}{x-1}=\lim_{x\to 1^+} \frac{(x^2+x)-2}{x-1}}=\displaystyle{ \lim_{x \to 1^+} \frac{(x+2)(x-1)}{x-1}=\lim_{x\to 1^+} (x+2)=3}\)
\(\displaystyle{\lim_{x\to 1^-} \frac{f(x)-f(1)}{x-1}=\lim_{x\to 1^-} \frac{(3x-1)-2}{x-1}=\lim_{x \to 1^+} \frac{3(x-1)}{x-1}=\lim_{x\to 1^+} 3=3}\)
Since these limits are finite and match, we know there is no infinite slope or sharp turn and \(f'(1)=3\)
So our final answer is \(f'(a)=\left\{ \begin{array} {ll} 2a+1 & a>1 \\ 3 & a\le 1\end{array} \right.\)
Similar to continuity, we can try to make a piecewise function differentiable:
For what \(\alpha,\beta\) does \(f'(3)\) exist in \(f(x)=\left\{ \begin{array} {ll} \sqrt{x+\alpha} & x< 3 \\ -\frac{3}{2x}+\beta & x\ge 3 \end{array} \right.\)
Solution
We need to make sure that two pairs of limits match. First we need continuity at \(x=3\):
\( \textcolor{green}{\displaystyle{\lim_{x\to 3^+} f(x)=\lim_{x\to 3^+} -\frac{3}{2x}+\beta=-\frac{1}{2}+\beta=f(3)}} \)
\( \textcolor{brown}{\displaystyle{\lim_{x\to 3^-} f(x)=\lim_{x\to 3^-} \sqrt{x+\alpha}=\sqrt{3+\alpha}}} \)
So to be continuous, we must have \(\displaystyle{\textcolor{green}{-\frac{1}{2}+\beta} =\textcolor{brown}{\sqrt{3+\alpha}}}\)
To be differentiable, we also need the slope to match on both sides of \(x=3\): \(\displaystyle{\lim_{x\to 3^+}\frac{f(x)-f(3)}{x-3}=\lim_{x\to 3^-}\frac{f(x)-f(3)}{x-3}}\)
\(\displaystyle{\lim_{x\to 3^+} \frac{f(x)-f(3)}{x-3}=\lim_{x\to 3^+} \frac{\left( -\frac{3}{2x}+\beta\right)-\left(-\frac{1}{2}+\beta\right)}{x-3}=\lim_{x\to 3^+} \frac{ -\frac{3}{2x} + \frac{1}{2} }{x-3}\cdot \textcolor{orange}{\frac{2x}{2x}}}\)
\(\displaystyle{=\lim_{x\to 3^+} \frac{-3+x}{2x(x-3)}=\lim_{x\to 3^+} \frac{x-3}{2x(x-3)}=\lim_{x\to 3^+} \frac{1}{2x}=\frac{1}{6}}\)
\(\displaystyle{\lim_{x\to 3^-} \frac{f(x)-f(3)}{x-3}=\lim_{x\to 3^-} \frac{ \sqrt{x+\alpha}-\left(\textcolor{green!40!black!70}{-\frac{1}{2}+\beta}\right)}{x-3}=\lim_{x\to 3^-} \frac{ \sqrt{x+\alpha}-\textcolor{brown}{\sqrt{3+\alpha}} }{x-3}\cdot \textcolor{orange}{\frac{\sqrt{x+\alpha}+\sqrt{3+\alpha}}{\sqrt{x+\alpha}+\sqrt{3+\alpha}}}}\)
\(\displaystyle{=\lim_{x\to 3^-} \frac{ (x+\alpha)-(3+\alpha)}{(x-3)(\sqrt{x+\alpha}+\sqrt{3+\alpha})}=\lim_{x\to 3^-} \frac{ x-3}{(x-3)(\sqrt{x+\alpha}+\sqrt{3+\alpha})} =\lim_{x\to 3^-} \frac{ 1}{\sqrt{x+\alpha}+\sqrt{3+\alpha}}= \frac{ 1}{2\sqrt{3+\alpha}} }\)
Setting these slopes equal to each other, we need \(\displaystyle{ \frac{1}{2\sqrt{3+\alpha}}=\frac{1}{6}}\), which gives \(\alpha=6\)
This makes the first equation we found turn into \(\displaystyle{\textcolor{green}{-\frac{1}{2}+\beta}=\textcolor{brown}{\sqrt{3+6}}}\) giving \(\beta=\displaystyle{\frac{7}{2}}\)
So if \(\alpha=6\) and \(\beta=\displaystyle{\frac{7}{2}}\) then \(f'(3)=\displaystyle{\frac{1}{6}}\)


