find constants using limits

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?

-
Yes, you are right. Correct answer, reasoning is fine. –  André Nicolas Dec 23 '11 at 7:48
dato: I typed the equations using LaTeX. You may check if this is exactly what you want to ask. –  Paul Dec 23 '11 at 7:49
yes @Paul it is exactly what i wanted –  dato datuashvili Dec 23 '11 at 7:52
thanks very much –  dato datuashvili Dec 23 '11 at 7:54
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$.