This is a note written to address an issue we had in Tueday’s tutorial. Specifically the method I have shown you for doing one of the types of differentiability questions is somewhat flawed. There are a number of further assumptions that we need to make in order to make the analysis correct. I apologise for this oversight. However all is not lost – we can still ‘fix’ our (easier) method by taking these additional assumptions into account.

This question will now not be examinable in your summer exam.

The Question

Let f:\mathbb{R}\rightarrow \mathbb{R} be defined by:

f(x):=\left\{\begin{array}{cc}x^2&\text{ if }x\geq0\\ 0&\text{ if }x<0\end{array}\right.

Show that f is differentiable but not twice differentiable.


The Flawed* Solution

Away from 0, f is a polynomial and hence differentiable with derivative:

f'(x)=\left\{\begin{array}{cc}2x & \text{ if }x>0\\ 0 & \text{ if }x<0\end{array}\right.

Now

\lim_{x\rightarrow 0^+}f'(x)=\lim_{x\rightarrow 0^+}2x=0.

and

\lim_{x\rightarrow 0^-}f'(x)=\lim_{x\rightarrow 0^-}0=0.

Hence \lim_{x\rightarrow 0}f'(x) exists as the left and right derivatives are equal, hence f is differentiable.

 

Away from 0, f is a polynomial and hence twice differentiable:

f''(x)=\left\{\begin{array}{cc}2 & \text{ if }x>0\\ 0 & \text{ if }x<0\end{array}\right.

Now

\lim_{x\rightarrow 0^+}f''(x)=\lim_{x\rightarrow 0^+}2=2

and

\lim_{x\rightarrow 0^-}f''(x)=\lim_{x\rightarrow 0^-}0=0

Hence \lim_{x\rightarrow 0}f''(x) does not exist hence f is not twice differentiable \Box

* this method leads to the correct conclusion, and it will do so for all cases we would encounter in MS 2001.

 

Essentially the error that was made by me was confusion in the definition of the left- and right-hand derivatives. Let f:\mathbb{R}\rightarrow\mathbb{R} and a\in\mathbb{R}.

Left- and right-hand Derivatives: Correct Definition

Right-hand Derivative at a: f'_+(a):= \lim_{h\rightarrow 0^+}\frac{f(a+h)-f(a)}{h}.

Left-hand Derivative at a: f'_-(a):= \lim_{h\rightarrow 0^-}\frac{f(a+h)-f(a)}{h}.

Left- and right-hand Derivatives: Incorrect Definition

Right-hand Derivative at a: \lim_{x\rightarrow a^+}f'(x).

Left-hand Derivative at a: \lim_{x\rightarrow a^-}f'(x).

Theorem

Let f:\mathbb{R}\rightarrow \mathbb{R} and a\in\mathbb{R}. f is differentiable at a if and only if the left- and right-hand derivatives exist and are equal.

 

Towards a Correct Analysis

The above flawed solution more-or-less looks at the function and says well it’s smooth there because the derivatives are matching up on both sides – i.e as a function, f'(x) is continuous so f must be differentiable (click to sharpen):

A plot of f(x)

A plot of f'(x).

We will see later that by this flawed analysis a discontinuous function can be differentiable with continuous derivative (!).

The Correct Solution

Away from 0, f is a polynomial and hence differentiable with derivative:

f'(x)=\left\{\begin{array}{cc}2x & \text{ if }x>0\\ 0 & \text{ if }x<0\end{array}\right.

Now

f'_+(0)=\lim_{h\rightarrow 0^+}\frac{f(0+h)-f(0)}{h}=\lim_{h\rightarrow0^+}\frac{h^2-0}{h}=\lim_{h\rightarrow 0^+}h=0.

and

f'_-(0)=\lim_{h\rightarrow 0^-}\frac{f(0+h)-f(0)}{h}=\lim_{h\rightarrow0^-}\frac{0-0}{h}=\lim_{h\rightarrow 0^-}=0.

Hence \lim_{x\rightarrow 0}f'(x) exists as the left- and right-hand derivatives are equal, hence f is differentiable.

Away from 0, f is a polynomial and hence twice differentiable:

f''(x)=\left\{\begin{array}{cc}2 & \text{ if }x>0\\ 0 & \text{ if }x<0\end{array}\right.

Now

f''_+(0)= \lim_{h\rightarrow 0^+}\frac{f'(0+h)-f'(0)}{h}=\lim_{h\rightarrow 0^+}\frac{2h-0}{h}=\lim_{h\rightarrow 0^+}2=2

and

f''_-(0)= \lim_{h\rightarrow 0^-}\frac{f'(0+h)-f'(0)}{h}=\lim_{h\rightarrow 0^-}\frac{0-0}{h}=\lim_{h\rightarrow 0^-}0=0

Hence f''(0) does not exist hence f is not twice differentiable \Box

What is wrong with the “flawed solution”?

Two counterexamples show that our original analysis is flawed (the second is not as important to us but is relevant in a subsequent proof):

Example 1:

Let

H(x)=\left\{\begin{array}{cc}0 & \text{ if }x<0\\ 1 &\text{ if }x\geq0\end{array}\right.

A plot of H(x)

Now geometrically it is clear that H is does not have a well-defined tangent at x=0. Even more straightforwardly, we can see that H is not continuous at x=0 and recalling the following theorem (and it’s contrapositive):

differentiable \Rightarrow continuous

not continuous \Rightarrow not differentiable,

It is clear that H is not differentiable at x=0 yet

H'(x)=\left\{\begin{array}{cc}0 & \text{ if }x<0\\ 0 &\text{ if }x>0\end{array}\right.,

thus,

\lim_{x\rightarrow 0^+}H'(x)=0=\lim_{x\rightarrow 0^-}H'(x)

and so our flawed analysis would suggest that H is differentiable at x=0 (and indeed infinitely differentiable).  Our analysis is suggesting that the discontinuous function H(x) is differentiable with continuous derivative (!).

Hence if the ‘flawed method’ is to work it will be necessary to show that the function is continuous.

Example 2

Let

f(x)=\left\{\begin{array}{cc}x^{1/3} & \text{ if }x>0\\ -(-x)^{1/3} & \text{ if }x<0\\ 0 & \text{ if }x=0\end{array}\right.

A plot of f(x)

Now away from 0, f has derivative f'(x)=x^{-2/3}/3 but at x=0 the tangent is vertical – hence the slope of the tangent is undefined (\tan 90^\circ undefined). Indeed plugging in 0 we get:

f'(0)=\frac{1}{3}\frac{1}{0^{2/3}}=\frac{1}{0}

Uh-oh! However

\lim_{x\rightarrow 0^+}f'(x)=+\infty=\lim_{x\rightarrow 0^-}f'(x)

which could lead to the nonsensical conclusion that f(x) is differentiable at x=0 with derivative f'(0)=+\infty.

Hence if the ‘flawed method’ is to work it will be necessary to show that the derivative is bounded (i.e. not infinite).

Theorem

Suppose that f is continuous on \mathbb{R} and differentiable except perhaps at  a\in \mathbb{R}. Suppose further that \lim_{x\rightarrow a}f'(x)= L<\infty exists. Then f is differentiable at a with derivative f'(a)=\lim_{x\rightarrow a}f'(x).

Proof: Let h>0. f is continuous on [a,a+h] and differentiable on (a,a+h). Then, by the Mean Value Theorem, \exists\,c_h\in(a,a+h) such that

f'(c_h)=\frac{f(a+h)-f(a)}{h}

Now taking the limit as h\rightarrow 0 on both sides:

\lim_{h\rightarrow 0^+}f'(c_h)=\lim_{h\rightarrow 0^+}\frac{f(a+h)-f(a)}{h}

Now c_h\rightarrow a^+ as h\rightarrow 0^+ hence the left hand side is equal to L:

\lim_{h\rightarrow 0^+}\frac{f(a+h)-f(a)}{h}=L

Similarly taking h<0 and h\rightarrow 0^- we can show:

\lim_{h\rightarrow 0^-}\frac{f(a+h)-f(a)}{h}=L

Hence f is differentiable at a with derivative f'(a)=L \Box


Advertisements