What is wrong with my proof that $\int 2x dx= 2x^2$ by writing $2x=\underbrace{2+2+\cdots+2}_{x\;\text{times}}$? I know $\int 2x \,dx = x^2 + C$ (by the power rule) but why does the following proof not give the same answer?
\begin{align*}
\int 2x \,dx &= \int \underbrace{(2 + 2 + 2 + \dots + 2)}_{x \text{ times}} \, dx \\
             &= \underbrace{\int{2} \, dx + \int{2} \, dx + \dots \ + \int{2}_ \, dx}_{x \text{ times}}\\
             &= 2x + 2x + \dots + 2x + C \\
&= 2x \times x + C \\
&= 2x^2 + C
\end{align*}
(And I have the same question for this false proof that $\int{2^x} \, dx = 2^{x}x+ C$)
\begin{align*}
\int{2^x} \,dx &= \int \underbrace{(2 \cdot 2 \cdot 2 \cdot \dots \cdot 2)}_{x \text{ times}} \cdot 1 \, dx \\
             &= 2 \cdot \int \underbrace{(2 \cdot 2 \cdot 2 \cdot \dots \cdot 2)}_{(x-1) \text{ times}} \cdot 1 \, dx && (\text{Constant Multipule Rule})\\
             &= 2^2 \cdot \int \underbrace{(2 \cdot 2 \cdot 2 \cdot \dots \cdot 2)}_{(x-2) \text{ times}} \cdot 1 \, dx && (\text{Constant Multipule Rule})\\
             &= 2^x \cdot \int{1} \, dx \\
&= 2^{x}x+ C \\
\end{align*}
I suspect that it has something to do with not being able to:

*

*Change integral of sums to sums of integrals for an arbitrary $x$, and


*Remove a constant out of an integral if there are variable numbers of those constants.
But I'm not sure why these do not hold. If this is the reason, is there a theorem stating it?
Thanks in advance!
 A: The first integral is wrong because $x\in\mathbb{R}$ need not be a natural number. So the multiplication cannot be split as you did. Similar reasoning applies to the second case, that is to say, since $x$ need not be a natural number, the interpretation for $2^{x}$ is wrong.
A: The above comments and answer point out that you can't take a variable out of an integral, and that $x$ is not a natural number, but in fact, in the given examples, the error could be more fundamental.
Let $f:\mathbb Z \to \mathbb R$ and $g:\mathbb Z \to \mathbb R$ such that $f(x)=2x$ and $g(x)=2^x.$ Giving benefit of the doubt that the author indeed meant to work in $\mathbb Z,$ that is, that
$$\int 2x \,\mathrm dx=\int f,\\
\int 2^x \,\mathrm dx=\int g,$$ then both integrals immediately equal $0,$ since the domain of integration in each case is a set of isolated points.
If the intention, however, was for interval integration domains, then it is of course invalid to assert that $2x=\underbrace{(2 + 2 + 2 + \dots + 2)}_{x \text{ times}}.$
A: An integral might run from $x=0$ to $x=X$.
In $\int2xdx$, the function is increasing as you go along.  So the first $2$ is there all the way as x goes from 1 to X, but the second $2$ doesn't start until x is 2, and the final $2$ doesn't appear until x has already reached X.
In $\int2dx+\int2dx+...$, all the $2$s are there all the way as x goes from 0 to X.
