# Differentiating piecewise functions.

Say we have the piecewise function $f(x) = x^2$ on the interval $0 \le x < 4$; and it equals $x+1$ on the interval $x \ge 4$. Why is it that, when I take the derivative, the intervals loose their equality and become strictly greater or strictly less than?

• You mean the domain of the derivative? – Git Gud Mar 3 '13 at 23:49
• Well, the domain is expressed using intervals, so yes. – Mack Mar 3 '13 at 23:50
• Draw the function $f(x)$. What would it mean for the function to have a derivative at $x = 0$ or $x = 4$? Do you see why it can't be differentiabe there? – JavaMan Mar 3 '13 at 23:51
• The answers below point out that the function is not continuous at $x = 4$, and so $f(x)$ can't be differentiable there. So let's let $g(x) = x^2$ for $0 \leq x < 4$ and $12 + x$ for $x \geq 4$. The function $g(x)$ is now continuous at $x = 4$, but it is still not differentiable there. Do you see why? – JavaMan Mar 4 '13 at 0:02

You see how the function jumps at $x=4$? It isn't even continuous, so it makes no sense to talk about it being differentiable there. $f'(4)$ is simply indeterminate, though $f'(x)$ is perfectly easy to define on $\{x:x\in \mathbb{R}\setminus \{4\}|x>0\}$.
• We have conflicting answers regarding the differentiability at $x=0$. – Git Gud Mar 4 '13 at 0:01
• @GitGud Right - yes, I misread the question and assumed $f(x)=x^2$ for $x<4$. – Alexander Gruber Mar 4 '13 at 0:03
• I got you over $10$k rep ^ ^. Congrats. – Git Gud Mar 4 '13 at 0:16
Note that $\displaystyle \lim_{x\to 4^-}(f(x))=\lim_{x\to 4^-}(x^2)=16$ while $\displaystyle\lim_{x\to 4^+}(f(x))=f(4)=5.$ Therefore $f$ isn't continuous on $x=4$ and so it can't be differentiable there. Hence the domain of the derivative doesn't include $4$.
Around $0$ the left lateral derivative isn't even defined, therefore $f$ can't be differentiable there.
Since $f$ is clearly differentiable on the interior of its domain, it follows that the domain of $f'$ is the interior of $f$'s domain, that is $\textbf{]}0,4[\cup \textbf{]}4+\infty[=\textbf{]}0,+\infty[\setminus \{4\}$.