A very tricky pseudo-proof of $0=-1$ through series and integrals Dealing with a recent question I spotted a very nice exercise for Calc-2 students, i.e. to find the mistake in the following lines.

Lemma 1. For any $n\in\mathbb{N}$, we have:  $$ \int_{0}^{1} x^n\left(1+(n+1)\log x\right)\,dx = 0. $$
   Lemma 2. For any $x\in(0,1)$ we have: $$ \frac{1}{1-x}=\sum_{n\geq 0}x^n,\qquad \frac{\log x}{(1-x)^2}=\sum_{n\geq 0}(n+1) x^n\log(x). $$
   By Lemmas 1 and 2 it follows that:
   $$\begin{eqnarray*}(\text{Lemma 1})\quad\;\;\color{red}{0}&=&\int_0^1 \sum_{n\geq0} x^n\left(1+(n+1)\log x\right)\,dx\\[0.2cm](\text{Lemma 2})\qquad&=&\int_0^1 \left(\frac{1}{1-x} + \frac{\log x}{(1-x)^2}\right)\,dx\\[0.2cm](x\mapsto 1-x)\qquad&=&\int_0^1 \left(\frac{1}{x}+\frac{\log(1-x)}{x^2}\right)\,dx\\[0.2cm](\text{Taylor series of }x+\log(1-x))\qquad&=&-\int_0^1 \frac{1}{x^2} \sum_{k\geq2}\frac{x^k}k \,dx\\[0.2cm](\text{termwise integration})\qquad&=&-\sum_{k\geq 2} \frac{1}{k(k-1)}\\[0.2cm](\text{telescopic series})\qquad&=&-\sum_{m\geq 1} \left(\frac{1}{m}-\frac{1}{m+1}\right)=\color{red}{-1}.
 \end{eqnarray*}$$

Now the actual questions: were you able to locate the fatal flaw at first sight?
Do you think it is a well-suited exercise for Calculus-2 (or Calculus-X) students?
 A: The error is at the very beginning, in the interchange of integral and summation. I’m too rusty (and too lazy!) to go beyond checking that the sequence of functions fails to satisfy a standard sufficient condition for the interchange, but the other steps are legitimate, so that must be the sticking point.
In the U.S. calculus courses that I've taught or observed, this material would come in Calc. $2$, to the extent that it appeared at all, and the interchange of integral and summation wouldn't appear at all; that makes it an essentially impossible exercise. Moreover, most students in typical first-year calculus courses still have the notion that mathematics is algorithmic calculation; getting them to pay enough attention to details to understand why the non-existence of a zero of $\frac1x$ doesn’t contradict the intermediate value theorem, or even to remember that the sign of $x$ matters when multiplying an inequality $f(x)\le g(x)$ by $x$, is a non-trivial challenge, to the extent that the former often goes by the board.
This might be appropriate for a very good old-fashioned advanced calculus course; the undergraduate real analysis courses that I taught had a different emphasis and didn’t cover the necessary material.
A: $$
\int_0^1 \sup_N \left| \sum_{n=0}^N x^n (1+(n+1)\log x) \right| \, dx = +\infty
$$
The dominated convergence theorem says
$$
\lim_N \int f_N = \int \lim_N f_N \quad\text{if } \int \sup_N |f_N| < \infty.
$$
That's too big an "if" in this case.
