Give an example of a function such that

I need some help with the following problem. It says give an example of a function $f: [0, 1] \times [0, 1] \to \mathbb R$ such that for each fixed $x$, $y \mapsto f(x, y)$ is continuous and for each fixed $y$, $x \mapsto f(x, y)$ is continuous, but $f$ is not continuous. A hint would be much appreciated. I would also love to know if there is any trick to finding counterexamples, as I have always been weak with those kind of questions. Thank you!

• Do you mean not continuous at all $(x,y) \in [0,1]^2$? – copper.hat Feb 22 '13 at 6:12

Consider$$f(x,y) = \begin{cases} \frac{xy}{x^2+y^2}, & \text{if }(x,y)\ne (0,0) \\ 0, & \text{if }(x,y)= (0,0) \end{cases}$$ Then it is easy to see that $f(x,y)$ is separately continuous (i.e. continuous in each variable) but $f(x,y)$ is not continuous at $(0,0)$ you can see that by showing that $$\displaystyle \lim_{(x,y)\to (0,0)}f(x,y)\ne0$$ to do this consider the path along $x=y$ then the limit should equal to $1/2$ along this path, and clearly $1/2\ne 0$.
Take $$f(x,y)=\frac{xy}{\sqrt{x^4+y^4}},~~~(x,y)\neq(0,0) ~~~\text{and}~~~f(x,y)=0,~~~(x,y)=(0,0)$$ It can be shown that the function is not continuous at the origin.