I have seen in many examples that using the fundamental definition of derivative only gives the correct results while checking for differentiability at a point. But why do we get wrong results while we directly apply the rules of differentiation and taking the limit at the point. Here is an example
$$y = \begin{cases} x^2, &-\infty < x < 1\\ 2x, &1\leq x < \infty \end{cases} $$
If we check the differentiability at the point $x=1$ then when we apply the rules of differentiation left hand and right hand derivative becomes same. But by using fundamental definition of derivative it will be different.
But if I am right the rules of differentiation are in fact derived from the fundamental definition of derivative? So both of these should give correct result. Or it seems like I am missing some basic concept.
I have seen same question like this one here. The answer to this question only says it gives wrong result.But it doesn't answer the question of why?
$\endgroup$ 93 Answers
$\begingroup$The issue here is that the derivative $y'(1)$ is not defined. I'll start with the definition and then discuss why the differentiation rules don't apply at $x = 1$. First, for the derivative to exist at $x = 1$, then by definition,the following limit has to exist:$$\lim_{h\to 0}\frac{y(1+h) - y(1)}{h} \tag{1}.$$Now, in order for $(1)$ to exist the left and right limits have to exist and agree. So, we can look at the left and right derivatives:
Right Derivative:$$y'_{+}(1) = \lim_{h\to 0^{+}}\frac{f(1+h) - f(1)}{h} = \lim_{h\to 0^{+}}\frac{2(1+h) - 2}{h} = \lim_{h\to 0^{+}}\frac{2h}{h} = 2$$There's no trouble there, however we run into problems with the left derivative:
Left Derivative:\begin{align} y'_{-}(1)&=\lim_{h\to 0^{-}}\frac{y(1+h) - y(1)}{h}\\ &= \lim_{h\to 0^{-}}\frac{(1+h)^2 - 2}{h}\\ &= \lim_{h\to 0^{-}}\frac{1 +2h+h^2-2}{h}\\ &= \lim_{h\to 0^{-}}\frac{h^2+2h-1}{h}\\ &= \lim_{h\to 0^{-}}\left(h + 2 - \frac{1}{h}\right)\\ &= \infty \end{align}
So, since the left and right derivatives don't agree, we can say that $y$ is not differentiable at $y = 1$. As has been pointed out in the comments we could also have concluded that from continuity, because if $y'(1)$ had existed, then $y$ would need to be continuous at $x = 1$, and because it is not we can immediately rule out differentiability there.
Now, to understand why it doesn't work to take the derivatives of $2x$ and $x^2$ and take a limit, we start by noting that we can certainly write$$y'(x) = \begin{cases} 2x,&-\infty<x<1\\ 2, &1<x<\infty \end{cases}$$
However, if we were to write $$y'(1) = \lim_{x\to 1}y'(x)$$ we would be making two unfounded assumptions:
First, that $y$ is actually differentiable at $x = 1$, and so writing $y'(1)$ makes sense, and second that $y'$ is continuous. We don't know a priori that either of those things are true, and in fact as previously mentioned, we know that $y'(1)$ can't exist because $y$ isn't continuous at $x = 1$.
To give a bit more of an intuitive explanation, remember that the derivative at a point relies on the value of the function at that point. So, when we use $2x$ for the derivative on the left, instead of using $y(1) = 2$, which lies on the right piece, we're really using $\lim_{x\to 1^{-}}y(x) = 1$ on the left piece.
$\endgroup$ 1 $\begingroup$When considering limits, you always have to look at what happens as $h$ approaches $0$ both from the left hand side and right hand side. The limit$$ \lim_{h \to 0}\frac{f(x+h)-f(x)}{h} $$exists if and only if the left-hand limit and the right-hand limit both exist and are equal.
If$$ f(x) = \begin{cases} x^2, &-\infty < x < 1\\ 2x, &1\leq x < \infty \end{cases} $$then$$ \lim_{h \to 0^+}\frac{f(1+h)-f(1)}{h} = \lim_{h \to 0^+}\frac{2+2h-2}{h} = \lim_{h \to 0^+}\frac{2h}{h}=2 $$but\begin{align} \lim_{h \to 0^-}\frac{f(1+h)-f(1)}{h} &= \lim_{h \to 0^-}\frac{(1+h)^2-2}{h} \\ &=\lim_{h \to 0^-}\frac{h^2+2h-1}{h} \\ &= \lim_{h \to 0^-}h+2-\frac{1}{h} \\ &= \infty \, . \end{align}
You can't use the derivative rule$$ \frac{d}{dx}(x^2)=2x $$since $f(x) \neq x^2$ when $x=1$.
$\endgroup$ 4 $\begingroup$Hint: Note that in order that $y=y(x)$ is differentiable at $x=1$ it has to be continuous at $x=1$. Here we have\begin{align*} \lim_{x\to 1^{-}}y(x)=\lim_{x\to 1^{-}}x^2&\color{blue}{=1}\\ \lim_{x\to 1^{+}}y(x)=\lim_{x\to 1^{+}}2x&\color{blue}{=2}=y(1) \end{align*}Since the left-side limit of $y$ is not equal to the right-side limit of $y$ at $x=1$ the function is not continuous at $x=1$ and can't be differentiable at $x=1$. There is no need to apply the fundamental definition of derivatives.
$\endgroup$