Analytic continuation of a real function

I know that for $U \subset _{open} \mathbb{C}$, if a function $f$ is analytic on $U$ and if $f$ can be extended to the whole complex plane, this extension is unique.

Now i am wondering if this is true for real functions. I mean, if $f: \mathbb{R} \to \mathbb{R}$, when is it true that there is an analytic $g$ whose restriction to $\mathbb{R}$ coincides with $f$ and also when is $g$ unique.

Surely $f$ needs to be differentiable but this might not be sufficient for existance of such $g$.

edit: I mean, is it easy to see that there is and extension of sine cosine and exponential real functions?

Thanks a lot.


Solution 1:

Necessary and sufficient condition for existence of an entire function $g$ extending $f$ to the whole complex plane: $f$ is infinitely differentiable at $0$, and the power series for $f$ at the origin converges to $f$ on the real line.

A counterexample for something more is (as noted in a comment) $f(x) = 1/(1+x^2)$. It is real analytic on the real line, but cannot be extended analytically to any connected region containing both $0$ and either $i$ or $-i$. The power series at $0$ only has radius of convergence $1$.

Solution 2:

I think that most mathematicians would say that the functions you mention are restrictions to the real line of functions more naturally defined on the complex plane in the first place. So--yes.