Which my step is incorrect to prove $\int_{-\infty}^\infty xe^{-x^2}dx = 0$? To prove $\int_{-\infty}^\infty xe^{-x^2}dx = 0$, my solution is


*

*Let $y=x^2$, then $dy=2xdx$.

*$\begin{align} \int_{-\infty}^\infty xe^{-x^2}dx &= \frac{1}{2}\int_{-\infty}^\infty e^{-x^2}2xdx  &\cdots (2.1)  \\
 &=\frac{1}{2}\int_{0}^{\infty}e^{-y}dy  &\cdots  (2.2) \\
 &=\frac{1}{2} & \cdots  (2.3)
 \end{align}$


I don't know which step I made a mistake on?

Updating:


*

*For the change of the limits of integration (2.2), I think $y=x^2 \in [0, \infty]$.

*I know $xe^{-x^2}$ is odd. So I know to prove this equation by this property. But my puzzle is I think each step is correct but the result is incorrect.

 A: Your mistake is right before you substitute. You have $y=x^2$ and $dy=2x \;dx$. So substituting carefully,
$$
\int_{0}^{\infty} xe^{-x^2}\;dx=\int_0^{\infty} xe^{-y}\cdot \frac{1}{2x} \;dy=\int_0^\infty \frac{e^{-y}}{2}\;dy
$$
But you need to be careful! Notice my integral only goes from $0$ to $\infty$. Why didn't I do $-\infty$ to $\infty$? Notice then you'd obtain $\infty$ as both your upper and lower bound. But that can't be correct! What's happening? Well, your substitution isn't one-to-one over the region you're integrating! One needs to be careful!
But there is an easy way to do this integral! Very easy indeed. So I'll leave you with a hint:
HINT. Let $f(x)=xe^{-x^2}$. What is $f(-x)$? What does that mean about $f(x)$ (is it even or odd or neither?), what does that mean for your integral?
EDIT. What is one-to-one? This means for any given output of a function, there could only have been one input that one could use to obtain that output. For example, take $f(x)=x$. What $x$ do we have to put in to obtain $3$? We let $x=3$ to obtain $3$. Are there any other $x$'s such that $f(x)=3$? No. Therefore, $f(x)=x$ is one-to-one, or as some would say, injective (another word for one-to-one).
That seems rather trivial, but let's contrast this with a different example. Take $f(x)=x^2$. What $x$ can we put into $f$ to obtain $4$? Well, $x=2$ will work as $f(2)=2^2=4$. Are there any others? Indeed, there are! Let $x=-2$ then $f(-2)=(-2)^2=4$. Therefore, $f(x)=x^2$ is not one-to-one. Why? Because if I asked you, for example, what $x$ you plugged in to obtain $4$, you couldn't tell me if it was $x=-2$ or $x=2$. 
For functions $f(x)$ that can be plotted in the plane, determining if $f(x)$ is one-to-one is easy: $f(x)$ is one-to-one only if every horizontal line in the plane intersects $f(x)$ at most once. Notice every horizontal line intersects $f(x)=x$ at only one place. But for $f(x)=x^2$, every horizontal line $y=c$, with $c<0$, do not intersect $f(x)=x^2$. But that's not a problem. The line $y=0$ intersects $f(x)=x^2$ once but every horizontal line $y=c>0$ intersects the parabola twice. Therefore, $f(x)=x^2$ is not injective.
But why would we need a $u$-substitution to be one-to-one over the interval which we are integrating? The major problem is that we should be able to return to our original integral. I particularly like the example given here in this question.
Moreover, that question makes it clear what problems can arise when the substitution is not injective. I will not iterate their fine arguments. As one of the answers mentions in the comments, in some cases it doesn't matter if the substitution is injective or not. In fact, it can be hard to come up with examples when it does. Even in your problem, 
$$
\int_{-\infty}^\infty xe^{-x^2}\;dx=0
$$
and with the substitution $y=x^2$, we have
$$
\int_\infty^\infty \cdots \;dy=0
$$
without even needing to know what $\cdots$ means.
Of course, the substations need also be continuous but for a different reason (to map the integration region 'the way we want'). These things won't often come into play in the introductory Calculus course beyond that you should know that these things should be checked for.
The biggest take away point, is that the $(-\infty,\infty)$ interval maps to $(\infty,\infty)$ in the substitution shows that this method for integrating your function is probably a bad method and that something else has been missed. Indeed, here the simple solution of seeing the integral as an odd function is probably the best way of doing this and was also probably the take away point.
A: The change of variables $y=x^2$ makes sense only for $x\ge 0$ or only for $x\le 0$. 
Basically $xe^{-x^2}$ is an odd function, i.e., $f(-x)=-f(x)$ , and thus its integral is equal to zero.
