# Pretty Simple Integral

I am trying to find the following indefinite integral: $$\int \sqrt{x^2+x^4}dx$$

At first, it seems like an easy u-substitution after we factor out an $x^2$ from the square root, but when we do that we are making the implicit assumption that $x \in \mathbb{R}^+$ or zero. Would the correct way be to do the two cases, when x is positive and x is negative, or is there a way to step around that assumption and arrive at one answer for both?

You need to consider both the cases $x\geq 0$, $x \lt 0$

$$\int \sqrt {x^2 + x^4} \,dx = \int |x|\sqrt{1+x^2}\,dx$$

For $x\geq 0$, $\sqrt{x^2} = |x| = x$ we have $$\int x\sqrt{1+x^2} \,dx$$

For $x\lt 0$ we have $\sqrt{x^2} = |x| = -x$ $$\int -x\sqrt{1+x^2}\,dx = -\int x\sqrt{1+x^2}\,dx$$

In short, $$\int\sqrt{x^2 + x^4}\,dx = \pm \int x\sqrt{1 + x^2}\,dx.$$

where the choice depends on the sign of $x$.

Here is how I would approach the problem. Factor: $$\int\sqrt{x^2+x^4}dx=\int \sqrt{x^2(1+x^2)}dx$$ $$=\int \sqrt{x^2}\sqrt{(1+x^2)}dx$$ Identity for $\sqrt{x^2}=|x|$: $$=\int |x|\sqrt{(1+x^2)}dx$$ At this point, I would split the integral, and point out that it is symmetric, because the integrand is symmetric.

Proof of symmetry: $$f(x)=|x|\sqrt{1+x^2}$$ $$f(-x)=|-x|\sqrt{1+(-x)^2}=|x|\sqrt{1+x^2}$$

So we only need to do one side, let's do the positive side for convenience: $$=\int \sqrt{(1+x^2)}\cdot xdx \quad \forall x>0$$ Do a u-substitution of the following: $u=1+x^2 \rightarrow du=2xdx \rightarrow xdx=\frac{du}{2}$ Therefore: $$=\int \sqrt{(u)}\frac{du}{2}$$ $$=\frac{1}{2}\int (u)^{\frac{1}{2}}du$$ $$=\frac{1}{2}\frac{2}{3}(u)^{\frac{3}{2}}$$ $$=\frac{1}{3}(u)^{\frac{3}{2}}$$ Solution is: $$=\frac{1}{3}(1+x^2)^{\frac{3}{2}}$$ As per @amWhy's post, the other integral simply factors a minus sign, so the solution would be: $$=-\frac{1}{3}(1+x^2)^{\frac{3}{2}}$$

To get the full antiderivative you can keep the $|x|$ in the integral. $$\int \sqrt{x^2+x^4} \; dx = \int |x| \sqrt{1+x^2} \; dx$$ for all x.

Set $u=1+x^2$ and then $du = 2x\; dx$. Then substituting you have $$\frac{1}{2} \int \frac{|x|}{x} \sqrt{u} \; du$$

Notice that the function $$\frac{|x|}{x} = \Big\{ \begin{array}{cc} 1 & x>0 \\ -1 & x<0 \\ \end{array}$$

These are the two cases. If you ignored the $|x|$ for $x$ you would just cancel the fraction. You can treat this function like a constant here remembering the restriction on $x$.

Then doing the integral you have $$\frac{1}{3} \frac{|x|}{x} (1+x^2)^{3/2}+C$$ which can be re-written using $\sqrt{x^2} = |x|$ as $$\frac{\left(x^2+1\right) \sqrt{x^4+x^2}}{3 x}+C$$ This is valid for all $x\neq 0$.