# Continuous function but iterated integrals are not equal

Given a sequence $(g_n)$ of continuous functions $g_n:\mathbb R \to [0,\infty)$ with the properties $\operatorname{supp} g_n^{(1)} \subset (n,n+1)$ and $\int g_n \, d\lambda=1$ for all $n$, how can I show that $$f:\mathbb R^2 \to \mathbb R, (x,y) \mapsto \sum_{n=1}^\infty(g_n(x)-g_{n+1}(x))g_n(y)$$is continuous but still $$\int\int f(x,y)\,dx\,dy \neq\int\int f(x,y)\,dy\,dx$$

(1) $\operatorname{supp} g_n =\overline{\{ x\in \mathbb R \mid g_n(x)\neq 0\}}$

No idea how to start, a hint would be nice.

• So now you just work out both integrals. First $\int f\,dx$. There $y$ is fixed; for a given $y$ there's only one non-zero term. Integrate that, then integrate the result wrt $y$. The other direction is similar, except that in $\int f\,dy$ for a given $x$ there are two non-zero terms. Except for some $x$ where there's only one... – David C. Ullrich Jun 5 '16 at 17:40
• Oh ok thanks. And can I just argue that $f$ is continuous as it is just a sum of compositions of continuous functions? – Tesla Jun 5 '16 at 17:43
• Each term in the sum is continuous. A sum of continuous functions need not be continuous. This sum is continuous because (as you need to show) given $(x,y)$ there is a neighborhood of $(x,y)$ in which all but one or two or so terms vanish. – David C. Ullrich Jun 5 '16 at 17:56