# Where is the absolute value when computing antiderivatives?

Here is a typical second-semester single-variable calculus question:

$$\int \frac{1}{\sqrt{1-x^2}} \, dx$$

Students are probably taught to just memorize the result of this since the derivative of $\arcsin(x)$ is taught as a rule to memorize. However, if we were to actually try and find an antiderivative, we might let

$$x = \sin \theta \quad \implies \quad dx = \cos \theta \, d \theta$$

so the integral may be rewritten as

$$\int \frac{\cos \theta}{\sqrt{1 - \sin^2 \theta}} \, d \theta = \int \frac{\cos \theta}{\sqrt{\cos^2 \theta}} \, d \theta$$

At this point, students then simplify the denominator to just $\cos \theta$, which boils the integral down to

$$\int 1 \, d \theta = \theta + C = \arcsin x + C$$

which is the correct antiderivative. However, by definition, $\sqrt{x^2} = |x|$, implying that the integral above should really be simplified to

$$\int \frac{\cos \theta}{|\cos \theta|} \, d \theta = \int \pm 1 \, d \theta$$

depending on the interval for $\theta$. At this point, it looks like the answer that we will eventually arrive at is different from what we know the correct answer to be.

Why is the first way correct even though we're not simplifying correctly, while the second way is... weird... while simplifying correctly?

• The substitution $x=\sin(\theta)$ isn't bijective Feb 8 '17 at 4:59
• It's not supposed to be done implicitly -- we explicitly restrict the domain. You'll see that in any Calculus textbook. But in the classroom instructors often downplay this, to the point of not mentioning this domain restriction at all -- because the topic is already more than challenging for students, and instructors focus on the steps and omit what may be considered technical details. I'm not saying it's great, but this seems to be a very common practice. (I'm guilty of doing this myself, to be honest.) Feb 8 '17 at 5:07
• @zipirovich Although here we don't lose any of our domain. The integral itself has a limited domain, and we create a $1-1$ bijection with the substitution Feb 8 '17 at 5:08
• “by definition, $\sqrt{x^2} = |x|$” – huh? That's not by definition. Whose definition is it supposed to be, $\sqrt{.}$, $(.)^2$ or $|.|$'s? Feb 8 '17 at 15:43
• @leftaroundabout: Ah it's by the Grand Edict of the Ruler of the Square Country. Perhaps contrived by Chief Advisor Argand in a bid to get rid of iffy rulings and replace them by well-rounded ones, namely $|x+yi| = \sqrt{x^2+y^2}$ for every real $x,y$. Feb 8 '17 at 15:49

The function we are integrating is only defined on the interval $(-1,1)$. We want a bijective relationship; therefore, when we substitute $x=\sin(\theta)$ we force $\theta$ to only take on values between $-\frac{\pi}{2}$ and $\frac{\pi}{2}$, giving us our bijection. Note that $\cos(x)$ is positive in this region, so we can drop the absolute value.

One may ask what happens if we choose a different interval for $\theta$, such as $[\pi/2,3\pi/2]$. Everything works out the same until we get the answer $-\theta+c$, which gives an answer of $-\arcsin(x)+c$. This might seem confusing, but remember that this $\arcsin$ function is different than the one we are used to; it is the inverse of $\sin(x)$ on the interval $[\pi/2,3\pi/2]$ instead of the usual $[-\pi/2,\pi/2]$. What this yields is an $\arcsin$ function that is flipped horizontally around the $y$-axis and is shifted higher. However, note that the negative sign we got flips the function back, and then the constant of integration account for the vertical shift.

If a visual is desired, here you go. The purple curve is the $\arcsin(x)$ we are used to (associated with the green section of sine curve) and the orange curve if the "new" $\arcsin(x)$ (associated with the red section of the sine curve)

• Plus one for the explanation; minus epsilon for picking red and green for the sin(x) graph. (friendly note from the colorblind contingent). Feb 8 '17 at 6:33
• @MarkH You're right, my bad. If I hadn't closed out of the graph I would quickly change the color. For all color-blind people reading this comment, understand that the left half of the sine function is the "green" part and the right half is the "red" part (the split happens at $x=\pi / 2$) Feb 8 '17 at 6:43

Let $\operatorname{sgn}(x)$ be the function that takes values $-1, 0, 1$ depending on the sign of $x$.

For the sake of generality, if you have two variables $x$ and $\theta$ related by $x = \sin \theta$ and the square root symbol means to always take the positive square root, then the opening post is correct: the right formula relating the differentials is

$$\frac{\mathrm{d}x}{\sqrt{1 - x^2}} = \operatorname{sgn}(\cos(\theta)) \mathrm{d} \theta$$

Now, one thing to note is that the domain of these functions excludes $x = \pm 1$; similarly, it excludes all values of $\theta$ for which $\cos(\theta) = 0$.

On this domain, $\operatorname{sgn}(\cos(\theta))$ is locally constant. In this situation, the domain consists of a series of completely disjoint intervals $$\ldots \cup (-3\pi/2, -\pi/2) \cup (-\pi/2, \pi/2) \cup (\pi/2, 3\pi/2) \cup \ldots$$ "Locally constant" means any function that is constant on each of these intervals, but can have different values on different intervals.

Nearly everywhere in calculus where you learned something involving constants is actually about things that are locally constant

For example, since $\operatorname{sgn}(\cos(\theta))$ is locally constant, its antiderivatives are all of the form

$$\operatorname{sgn}(\cos(\theta)) \theta + C(\theta)$$

where $C(\theta)$ is also locally constant. (note that we need a local constant of integration, not merely a constant of integration!)

Now, if we were so inclined, we can extend this formula to the domain of all $\theta$ by lining up all of the constants. The end result is that the antiderivative is a constant plus the sawtooth function depicted below:

Image produced by Wolfram alpha

As an example of seeing how this working, suppose our goal was to compute the integral

$$\int_{-1}^1 \frac{\mathrm{d}x}{\sqrt{1 - x^2}}$$

While unusual, we can rewrite this as

$$\int_{-\pi/2}^{5\pi/2} \operatorname{sgn}(\cos(\theta)) \mathrm{d} \theta$$

This isn't an invertible substitution, since each value of $x$ corresponds to three different values of $\theta$ (barring a few exceptions). But one-dimensional integration is very robust, and we should still expect to get the right answer if we have the details right.

And we do; if we take the sawtooth function above as the antiderivative, then the integral becomes

$$\left( \frac{\pi}{2} \right) - \left( -\frac{\pi}{2} \right) = \pi$$

which is the correct answer — and the same answer we'd get by only integrating over $(-\pi/2, \pi/2)$.

Of course, if we aren't interested in the greater generality, we can just simplify by insisting that $\theta \in [-\pi/2, \pi/2]$ and simply take $\theta + C$ as the antiderivative, thus avoiding any hassles with the sign.

This is a good question. Note that the domain for the arcsine function, $\arcsin(x)=\int_0^x\frac{1}{\sqrt{1-t^2}}\,dt$,is $|x|\le1$.

Hence, upon enforcing the substitution $t=\sin(\theta)$, then for $|\theta|\le \pi/2$, $\cos (\theta)\ge 0$.

We could have chosen alternatively $\theta \in (-\pi/2+n\pi,\pi/2+n\pi)$ from which we see that

$$\text{sgn}\left(\cos(\theta)\right)=\begin{cases}1&,n\,\,\text{even}\\\\-1&,n\,\,\text{odd}\end{cases}$$

For odd values of $n$, the substitution $x=\sin(\theta)$ yields

\begin{align} \int \frac{1}{\sqrt{1-x^2}}\,dx&=-\theta +C\\\\ &=-\arcsin(x)+C\\\\ &=n\pi -\arcsin(x)+C'\\\\ &=\arcsin(x)+C' \end{align}

And hence, the antiderivative $\int \frac{1}{\sqrt{1-x^2}}\,dx=\arcsin(x)+C$ is valid regardless of whether $n$ is even or odd.

Because in integrals like this we make the substitution $x=\sin\theta$ with an additional assumption that $\displaystyle \theta\in\left[-\frac{\pi}{2},\frac{\pi}{2}\right]$. That places $\theta$ in the fourth and first quadrants only. And although it is true that we should say that $\sqrt{\cos^2\theta}=|\cos\theta|$, in both these quadrants cosine is non-negative, and thus we can continue to simplify $\sqrt{\cos^2\theta}=|\cos\theta|=\cos\theta$.

In this problem, we are considering the sine function only on the interval from $-\pi/2$ to $+\pi/2,$ and in that interval the cosine is everywhere non-negative.

PS: $\ldots\,$and having posted that, I see that several others have said the same thing, and of course that should surprise nobody. I've up-voted all of them. So let me add that perhaps the way in which I would find the anti-derivative is by finding the derivative by using the chain rule (the chain rule is differentiation by substitution rather than integration by substitution).

\begin{align} y & = \arcsin x \\[4pt] x & = \sin y \\ 1 & = (\cos y) \frac {dy}{dx} \\[8pt] \frac 1 {\cos y} & = \frac{dy}{dx} \\[10pt] \frac 1 {\sqrt{1-\sin^2 y}} & = \frac {dy}{dx} \\[10pt] \frac 1 {\sqrt{1-x^2}} & = \frac{dy}{dx} \end{align}

By the FTC, the answer is

$$F(x) = \int_0^x\frac{1}{\sqrt {1-t^2}}\, dt+C$$

for $|x|<1.$ But can we write $F(x)$ in terms of functions that we understand better? Yes, in this case, by using the basic substitution theorem, which is usually lost in the haze by teaching assistants, textbook writers, and too many professors as well. The real answer to your question lies in understanding this theorem thoroughly.