# Could someone remind me why is incorrect to switch an infinite sum and an integral?

Could someone jog my memory on this?

The order of operation between an $\int$ and $\sum_{n\in \mathbb{N}}$ is not always interchangable? Note that the sum is an INFINITE sum

Why is it that $\int \sum_{n \in \mathbb{N}} \neq \sum_{n \in \mathbb{N}} \int$

Is the reason because the integral itself is a sum and the order of "summing" actually matters? (I think it's Multivariable calculus related stuff now)

-
Whenever you have 2 processes which are in some sense limits (e.g. sum of an infinite series, or an integral, or just a normal limit) there is no reason to suppose that they should give the same result if you apply them in a different order. So really the question should be the other way round: "why is it sometimes possible to interchange them"? –  Old John Jul 6 '12 at 19:36
Could I get some basic counterexamples so I get a numerical sense? –  sidht Jul 6 '12 at 19:38
It is easier and more instructive to give a counterexample using sequences: For example $\lim_{n\to\infty}\int_0^1 n^2x^n(1-x)\,dx=1$ even though the integrand goes to zero everywhere in $[0,1]$. Taking differences, you can easily realize the sequence as partial sums of a series, thus providing the counterexample you seek. –  Harald Hanche-Olsen Jul 6 '12 at 19:47
@Harald: I was about to write an answer similar to yours, using $\int_0^1nx^n\,dx$, so without the $(1-x)$ factor, and therefore also with the problem that at $x=1$ the sequence tends to infinity. Please flesh out your example to an answer! The artificially switch from sequence to series can be done quickly, if judged necessary. –  Jyrki Lahtonen Jul 6 '12 at 19:53
@JyrkiLahtonen: Okay … –  Harald Hanche-Olsen Jul 6 '12 at 20:14

It is easier and more instructive to give a counterexample using sequences: For example $$\lim_{n\to\infty}\int_0^1 n^2x^n(1-x)\,dx=1$$ even though the integrand goes to zero everywhere in [0,1]. To understand what is going on here, note that the function in the integrand has a graph which is a tall, thin peak getting taller and taller and thinner and thinner as $n\to\infty$, while approaching $x=1$ from the left.

Taking differences, you can easily realize the sequence as partial sums of a series, thus providing the counterexample you seek. To be precise, consider $$\lim_{n\to\infty}\int_0^1\sum_{k=0}^{n-1} \bigl((k+1)^2x^{k+1}(1-x)-k^2x^k(1-x)\bigr)\,dx,$$ which is just a difficult way to write the limit above.

-
Should I always check whether the sum converges or not first then? –  sidht Jul 12 '12 at 0:26
@jak: I am not sure what you mean. But in general, before using a sum it is usually a good idea to know that it converges. (Sorry, I always have a hard time answering questions of a procedural nature (i.e., should I …) in mathematics. I think this is a question whose answer is obvious, in each individual case, if you understand the problem at hand. But to such a general question, I never know what to say.) –  Harald Hanche-Olsen Jul 12 '12 at 13:43
Aren't there series where it diverges, but if you integrate the terms, it can converge? If there isn't one, then I guess like you said it would be meaningless for me to ask the question in the first place –  sidht Jul 14 '12 at 0:10
@jak: Sure, that is easy to arrange. For a trivial class of examples, consider cases where the integrals are all zero. You can also have each integral diverge, but the sum being integrable. –  Harald Hanche-Olsen Jul 14 '12 at 19:46

Correct -- they cannot always be interchanged. For example $$\sum_{n=0}^\infty \int_0^{2\pi} \cos(t+n)\,dt = 0$$ but $$\int_0^{2\pi} \left(\sum_{n=0}^\infty \cos(t+n)\right)\,dt$$ doesn't even exist (the sum never converges).

However, if everything converges absolutely, that is, if either of $$\sum_n \int |f(n,t)| \,dt \quad\text{or}\quad \int \sum_n |f(n,t)| \,dt$$ exists, then Fubini's theorem guarantees that the summation and the integral can be done in either order.

-
Also, if the summand/integrand is nonnegative then the order can be interchanged by Tonelli's theorem. That is to say, when no cancellation can occur than either both $\sum \int$ and $\int\sum$ are infinite or they are finite and equal. –  Noah Stein Jul 6 '12 at 20:07
So I should always check if the summand converges first before attempting to switch the integration and sum operation? –  sidht Jul 7 '12 at 3:56