Find the real parameters for which the function is continuous over the reals. How should I solve this exercise? Find the values of the real parameters $a$ and $b$ for which the following function is continuous on $\Bbb{R}$:
\begin{cases}
e^x+a\cos(x) \text{ if } x\le0 \\
x^2+b\sin(x) \text{ if } x>0 \\
\end{cases}
Thank you!!!
 A: For continuity at $x=c$ $$\lim_{x\to c^-}f(x)=f(c)=\lim_{x\to c^+}f(x)$$
Here $\displaystyle c=0, \lim_{x\to 0^-}f(x)=f(0)=e^0+a\cdot\cos0=1+a$
and $\displaystyle\lim_{x\to 0^+}f(x)=0^2+b\cdot \sin^20=0$
A: Note that the function is defined piecewise, and each "piece" is cont. So, the function defined above will be continuous, if the pieces "glue" together "nicely" at $0$.
More formally, your function $f$ will be cont. if and only if 
$\lim_{x \rightarrow 0+}f(x)=\lim_{x \rightarrow 0-}f(x)$. Now I hope you can finish the problem.
A: The necessary and sufficient condition for which a function $f(x)$ is continuous in a point $c$ is that $$\lim_{x\to c^-}f(x)=\lim_{x\to c^+}f(x)$$
Note that $f(x)$ is continuous in $]-\infty;0[$ and $]0;+\infty[$, because $e^x$, $\cos(x)$ and $\sin(x)$ are continuous $\forall x \in \Bbb{R}$. The only "critical" point is $x=0$. By the definition of continuous function you get 
$$\lim_{x\to c^-}f(x)=\lim_{x\to c^+}f(x)$$
$$e^0+a\cos(0)=0^2+b\sin(0)$$
$$1+a=0 \Rightarrow a=-1$$
As regards $b$, there are insufficient conditions to determine it, so $b$ can be any real number.
