# Cancelling with absolute values

I am trying to understand how cancellation works in integrals when there are absolute value expressions involved. For example:

$$\int\frac{sinx}{\sqrt{1-cos^2x}}dx = \int \frac{sinx}{\lvert sin(x) \rvert}dx =x + C$$

Depending on whether $$sin(x)$$ is positive or negative, the value of the ratio above should be either $$1$$ or $$-1$$ and so, for example, $$\int_0^{2\pi} \frac{sin(x)}{\lvert sin(x) \rvert}dx \overset!= 0 \not= 2\pi$$

However, in many integrals I see, especially those involving trigonometric substitutions, I feel like this issue is just being ignored.

• You can use $\frac{\sin x}{|\sin x|}=\mathrm{sgn}(\sin x)$, then upon integrating you end up with $x\,\mathrm{sgn}(\sin x)+C$ where $\mathrm{sgn}(x)$ is the "sign function" that gives the sign of its argument. Then the definite integral gives a consistent result:$$\int_0^{2\pi}\mathrm{sgn}(\sin x)\,\mathrm dx=x\,\mathrm{sgn}(\sin x)\bigg|_{x=0}^{x=2\pi}=2\pi\,\mathrm{sgn}(\sin2\pi)=0$$ – user170231 Jan 11 at 18:12

You are right: $$\dfrac{\sin x}{\lvert \sin x\rvert}$$ is $$\pm1$$, for each $$x$$. In fact\begin{align}\int_0^{2\pi}\frac{\sin x}{\lvert \sin x\rvert}\,\mathrm dx&=\int_0^\pi1\,\mathrm dx+\int_\pi^{2\pi}-1\,\mathrm dx\\&=\pi-\pi\\&=0.\end{align}
Since $$\frac{sinx}{|sinx|}=\pm 1$$, the indefinite integral will be $$\pm x+C$$, so for example $$\int_0^x =x$$ for $$x\le \pi$$. However for $$\pi\lt x\le 2\pi$$, the integral is $$2\pi -x$$.
There can be many reasons for why something like that might be ignored. Assuming it isn't a simple mistake, it might just be that, over the domain of integration, the value of the expression in the absolute value is always positive (or negative, for that matter), and so there is no need to break the integral up. An example similar to what you gave would be $$\int_0^\pi\frac{\sin x}{\sqrt{1-\cos^2x}}dx=\int_0^\pi\frac{\sin x}{|\sin x|}dx=\int_0^\pi1dx=\pi,$$ where we can ignore the absolute value because $$\sin(x)\geq 0$$ whenever $$x\in(0,\pi)$$. With that said, you are completely right that if this does not happen, then we will in general need to split the integral up and integrate over different domains, then sum the result. An example would be $$\int_0^3||x-1|-|x-2||dx.$$ If we were to attempt at evaluating it immediately, we would nto get anywhere, because the absolute value "partitions" the integral up in such a way that makes it invulnerable to attack, so to speak. Instead, we have to consider the integral over the domains $$[0,1]$$, $$[1,3/2]$$, $$[3/2,2]$$ and $$[2,3]$$ individually, then sum it up. See it yourself on Desmos!
• Thanks a lot for your help! Trigonometric substitutions confused me. Say we are asked to evaluate $\int \frac{1}{\sqrt{(1-x^2)}}dx$. Now, from my understanding, in the substitution $x=sin(t)$ we can restrict $t$ such that $t \in (- \frac{\pi}{2}, \frac{\pi}{2})$. Over this domain $cos(t) > 0$ so the issue is solved. – Leon231000 Jan 8 at 11:32