Find the values of $a$ and $b$, if the function $f$ defined by $f(x)=\left\{\begin{array}{cl}x^{2}+3 x+a, & x \leqslant 1 \\ b x+2, & x>1\end{array}\right.$ is differentiable at $x=1 .$
Given that f(x) is differentiable at x = 1. Therefore, f(x) is continuous at x = 1.
$\lim _{x \rightarrow 1^{-}} f(x)=\lim _{x \rightarrow 1^{+}} f(x)=f(1)$
$\Rightarrow \lim _{x \rightarrow 1}\left(x^{2}+3 x+a\right)=\lim _{x \rightarrow 1}(b x+2)=1+3+a$
$\Rightarrow 1+3+a=b+2$
$\Rightarrow a-b+2=0$ ....(1)
Again, $f(x)$ is differentiable at $x=1$. So,
$(\mathrm{LHD}$ at $x=1)=(\mathrm{RHD}$ at $x=1)$
$\Rightarrow \lim _{x \rightarrow 1^{-}} \frac{f(x)-f(1)}{x-1}=\lim _{x \rightarrow 1^{+}} \frac{f(x)-f(1)}{x-1}$
$\lim _{x \rightarrow 1} \frac{\left(x^{2}+3 x+a\right)-(4+a)}{x-1}=\lim _{x \rightarrow 1} \frac{(b x+2)-(4+a)}{x-1}$
$\Rightarrow \lim _{x \rightarrow 1} \frac{x^{2}+3 x-4}{x-1}=\lim _{x \rightarrow 1} \frac{(b x-2-a)}{x-1}$
$\Rightarrow \lim _{x \rightarrow 1} \frac{(x+4)(x-1)}{x-1}=\lim _{x \rightarrow 1} \frac{b x-b}{x-1}$
$\Rightarrow \lim _{x \rightarrow 1}(x+4)=\lim _{x \rightarrow 1} \frac{b(x-1)}{x-1}$
$\Rightarrow 5=b$
Putting b = 5 in (1), we get
a = 3
Hence, $a=3$ and $b=5$.