# Find the values $a$ and $b$ such that the function is differentiable at $x=0$

$$\mathbf{Question:}$$ Find the values $$a$$ and $$b$$ such that the function is differentiable at $$x=0$$

$$f(x)= \begin{cases} x^{2}+1 &x≥0\\ a\sin x+b\cos x & x<0\\ \end{cases}$$

$$\mathbf{Solution:}$$

$$f(x)$$ is differentiable at $$x=0$$ if $$f'(0)$$ exists. This implies that for $$f$$ to be differentiable at $$x=0$$, the left hand limit and the right hand limit must exist and be equal.

\begin{align} \lim_{x\to 0-}f'(0) & =\lim_{x\to 0-}\frac{f(x)-f(0)}{x} \\ & =\lim_{x\to 0-}\frac{a\sin x +b\cos x-1}{x} \\ & =\lim_{x\to 0-}\frac{a\sin x}{x}+\frac{b\cos x-1}{x}=a \\ \end{align}

\begin{align} \lim_{x\to 0+}f'(0) & =\lim_{x\to 0+}\frac{f(x)-f(0)}{x} \\ & =\lim_{x\to 0+}\frac{x^{2}+1-1}{x} = 0 \end{align}

Therefore, $$a=0$$

To find $$b$$, we can use the fact that if $$f(x)$$ is differentiable at $$x=0$$ then, it must be continuous at $$x=0$$.

So if $$f(x)$$ is continuous, $$\lim_{x \to0-}f(x) = \lim_{x \to0+}f(x)=b$$

\begin{align} \lim_{x\to 0-}f(x) & =\lim_{x\to 0-}a\sin x +b\cos x \\ & = a\sin (0) + b\cos (0) = b \end{align}

\begin{align} \lim_{x \to 0+}f(x) & = \lim_{x \to0+}x^{2}+1 =1 \end{align}

Therefore, $$b=1$$

Thus, $$f(x)= \begin{cases} x^{2}+1 &x≥0\\ \cos x & x<0\\ \end{cases}$$ is differentiable at $$x=0$$

• How do you know that $\lim_{x\to 0-}\frac{b\cos x-1}{x}=0$ without knowing that $b=1$? Outside of this, your analysis looks good. Jun 9, 2020 at 4:26

$$f(0)=1$$ $$\lim_{x\to 0^+}f(x)=\lim_{x\to0^+}(a\sin(x)+b\cos(x))=b$$ $$f$$ is continuous at $$x=0$$ if $$b=f(0)=1$$.
$$f'(0^-)=\lim_{x\to 0^-}\frac{f(x)-f(0)}{x-0}$$ $$=\lim_{x\to0^-}x=\color{red}{0}$$ $$f$$ is differentiable at $$x=0$$ if $$\lim_{x\to0^+}\frac{f(x)-f(0)}{x-0}=\color{red}{0}$$ or $$\lim_{x\to0^+}\frac{a\sin(x)+\cos(x)-1}{x}=0$$ but $$\sin(x)\sim x \; and \; \cos(x)-1\sim \frac{-x^2}{2}$$ thus $$a=0$$.