Differentiable Once But Not Twice

I was reading through my Analysis notes on Wednesday. I was hoping through most of them (~120 pages total)… but I seriously underestimated the amount of thinking required to read them.

Anyway, right on page 4, I encountered a single sentence that stopped me dead and got me thinking for about an hour straight:

Do you know an example of a differentiable real function with a non-differentiable derivative?

“No, I don’t.” I thought. “But I’m determined to find out!”

Okay, I’ll be honest, I racked my brain for about half an hour, came really close to a solution (without realizing it), and then gave up and googled the answer. I didn’t find a straight-up answer, but I found something that pointed me in exactly the right direction! So here’s how I found a function that’s differentiable once but not twice.

The beginning – an almost-but-not-quite continuous function

I got thinking about a function you might have seen before: sin(1/x). Which looks like this:

sin(1/x)

f(x) = sin(1/x)

(Clearly this function isn’t defined at x=0, but we can define it partially,  to be f(x) = sin(1/x) everywhere except 0, and f(0) = 0.)

But it’s still not continuous, because it keeps wobbling up and down as you approach zero – so you can’t find the limit as x -> 0.

But as I googled, I came across the right approach. How about… we multiply the function by something? The obvious thing is to try xsin(1/x). Since the sine function oscillates between 1 and -1, (and therefore is bounded), when we multiply it by something that tends towards 0, we get a result that tends towards 0! And indeed:

xsin1-over-x

f(x) = xsin(1/x)

The x factor smooths out the wobble as x -> 0, and we can now find the limit! Just define f(0) = 0 and we have a continuous function!

Of course that’s just the first step. Now the real question is – how do we turn this into a function that’s differentiable once but not twice?

The final stretch – finding a function with a continuous first derivative, but non-continuous second derivative

Differentiating f(x) = xsin(1/x), we get:

d-by-dx-of-xsin1-over-x

But not only do the wobbles not get smaller as  x -> 0, in fact they get bigger, because of the 1/x factor of cos(1/x)!

Now I won’t give you all the gory detail of how I found the rest, but suffice to say I tried f(x) = x2sin(1/x), which almost-but-not-quite works (again, the derivative is just short of being continuous, because it involves a cos(1/x) term.) Then I tried x3sin(1/x), and hallelujah, it worked!

Differentiating, we get:

d-by-dx-of-xcubedsin1-over-x

Which looks like this:

picture-of-the-cubed-thingy

Yay! We have a continuous derivative! :D

Now, quite clearly, differentiating this again will give us something non-continuous. Awesome! This means that…

x3sin(1/x) is differentiable once but not twice!

.

(all images in this post courtesy of Wolfram Alpha)

Enjoyed this post? Don't miss similar posts in the future - grab our RSS feed.

Leave a Reply