Hartogs' theorem for real functions Context: Hartogs' theorem says that if a complex function $f:\mathbb{C}^2 \rightarrow \mathbb{C}$ is separately analytic in the two complex variables, then the function is continuous, and analytic. However, this fails when applied to real function. The counterexample given in Wikipedia is $f: \mathbb{R}^2 \rightarrow \mathbb{R}$, given by 
$$
f(x,y) = \frac{xy}{x^2+y^2}.
$$
$f$ is not continuous along the lines $x=\pm y$.
Question: This raises two questions:


*

*Clearly, being separately analytic in x (i.e. keeping y constant, vary x) and separately analytic in y is not enough to ensure continuity, let alone analyticity of $f:\mathbb{R}^2 \rightarrow \mathbb{R}$. However, is it true that if $f$ is separately analytic along all directions in the $\mathbb{R}^2$ plane, then $f$ is analytic?

*Is the converse true? Specifically, if $f:\mathbb{R}^2 \rightarrow \mathbb{R}$ is analytic, then is it analytic along all directions in the $\mathbb{R}^2$ plane? 


Note: By analytic along a certain direction, I mean the following: Consider the line $y=mx$ in the plane. Along this line, $f(x,y) = \tilde{f}(x)$, since x completely parametrizes the line. Then, being analytic along this line, in the sense that I'm using it, would mean that $\tilde{f}(x)$ is analytic in x.
I apologize if this is a very simple question. I'm new to analysis, and would appreciate it if you could provide references where this has already been proven or disproven.
 A: The first answer I gave (see below) is correct, but perhaps is a bit gimicky. Here I give a more substantial solution as an answer to the question @Fimpellizieri asked. 
Claim: There exists $f:\mathbb R^2\to \mathbb R$ that is real analytic on every line in $\mathbb R^2$ but fails to be analytic as a function of two variables in every neighborhood of $(0,0).$
Proof: Define
$$f(x,y)=\begin{cases} \frac{x^2y}{x^2+y^2},&(x,y)\ne (0,0)\\0,& f(0,0)=0.\end{cases}$$
On the $x$ and $y$ axes $f\equiv 0.$ On lines $y=mx,m\ne 0,$ $f(x,mx)=[m/(1+m^2)]x.$ On horizontal lines $y=c\ne 0,$ we have
$$f(x,c)=\frac{cx^2}{x^2+c^2},$$
which is analytic as a function of $x$ on $\mathbb R.$ On vertical lines $x=c,c\ne 0,$
$$f(c,y)=\frac{c^2y}{c^2+y^2},$$
which is analytic as a function of $y$ on $\mathbb R.$ All other lines can be written $y=mx +b$ with both $m,b\ne 0.$ Here we get
$$f(x,mx+b)=\frac{x^2(mx+b)}{x^2+(mx+b)^2}.$$
Because the denominator never vanishes, we have analyticity on all of these lines as well. Thus the first part of the claim is proved.
Now suppose $f$ can be written as a power series of two variables near $(0,0).$ Because $0=f(0,0)=\partial f/\partial x (0,0) = \partial f/\partial y (0,0),$ this power series has the form $ax^2+bxy+cy^2$ plus terms of higher order. Looking at the line $(x,x)$ then gives $x/2 = O(x^2)$ as $x\to 0.$ This is a contradiction, and proves the claim.

Previous answer: Define
$$f(x,y)=\begin{cases}x^2 & \text {if } x=y\\0&\text {if } x\ne y\end{cases}$$
Then $f$ is analytic on each line through the origin, but as a function of two variables, it is discontinuous at each point of the line $y=x$ except for the point $(0,0).$
