[Math] Square root of a square in an integral

absolute valueintegration

When you are solving an integral, and you have a square root of a square, for instance

$$ \int \sqrt{1+\cos x} = \int \sqrt{\frac{\sin^2x}{1-\cos x}}$$

Do I have to take the absolute value of $\sin x$, or can I just take the positive value?

$$= \int \frac{|\sin x|}{\sqrt{1-\cos x}}$$ OR
$$= \int \frac{\sin x}{\sqrt{1-\cos x}}$$

If I have to take the absolute value, should I look for a better method when solving integrals than that one, because two solutions seem more complicated.

Best Answer

For the sake of simplicity, let us consider

$$ \int \sqrt{\sin^{2}(x)} \, dx \tag{1}$$

It is not completely clear what $(1)$ means to me.

Consider:

$$ \forall s \in \mathbb{R}, \; F(s) = \int_{0}^{s} \sqrt{\sin^{2}(x)} \; dx. $$

$F$ is the anti-derivative of $x \mapsto \sqrt{\sin^{2}(x)}$ which vanishes at $0$. [Note that the choice of $0$ is arbitrary.]

As you know: for all $x \in \mathbb{R}, \; \sqrt{\sin^{2}(x)} = \vert \sin(x) \vert$. Therefore, $F$ is always given by:

$$ \forall s \in \mathbb{R}, \; F(s) = \int_{0}^{s} \vert \sin(x) \vert \; dx. \tag{2}$$

If you are interested in, say, $F(\pi)$, the sign of $\vert \sin(x) \vert$ is constant on $[0,\pi]$. Therefore:

$$ F(\pi) = \int_{0}^{\pi} \vert \sin(x) \vert \, dx = \int_{0}^{\pi} \sin(x) \, dx. $$

However, if $s$ is arbitrary, the sign of $\vert \sin(x) \vert$ might change as $x$ ranges from $0$ to $s$. Then, one cannot remove the absolute values. One possible workaround is to use Chasles relation for integrals and split $F$ into a sum of integrals for which the sign of $\vert \sin(x) \vert$ is constant. Example:

$$ \begin{align*} F(3\pi/2) & = {} \int_{0}^{3\pi/2} \vert \sin(x) \vert \; dx \\[2mm] & = \int_{0}^{\pi} \vert \sin(x) \vert \; dx + \int_{\pi}^{3\pi/2} \vert \sin(x) \vert \, dx \\[2mm] & = \int_{0}^{\pi} \sin(x) \, dx - \int_{\pi}^{3\pi/2} \sin(x) \, dx \end{align*}. $$

Related Question