$\int_{-1}^1{x^4}dx$ by substitution My student asked me: While solving $\int_{-1}^1{x^4}dx$, why can't we substitute as $t=x^2$
$$x^2 =t, 2xdx = dt, x=\pm \sqrt t, \int_{-1}^{1}(x^2 \cdot x \cdot x) dx = \int_1^1{\pm t 
\sqrt{t}dt} =0 \ne \frac{1}{5}$$
I think the problem comes from $x = \pm \sqrt t$, but I can't properly explain why this happens. How can I prove that this substitution is wrong?
 A: You write in a comment that the formula
$$\int_{\varphi (a)}^{\varphi (b)}{g(x)}dx = \int_{a}^{b} {g(\varphi (x))\varphi '(x)dx}$$
doesn't require $\varphi$ to be injective. This is true. But if you try and use this formula to evaluate your integral with $\varphi(x)=x^2$, you need to choose $g$ so that
$$g(\varphi(x))=\frac12 x^3$$
on $[a,b]=[-1,1]$. But this would require that $g(\varphi(-1))=-\frac12$ and $g(\varphi(1))=\frac12$, which is impossible, because $\varphi(-1)=\varphi(1)$.
So $\varphi$ has to be invertible on $[a,b]$. Otherwise no suitable $g$ can exist.
Taken together with the requirement that $\varphi$ be continuously differentiable on $[a,b]$, this implies that $\varphi$ is $monotonic$ on $[a,b]$. And this is where your substitution breaks down. As others have explained, you can get round this by integrating separately over $[-1,0]$ and $[0,1]$, because $\varphi$ is monotonic on each of these intervals.
This monotonicity requirement seems to be ignored by the various web pages which state the appropriate theorem. True, it is a logical consequence of the theorem, but not, I would say, an obvious consequence.
A: Although I agree with the first line of the explanation of @TonyK, I disagree with his conclusion that in the formula $u=g(x)$ for change of variables for Riemann integration, $g$ is monotone as a logical conclusion of hypothesis. Here I follow Apostol, Math. Analysis, 2nd ed. pp 164-165.
The simplest change of variable result for Riemann integration is
Theorem:  Assume $g$ and its derivative $g'$ continuous on $[a,b]$,  and let $f$ be a continuous function on $g([a,b])$.  Define
$$F(x):=\int^x_{g(a)} f(s)\,ds,\qquad x\in g([a,b])
$$
Then, for any $t\in [c,d]$, the integral $\int^t_a f(g(s))g'(s)\,ds$ exists and has value $F(g(t))$. In particular
$$
\int^{g(b)}_{g(a)}f(s)\,ds =\int^b_a f(g(s))g'(s)\,ds
$$
Remarks: No monotonicity assumptions on $g$ needed.
Proof: I provide a proof to make the point of the remark. All integrals in the statement of the Theorem exists because the integrands are continuous. Define $G$ on $[a,b]$ by
$$ G(t)=\int^t_a f(g(s))g'(s)\,ds$$
The fundamental theorem of Calculus implies that $G'(t)=f(g(t))g'(t)$, and also $F'(x)=f(x)$. Then By the Chain rule
$$ (F\circ g(t))'=F'(g(t))g'(t)=f(g(t))g(t)= G'(t)$$
Hence $h(t)=F(g(t))-G(t)$ is constant on $[a,b]$. Since $G(a)=0=F(g(a))$, it follows that $G(t)=F(g(t))$. In particular, $G(b)=F(g(b))$.

There is an even more general change of variables result for Riemann integral (H. Kesteman, Mathematical Gazette, 45(1961), pp 17-23):
Theorem: Assume $h$ in Riemann integrable in $[a,b]$, and let $c\in [a,b]$. Define $$ g(x)=\int^x_c h(t)\,dt,\qquad x\in[a,b]$$
If $f$ is Riemann integrable on $g([a,b])$, then the integral $\int^b_cf(g(t))h(t)\,dt$ exists and
$$
\int^{g(b)}_{g(c)}f(s)\,ds = \int^b_c f(g(s))h(s)\,ds
$$

Back to the problem in the OP.
The original question asks why the change of variables $t=x^2$ in $I=\int^1_{-1}x^4\,dx$ seems to produce a different result from what the value of the integral $I$ should be ($I=2/5$).
Now, with $t=t(x)=x^2$ one gets
$$\int^1_{-1}x^4\,dx=\frac12\int^{1}_{-1}x^3 2x\,dx=\frac12\int^1_{-1}f(t(x))\,t'(x)\,dx
$$
form some $f$.

*

*The problem here is what  the correct $f(t)$ should be.

*$f(t)=t^{3/2}$ is not quite right for this involves taking a spare root and so a choice of a branch  ( + or  -) need be chosen. Also, the fact that the original integrand is nonnegative implies that  the choice of branch  has to be done so that $f(t(x))t'(x)$ remains non negative.

*So $f(t)=t^{3/2}$ does not work here.

A possible solution is to define
$$f(t)=-\big||t^3|^{1/2}\big|\mathbb{1}_{[-1,0]}(t)+ \big||t^3|^{1/2}\big|\mathbb{1}_{[0,1]}(t)$$
This choice will then break the integral $\int^1_{-1} f(t(x))t'(x)\,dx$ in two pieces $\int^0_{-1}+\int^1_0$. This was, in a way, done by @ZAhmed.
So, on $[-1,0]$
\begin{align}
 \int^0_{-1}x^4\,dx=\frac12\int^{0}_{-1}x^3 2x\,dx=\frac12\int^0_{-1}f(t(x))t'(x)\,dx=
\frac12\int^0_1 f(t)\,dt=\frac{1}{2}\int^1_0t^{3/2}\,dt=\frac15
\end{align}
nand similarly for $\int^1_0x^4\,dx$.
A: Since for $r>0$, $\dfrac{\partial x^r}{\partial x}=r\times x^{r-1}$ and if $r-1+r=4$ then $r=\dfrac{5}{2}$.
Thus,
\begin{align}\int_{-1}^1 x^4\,dx&\overset{x\rightarrow x^4 \text{is even function}}=2\int_0^1 x^4 dx\\
&\overset{y=x^{\frac{5}{2}}}=2\times \frac{2}{5}\int_0^1 ydy\\
&=\frac{4}{5}\int_0^1 y dy\\
&=\frac{4}{5}\left[\frac{y^2}{2}\right]_0^1\\
&=\frac{4}{5}\times \frac{1}{2}\\
&=\boxed{\frac{2}{5}}
\end{align}
A: $$I=\int_{-1}^{1} x^4 dx=2\int_{0}^{1} x^4=2\int_{0}^{1} u^2 \frac{du}{2\sqrt{u}}=\int_{0}^{1} u^{3/2} du=\frac{2}{5}$$
Other method: $$I=\int_{-1}^{0} x^4 dx+ \int_{0}^{1} x^4 dx$$
$x^2=u \implies x=\mp \sqrt{u}$, for the first part $x=-\sqrt{u}$ and for the second one let $x=+\sqrt{u}$, then
$$I=\int_{1}^{0} u^2 \left(-\frac{du}{2\sqrt{u}}\right)+\int_{0}^{1} u^2 \left(\frac{du}{2\sqrt{u}}\right)=\frac{2}{5}.$$
Note that the substitution needs to be increasing or decreasing in the domain of integration. Here $=x^2$ has a minimum so break the integral in two domains $(-1,0)$ and $(0,1)$, because there is a minimum at $x=0$. For the first domain use $x=-\sqrt{u}$ and for the other use $x=\sqrt{u}$ as done in above.
