Limit of integral - part 2 Inspired by the recent post "Limit of integral", I propose the following problem (hoping it will not turn out to be too easy). Suppose that $g:[0,1] \times [0,1] \to {\bf R}$ is continuous in both variables separately. Is it true that, for all $x_0 \in [0,1]$,
$$
 \lim \limits_{x \to x_0 } \int_0^1 {g(x,y)\,{\rm d}y}  = \int_0^1 {g(x_0 ,y)\,{\rm d}y} .
$$ 
 A: The answer is no. In fact, it is related to Leibniz's rule. The counterexample below is from 'Counterexamples in Analysis' and was recently posted here by Jonas Meyer. Consider the function 
$$ g(x,y) = \left\\{
     \begin{array}{lr}
       \left (\frac{3x^2}{y^2} - \frac{2x^4}{y^3} \right)e^{-x^2/y} &  y>0, \\\
       0 & y=0. 
     \end{array}
   \right.$$
It's easy to see that $g$ is continuous in both variables separately. We have that $\int_{0}^1 g(0,y) dy = 0 $ and $$ \int_{0}^1 g(x,y) dy = e^{-x^2}(1-2x^2)$$ if $ x \ne 0$. So $$\lim_{x \rightarrow 0} \int_{0}^1 g(x,y) dy = 1 \ne \int_{0}^1 g(0,y) dy.$$
A: I think I have another counterexample.  Define $f(x)=\int_{0}^x e^{-1/t}dt$ for $x\gt0$.  This is chosen because it goes to zero as $x$ goes to zero from the right and because experimentation led me to the differential equation $\frac{f''(x)}{f'(x)}=\frac{1}{x^2}$ as a sufficient condition for the following to work.  Define 
$$g(x,y) = \left\{
     \begin{array}{lr}
       \frac{xy}{f(x)+y^2} & \text{if } x\gt0, \\
       0 & \text{if } x=0, 
     \end{array}
   \right.$$
for $(x,y)$ in $[0,1]\times[0,1]$, and let $x_0=0$.  The right hand side of your tentative equation is obviously $0$.  The left hand side is 
$$\lim_{x\to0+}\frac{x}{2}\log\left(1+\frac{1}{f(x)}\right),$$
which comes out to $\frac{1}{2}$ after $2$ applications of l'Hôpital's rule, if I did it correctly.
(I started by playing with the standard example of a discontinuous but separately continuous function on $\mathbb{R}^2$, $f(x,y)=\frac{xy}{x^2+y^2}$ when $x$ or $y$ is nonzero, $f(x,y)=0$ when $x=y=0$. Then I tried to see how the $x^2$ in the denominator could be modified to give a counterexample here, by replacing it with an unknown $f(x)$ that goes to $0$ at $0$ and seeing what further properties of $f(x)$ would make it work.  As I mentioned, this led in particular to the sufficient condition $\frac{f''(x)}{f'(x)}=\frac{1}{x^2}$, and hence to this example.  Unfortunately, I can't offer any real intuition.)
Added
I decided to look at this a little more, and came up with an example simpler than the other one I gave.  With $$g(x,y)=\frac{-y}{\log(x/2)(x+y^2)}$$ 
for $x\gt0$ and $0$ otherwise, the same result as above holds.
A: This is true if there is a (measurable) function $f(y)$ such that $$|g(x,y)|\le f(y), \mbox{ for }0\le x\le 1 $$  and $$\int_0^1 f(y)\,dy<\infty.$$
This follows from the Lebesgue dominated convergence theorem.
Note: Every continuous function is measurable.
