Discontinuous functions that are continuous on every line in $\bf R^2$ This is exercise 7 from chapter 4 of Walter Rudin Principles of Mathematical Analysis, 3rd edition. (Page 99)
Define $f$ and $g$ on ${\bf R}^2$ by: $$f(x,y) = \cases {0,&if $(x,y)=(0,0)$\\
xy^2/(x^2+y^4) &otherwise}$$
$$g(x,y) = \cases {0,&if $(x,y)=(0,0)$\\
xy^2/(x^2+y^6) &otherwise}$$
Prove that:


*

*$f$ is bounded on ${\bf R}^2$

*$g$ is unbounded in every neighborhood of $(0,0)$

*$f$ is not continuous at $(0,0)$

*Nevertheless, the restrictions of both $f$ and $g$ to every straight line in ${\bf R}^2$ are continuous! 


This is one of the few specific problems I remember from my university career, which ended some time ago. I remember it because I toiled over it for so long and when I finally found the answer it seemed so simple.
 A: *

*Consider $0\le {(x\pm y^2)}^2 = x^2 \pm 2xy^2 + y^4$, so $\pm 2xy^2\le x^2+y^4$, and $(\pm2)f(x,y) = (\pm 2){xy^2\over x^2+y^4}\le 1$ since $x^2+y^4$ is non-negative. Taking the negative sign gives $f(x) \ge-\frac 12$ and taking the positive sign gives $f(x)\le\frac12$.


*Let $B$ be given, and consider the value of $g$ at the point $((1/3B)^{-3}, (1/3B)^{-1})$. At this point $g$ takes the value $\frac{1\vphantom{(1/3B)^{-5}}}{2\vphantom{(1/3B)^{-6}}}\frac{(1/3B)^{-5}}{(1/3B)^{-6}} = {\vphantom{(1/3B)^{-5}}3B\over \vphantom{(1/3B)^{-5}}2}$, which is strictly larger in value than the given $B$.


*Consider the restriction of $f$ to the semiparabola $P=\{(y^2, y), y>0\}$. $f$ is easily seen to have the constant value $\frac12$ everywhere on $P$, which includes points arbitrarily close to the origin.  But $f(0,0) = 0$, so $f$ is not continuous at $(0,0)$.


*$f$ and $g$, being rational functions with nonzero denominator, are continuous everywhere except at the origin, so their restrictions to lines that do not pass through the origin must be continuous.  We therefore need only consider lines through the origin.
Every line through the origin is either the $y$-axis, with $x=0$, or has $y=mx$ for some $m$. We want to show that each of these restrictions takes values close to 0 in the vicinity of the origin, to agree with $f(0,0) = g(0,0) = 0$.
The restriction of $f$ to the $y$-axis is the constant function $f(0,y) = 0/y^6 = 0$ everywhere except at the origin, which agrees with $f(0,0)=0$, so $f$ is continuous on this line; $g$ is similarly zero everywhere on the $y$-axis.
For other lines $y=mx$, we get $f(x,mx) = \frac{m^2x^3}{x^2+m^4x^4} = \frac{m^2x}{1+m^4x^2}$, and it is easy to see that $\lim_{x\to0} f(x,mx) = 0$, since the numerator goes to zero and the denominator to 1.  $g(x,mx)$ is similar: $\lim_{x\to0}g(x,mx) = \lim_{x\to0}\frac{m^2x^3}{x^2+m^6x^6}=  \lim_{x\to0}\frac{m^2x}{1+m^6x^4} = 0$.
I remember I dealt with sections 1 and 4 quickly, but then suffered over section 3 for hours before I hit upon the idea of looking at the parabola $P$.  After this, section 2 was easy, because the idea is basically the same: look at the restriction of $g$ to the set $\{(y^3,y), y\in{\bf R}\}$.
A: For (3), you might notice that for $(x,y) \ne (0,0)$,  $f(x,y) = xt/(x^2 + t^2)$ where $t = y^2$, and for any given $2R^2 = x^2 + t^2$ you can maximize $f(x,y)$ by taking $x=t=R$, getting $f(R,\sqrt{R}) = R^2/(R^2 + R^2) = 1/2$.
