When change of variable makes an empty interval

Please consider the following case:

$$I = \int^1_{-1}x^2dx$$ $$u(x) = x^2 \rightarrow du = 2x\,dx$$ $$u(-1) = 1, u(1) = 1$$

So

$$I = \int^1_1\frac{u}{2\sqrt u} du = 0$$

Obviously the problem here is to only consider the positive root of u. I don't know how to consider both roots. This example is trivial but I have another example where such substitution would be really helpful:

$$I = \int^1_{-1}\frac{x^2(1 - x^2)^\frac{3}{2}}{3} - \frac{x^2(1 - x^2)^\frac{5}{2}}{5} - \frac{x^4(1 - x^2)^\frac{3}{2}}{3} dx$$

I don't want you to solve it for me using another method, I know how to use an integral solver online. My question is how to properly do the change of variable.


While it's certainly true that $du = 2x\,dx$ over the whole region of integration, it's not true that $x = \sqrt{u}$ over the region. This is only true for $x > 0$, so you can't apply it to the whole integral. Instead, you need to split it apart and use the correct transformation $x = -\sqrt{u}$ for the region $x < 0$.

In general, if your change of variables $u(x)$ has a multivalued inverse, you'll need to split the integral into the regions where each possible inverse function $x(u)$ applies.


In general you need to use a one-to-one change of variable; thus for instance if you were to compute $\int_{-1}^1 x^2 dx$ you would split into $\int_{-1}^0 x^2 dx + \int_0^1 x^2 dx$. Then each of those integrals, after substitution and simplification, becomes $\int_0^1 \frac{1}{2} u^{1/2} du$.

(That said, there are some situations where by basically breaking the rules twice you cancel out your mistakes and get the right answer; see Why can the trig sub $x=\cosh(\theta)$ be used to solve the integral: $\int \frac{1}{(x^2-1)^{3/2}}dx$? for instance.)