# Can we take individual derivative of piecewise function if the function is continuous and differentiable?

Can we take individual derivative of piecewise function if the function is continuous and differentiable?

Suppose a function $$f(x)$$ is defined in such a way that it's definition changes at some particular point, say $$x = a$$. If it's given a priori that $$f(x)$$ is continuous and differentiable at point $$x = a$$, can we just individually take derivative of one of the function and find it's value at $$x = a$$?

For example, $$f(x) = \begin{cases} x^2 & \text{if}\ x \geq 1 \\ 2x - 1 & \text{otherwise} \end{cases}$$

This function is continuous and differentiable at $$x=1$$. Here the derivative also equals $$2 = 2(1) \text{ (derivative of } x^2 \text{ at 1}) = 2 \text{ (derivative of } 2x \text{ at 1})$$

Is this true for all functions given to be continuous and differentiable at some point (that value of individual derivative equals actual derivative)?

• I don't understand what is "all functions" in last claim. If $f(x)$ is continuous and differentiable in point $x=a$, then $f(a-0)=f(a)=f(a+0)$, $f'(a-0)=f'(a+0)$, where $g(a\pm 0)=\lim_{x\to a\pm 0} g(x)$. Also if $g(x)$ is continuous and differentiable at $x=f(a)$ and $f(x)$ is continuous and differentiable at $x=a$ then $g(f(x))$ is continuous and differentiable at $x=a$. Aug 9, 2022 at 13:44
• If $f(x) = \begin{cases} f_1(x) & \text{if}\ x \geq a; \\ f_2(x) & \text{otherwise} \end{cases}$, then for $f(x)$ to be continuous and differentiable following statements must be satisfied: $\lim_{x\to a+0} f_1(x)=f_1(a)=\lim_{x\to a-0} f_2(x)$, $\lim_{x\to a+0} f_1'(x)=\lim_{x\to a-0}f_2'(x)$. Aug 9, 2022 at 13:49

Yes, that is (almost) true. For: $$f(x)= \begin{cases} g(x) &\text{if }x\geq a\\ h(x) &\text{otherwise} \end{cases}$$ and both $$g,h$$ are defined and continuous at $$x=a$$, then we must have: $$f\text{ is continuous at }a\iff g(a)=h(x)$$ Now regarding $$f$$ being differentiable at $$a$$, we have: $$\text{g and h are differentiable at a}\\ \quad\\ \Downarrow\\ \quad\\ \begin{bmatrix} g'(a)=h'(a)=\alpha\\ \Updownarrow\\ f\text{ is differentiable at }a\\ \text{ and }\\ f'(a)=\alpha \end{bmatrix}$$
BUT if either $$g$$ or $$h$$ is not differentiable at $$a$$ (or for instance $$h$$ is not defined there), then you need to check the actual definition of being differentiable in detail to figure out what happens there.
• Thank you very much. Does it also mean that if a function is given to be continuous at point $x = a$ and both $g(x)$ and $h(x)$ are differentiable at $a$, and $g'(a) = h'(a)$, then the function $f(x)$ is differentiable at $x = a$? Aug 10, 2022 at 6:14
• Thank you, what is $cg'(a)$? Aug 10, 2022 at 8:57