Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apologizes if I'm missing something in my question or if my question seems trivial; this is my first question on this site. As motivation for my question, consider the following standard first year calculus question.

Consider this piecewise function: $ f(x) = \left\{ \begin{array}{lr} ax^2+b & \text{ if } x \le-2\\ 12x-5 & \text{ if } x >-2 \end{array} \right. $

For what values of $a$ and $b$ will $f(x)$ be differentiable?

To solve this question, I would like to propose the following theorem:

$\mathbf{Theorem:}$ A function $f(x)$ is differentiable iff $f'(x)$ is continuous.

If this theorem is true, then I can solve for $a$ first by noting that: $ f'(x) = \left\{ \begin{array}{lr} 2ax & \text{ if } x \le-2\\ 12 & \text{ if } x >-2 \end{array} \right. $

Thus, since by my theorem $f'(x)$ must be continuous, we have:

$$\begin{align*} \lim_{x \rightarrow -2^-}f'(x) &= \lim_{x \rightarrow -2^+}f'(x)\\ \lim_{x \rightarrow -2^-}2ax &= \lim_{x \rightarrow -2^+}12\\ 2a(-2) &= 12\\ -4a &= 12 \\ a &= -3 \\ \end{align*}$$

Hence, since differentiability implies continuity, we can solve for $b$ as follows:

$$\begin{align*} \lim_{x \rightarrow -2^-}f(x) &= \lim_{x \rightarrow -2^+}f(x)\\ \lim_{x \rightarrow -2^-}-3x^2+b &= \lim_{x \rightarrow -2^+}12x-5\\ -3(-2)^2+b &= 12(-2)-5\\ b-12 &= -29\\ b &= -17 \\ \end{align*}$$

so that our differentiable function is:

$$ f(x) = \left\{ \begin{array}{lr} -3x^2-17 & \text{ if } x \le-2\\ 12x-5 & \text{ if } x >-2 \end{array} \right. $$

Anyways. My question is: Is my proposed theorem actually a thing? I've looked through my calculus textbook and it doesn't seem to explicitly state it, yet I don't know how to solve this question otherwise. If this theorem turns out to be false, how else can you solve this problem? Thanks in advance. =]

share|cite|improve this question
A differentiable function need not have a continuous derivative. – user10444 May 9 '13 at 20:50
$f(x)$ is a number, not a function. So your statement should be "$f$ is differentiable if and only if $f'$ is continuous". It should be clear what the problem is here. When you speak of the derivative $f'$, you are already assuming that $f$ is differentiable. – wj32 May 9 '13 at 20:53
On the other hand, one can show: if $\lim_{x\rightarrow c^-} f'(x)$ exists, then the derivative from the left of $f$ at $x=c$ exists and is equal to the value of this limit. A similar fact holds for the derivative from the right. Also, a function is differentiable at $x=c$ if and only if both one-sided derivatives exist at $c$ and are equal there. So your method for computing $a$ is correct, but not for the reason you give. – David Mitra May 9 '13 at 21:05
@DavidMitra Thanks, that makes perfect sense. – Adriano May 9 '13 at 23:15
up vote 4 down vote accepted

let $f(x)= \begin{cases} x^2\sin(\frac 1 x), & \mbox{if } x \not= 0 \\0 & \mbox{if } x=0 \end{cases}$ is continuous but has a discontinuous derivative. Check the continuity of $f'(x)$ at $x=0$.

share|cite|improve this answer
Sorry, but how does this contradict my (admittedly false) theorem? I don't think your function $f(x)$ is differentiable at $x = 0$ (that is, I don't think that $f'(0)$ exists). This agrees with my (admittedly false) theorem since, as you said, $f'(x)$ is discontinuous at $x = 0$. – Adriano May 9 '13 at 22:28
$f'(0)$ exists because $$\lim_{h \to 0} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0} \frac{h^2\sin(1/h)}{h} = \lim_{h \to 0} h\sin(1/h) = 0.$$ – zrbecker May 9 '13 at 22:37
Ah, yes, of course. Then we have: $$ f'(x) = \left\{ \begin{array}{lr} 2x \sin(1/x)-\cos(1/x) & \text{ if } x \ne 0\\ 0 & \text{ if } x = 0 \end{array} \right. $$ While $f'(0)$ exists, $f'$ is still not continuous since \lim_{x \rightarrow 0}f'(x) doesn't exist. – Adriano May 9 '13 at 22:46

It is not. A function $f:\mathbb{R}\rightarrow\mathbb{R}$ is differentiable iff

$$f'(x)=\lim_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$

exists for all $x\in\mathbb{R}$. If $f'$ is continuous, $f$ is said to be continuously differentiable (or of class $\mathcal{C}^1$). Hence, to solve the problem you need to pick $a$ and $b$ such that the limit exists for any $x\in\mathbb{R}$. Note also, that for $f$ to be differentiable, $f$ must be continuous.

By the way, welcome to math stackexchange and I wouldn't worry about asking a "trivial question" - your question is well written and, often, questions are only trivial if you've already seen the answer.

share|cite|improve this answer

For that function to be differentiable you need $$f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}$$ to exist.

The only point where something "weird" is going on, is at -2. Thus we just need to find $a, b$ such that $$\lim_{h \to 0^+} \frac{f(-2 + h) - f(-2)}{h} = \lim_{h \to 0^-} \frac{f(-2 + h) - f(-2)}{h}$$

The right hand side is simply $-4a$, by using the regular rules of derivatives. The weirdness happens on the other side of the limit.

$$\lim_{h \to 0^-} \frac{12(-2 + h) - 5- (4a + b)}{h} = \lim_{h \to 0^-} \frac{-29 - 4a -b + 12h}{h}$$

In order for this limit to exist we need $-29 -4a -b = 0$. Otherwise the limit will be $-\infty$ or $+\infty$. Once we have $-29 -4a -b = 0$, we get $$\lim_{h \to 0^-} \frac{-29 - 4a -b + 12h}{h} = \lim_{h \to 0^-} \frac{12h}{h} = 12.$$

Since we need the left and the right limit to be the same, we get $-4a = 12$. Thus $a = -3$. Then solving for $b$, we have $-29 + 12 - b = 0$, so $b = -17$.

share|cite|improve this answer
I think you meant to say that $$\lim_{h \to 0^+} \frac{12(-2 + h) - 5- (4a + b)}{h} = \lim_{h \to 0^+} \frac{-29 - 4a -b + 12h}{h}= \lim_{h \to 0^+} \frac{12h}{h} =12$$ so that $-4a=12$ gives $a=-3$ and $-29-4(-3)-b=0$ yields $b=-17$. While your method works, I'm not really convinced why you were able to deduce that $-29-4a-b=0$ though. – Adriano May 9 '13 at 22:09
The way I went about it was to say, if $-29 - 4a - b = c$ where $c \neq 0$, then $c/h \to \pm \infty$. So the limit doesn't exist. But the limit must exist for it to be differentiable. – zrbecker May 9 '13 at 22:22
Another way to think about it, is $f$ needs to be continuous at $-2$, so $a(-2)^2 + b = 12(-2) - 5$, which after some algebra gives $-29 - 4a - b = 0$. – zrbecker May 9 '13 at 22:25
Ah that makes sense now, thanks. – Adriano May 9 '13 at 22:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.