How is this not an elementary anti derivative i was computing integrals, and was thinking of an anti-derivative of $\int e^{-x^2} dx $. See, i know for a fact that this function has no elementary anti-derivative, but i was curious and tried around a bit. For this i used the known fact, that $e^x=\sum\limits_{n=0}^{\infty} \frac{x^n}{n!}$, so i replaced $x$ by $-x^2$. This gives the following : $\int e^{-x^2}dx=\int \sum\limits_{n=0}^{\infty} \frac{-x^{2^n}}{n!} dx$.
Now, if integrated, term by term, wouldnt this be a countable sum of elementary functions, thus making it elemetary? I would appreciate if anyone could point out my flaw(s) here. Maybe i just cant substitute $x$ for $-x^2$?
 A: I should note that its actually $(-x^2)^{n} = (-1)^{n}x^{2n}$.
There's no problem substituting $x$, in fact it helps define the error-function.
Anyway, the function you can get from this substitution is not elementary, simply because it's an infinite sum of polynomials!
See the definition of an Elementary Function here.
Edit: Thank you Matthew Towers for correcting me - yes, an infinite polynomial can be an elementary function - for example, $\sum_{n \geqslant 0} \frac{x^n}{n!}$. Although some infinite polynomials are elementary functions - some aren't, for example your integral (or the integral of $e^{x^2}, x^x$ and a bunch more). Proving this isn't very easy - it's actually quite difficult.
Unfortunately, as much as I hate saying this (especially in mathematics), you just have to agree that the integral you presented is not elementary, since proving this requires a lot of extra knowledge - which unfortunately I don't know. If you still want to read some more about this, here are a few more questions on Math SE which talk about this:

*

*How can you prove that a function has no closed form integral?

*Why can't erf be expressed in terms of elementary functions?

*Proving that special functions do not have closed-form expression

*Integration of $e^{-x^2}$
