# Find the values of p and q so that $f(x)=\left \{\begin{array}{1 1}x^2+3x+p, & if \;x\leq\;1\\qx+2, & if\;x>\;1\end{array}\right.$is differentiable at $x=1.$

Toolbox:
• A function is not differentiable if $LHL\neq RHL.$
• A function is not differentiable if LHL or RHL does not exist.
Step 1:
Given : $f(x)=\left\{\begin{array}{1 1}x^2+3x+p, & if\;x\leq 1\\qx+2,&if\;x>1\end{array}\right.$
It is given that the function is differentiable at $x=1$ and every differentiable function is continuous .So $f(x)$ is continuous at $x=1$
Therefore $\lim\limits_{\large x\to 1}f(x)=\lim\limits_{\large x\to 1^+}f(x)=f(1)$
$\Rightarrow \lim\limits_{\large x\to 1}x^2+3x+p=\lim\limits_{\large x\to 1}qx+2$
$\Rightarrow p+4=q+2$
$\Rightarrow p-q=-2$-------(1)
Now $f(x)$ is differentiable at $x=1$
$\Rightarrow$ (LHD at $x=1)$=(RHD at $x=1)$
$\Rightarrow \lim\limits_{\large x\to 1^-}\large\frac{f(x)-f(1)}{x-1}$$=\lim\limits_{\large x\to 1^+}\large\frac{f(x)-f(1)}{x-1} \Rightarrow \lim\limits_{\large x\to 1}\large\frac{(x^2+3x+p)-(p+4)}{x-1}=$$\lim\limits_{\large x\to 1}\large\frac{(qx+2)-(q+2)}{x-1}$
$\Rightarrow \lim\limits_{\large x\to 1}\large\frac{(x^2+3x-4)}{x-1}=$$\lim\limits_{\large x\to 1}\large\frac{qx-q}{x-1} \Rightarrow \lim\limits_{\large x\to 1}\large\frac{(x+4)(x-1)}{x-1}=$$\lim\limits_{\large x\to 1}\large\frac{q(x-1)}{x-1}$
$\Rightarrow \lim\limits_{\large x\to 1}(x+4)=\lim\limits_{\large x\to 1}q$
Step 2:
Applying the limits we get,
$q=5$
Substituting in equ(1) we get,
$p-5=-2$
$p=3$
Hence the values of $p$ and $q$ are 3 and 5 respectively.