TITLE: find constants using limits
QUESTION [6 upvotes]: Suppose that we have function $f(x)$ ,which is defined  as follows:
$$f(x):= \begin{cases} a+bx &\text{, if } x>2\\ 3 &\text{, if } x=2\\ b-ax^2 &\text{, if } x<2\end{cases}$$
(here $a,b$ are some constants).
We  should find $a,b$ so that limit for $x\to 2$ of $f(x)$ exists and equals $3$.
I think that, because limit at point $2$ exist, it means that left and right limits are equal,  so  after we evaluate limits on left and right side,  we  will get 
$$a+2b=b-4a\mbox{ or }b=-5a.$$
Also because the limit  is equal to  $3$ at point $2$, it means that left or right limit is also equal to $3$, so $a+2b=3$
put one in another, I have got that $a=-1/3$ and $b=5/3$. Am i correct?

REPLY [7 votes]: Yes, your reasoning is correct. We have 
$$\lim_{x\rightarrow 2^-}f(x)=\lim_{x\rightarrow 2^-}(b-ax^2)=b-4a,$$
$$\lim_{x\rightarrow 2^+}f(x)=\lim_{x\rightarrow 2^+}(a+bx)=a+2b.$$
Therefore, if $\displaystyle\lim_{x\rightarrow 2}f(x)=3$, we have
$$\lim_{x\rightarrow 2^-}f(x)=\lim_{x\rightarrow 2^+}f(x)=\lim_{x\rightarrow 2}f(x)=3,$$
which implies that 
$$b-4a=a+2b=3.$$
Solving these linear equations, we get $a=-1/3$ and $b=5/3$.
One more thing, $\displaystyle\lim_{x\rightarrow 2}f(x)=3=f(2)$ means that  $f$ is continuous at $2$.