# Why does solving this integral using trigonometric substitution lead to the wrong answer?

I was solving the integral $$\int \frac{\sqrt{x^2 - 16}}{x} \, dx,$$ and I admittedly attempted to solve it blindly using trigonometric substitution:

\begin{align} &\int \frac{\sqrt{x^2 - 16}}{x} \, dx, \quad \text{let } x = 4\sec\theta \implies dx = 4\sec\theta\tan\theta \, d\theta \quad(\text{meaning} \ \ \theta=\sec^{-1}\frac{x}{4})\\[0.5em] &\int \frac{\sqrt{16\sec^2\theta - 16}}{4\sec\theta} \cdot 4\sec\theta\tan\theta = \int 4\tan^2\theta \, d\theta = \int 4(\sec^2\theta - 1) \, d\theta = 4\tan\theta - 4\theta + c \\[0.5em] &4\tan\theta - 4\theta + c \ \ \text{becomes} \ \ \sqrt{x^2-16} - 4\sec^{-1}\Bigl(\frac{x}{4}\Bigr) + c \ \ \text{so} \ \ \fbox{\int \frac{\sqrt{x^2 - 16}}{x} \, dx = \sqrt{x^2-16} - 4\sec^{-1}\Bigl(\frac{x}{4}\Bigr) + c} \end{align}

So $$\sqrt{x^2-16} - 4\sec^{-1}\Bigl(\frac{x}{4}\Bigr) + c$$ is the family of antiderivates of $$\frac{\sqrt{x^2 - 16}}{x}$$, so if $$F(x) = \sqrt{x^2-16} - 4\sec^{-1}\Bigl(\frac{x}{4}\Bigr),$$ then $$F'(x) = \frac{\sqrt{x^2 - 16}}{x}$$, right? However, as the graph below shows, that's not the case.

For negative values, the two functions $$F'$$ and $$f$$ do not match at all. When setting $$F(x) = \sqrt{x^2 - 16} - 4\tan^{-1}\biggl(\frac{\sqrt{x^2 - 16}}{4}\biggr),$$ then the two functions do seem to agree.

When I tried to ask an instructor, I was told that we always represent our solutions in terms of either inverse tangent or inverse sine, but not inverse secant. The reason I confidently chose to represent theta as inverse secant is that that's how we always did it, so when I compared my answers to the ones provided, I was extremely confused.

I fear that it might be an issue with the domain of the inverse secant, but I'm not exactly sure how.

• I think this has to do with $\sec^{-1}$ being typically defined as having a range of $[0,\pi/2)\cup(\pi/2,\pi]$: en.wikipedia.org/wiki/… Dec 26, 2022 at 2:58
• Could you elaborate on how this might be the cause of the issue? Dec 26, 2022 at 3:10
• cleaner to take $x = 4 \cosh t$ There is then a Weierstrass substitution that takes that to a rational function... en.wikipedia.org/wiki/… Dec 26, 2022 at 3:19
• If you were integrating this over negative $x$, you would need to choose $\theta$ bounds in $(\pi/2,\pi]$ for $\theta=\sec^{-1}(x/4)$ to be correct, given this choice of definition for $\sec^{-1}$. But then in the second line $\sqrt{16\sec^2(\theta)-16}$ should be $-4\tan(\theta)$, not $4\tan(\theta)$, because $\theta$ is in $(\pi/2,\pi]$. Dec 26, 2022 at 3:39

First of all, recall that $$\sqrt{y^2} = \lvert y\rvert,$$ not $$y$$, because $$\sqrt{y^2}$$ is a non-negative square root even when $$y$$ is negative. Also note that $$0 \leq \sec^{-1}\left(\dfrac x4\right) < \dfrac\pi2$$ if and only if $$x \geq 4,$$ but $$\dfrac\pi2 < \sec^{-1}\left(\dfrac x4\right) \leq \pi$$ if and only if $$x \leq -4.$$ Then

\begin{align} \int \frac{\sqrt{16\sec^2\theta - 16}}{4\sec\theta}\, &\cdot 4\sec\theta\tan\theta \,\mathrm d\theta \\ &= \int \sqrt{16\tan^2\theta}\,\tan\theta \,\mathrm d\theta \\ &= 4 \int \lvert\tan\theta\rvert \tan\theta \,\mathrm d\theta \\ &= \begin{cases} \phantom{-}4 \displaystyle\int\tan^2\theta \,\mathrm d\theta & 0 \leq \theta < \dfrac\pi2,\\ -4 \displaystyle\int\tan^2\theta \,\mathrm d\theta &\dfrac\pi2 < \theta \leq \pi \\ \end{cases} \\ &= \begin{cases} 4 \left( \tan\theta - \theta\right) + C_1 & 0 \leq \theta < \dfrac\pi2,\\ 4 \left(\theta - \tan\theta\right) + C_2 & \dfrac\pi2 < \theta \leq \pi \\ \end{cases} \\ &= \begin{cases} 4 \left(\tan \left(\sec^{-1}\left(\dfrac x4\right)\right) - \sec^{-1}\left(\dfrac x4\right)\right) + C_1 & x \geq 4,\\ 4 \left(\sec^{-1}\left(\dfrac x4\right) - \tan \left(\sec^{-1}\left(\dfrac x4\right)\right)\right) + C_2 & x \leq -4. \\ \end{cases} \end{align}

Now when $$x \geq 4,$$ then $$\tan \left(\sec^{-1}\left(\dfrac x4\right)\right) = \dfrac14 \sqrt{x^2 - 16},$$ sure enough, but when $$x \leq -4$$ then $$\dfrac\pi2 < \sec^{-1}\left(\dfrac x4\right) \leq \pi$$ (second quadrant), hence $$\tan \left(\sec^{-1}\left(\dfrac x4\right)\right)$$ is negative (or zero), hence $$\tan \left(\sec^{-1}\left(\dfrac x4\right)\right) = -\dfrac14 \sqrt{x^2 - 16}.$$ So

$$\int \frac{\sqrt{x^2 - 16}}{x} \, dx = \begin{cases} \sqrt{x^2 - 16} - 4\sec^{-1}\left(\dfrac x4\right) + C_1 & x \geq 4,\\ \sqrt{x^2 - 16} + 4 \sec^{-1}\left(\dfrac x4\right) + C_2 & x \leq -4. \\ \end{cases}$$

Further notice that when $$x \geq 4,$$ then $$\sec^{-1}\left(\dfrac x4\right) = \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right),$$ but when $$x \leq -4,$$ then $$\sec^{-1}\left(\dfrac x4\right) = \pi - \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right),$$ so the integral can also be written

\begin{align} \int \frac{\sqrt{x^2 - 16}}{x} \, dx &= \begin{cases} \sqrt{x^2 - 16} - 4 \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right) + C_1 & x \geq 4,\\ \sqrt{x^2 - 16} + 4\left(\pi - \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right)\right) + C_2 & x \leq -4 \\ \end{cases} \\ &= \begin{cases} \sqrt{x^2 - 16} - 4 \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right) + C_1 & x \geq 4,\\ \sqrt{x^2 - 16} - 4 \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right) + C_3 & x \leq -4. \\ \end{cases} \\ \end{align}

If we set $$C_1 = C_3 = C$$ then we have the solution you might get by other means, $$\int \frac{\sqrt{x^2 - 16}}{x} \, dx = \sqrt{x^2 - 16} - 4 \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right) + C,$$ but in the context of real analysis it is more accurate to say that we can use different constants in the integral for each connected part of the integral's domain.

Some parts of the calculations that were postponed for the sake of the flow of the answer:

Why is $$\sec^{-1}\left(\dfrac x4\right) = \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right)$$ when $$x \geq 4$$?

Let $$x \geq 4$$ and $$\sec^{-1}\left(\dfrac x4\right) = \theta.$$ Then $$\sec\theta = \dfrac x4$$ and $$\theta$$ is in the first quadrant (since $$\dfrac x4 > 0$$), so

$$\tan^2\theta = \sec^2\theta - 1 = \dfrac{x^2}{16} - 1 = \dfrac{x^2-16}{16},$$

so $$\tan\theta = \pm \sqrt{\dfrac{x^2-16}{16}}.$$ But since $$\theta$$ is in the first quadrant, $$\tan\theta$$ must be positive, so $$\tan\theta = \sqrt{\dfrac{x^2-16}{16}}$$ and (again, since $$\theta$$ is in the first quadrant) $$\sec^{-1}\left(\dfrac x4\right) = \theta = \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right).$$

Why is $$\sec^{-1}\left(\dfrac x4\right) = \pi - \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right)$$ when $$x \leq -4$$?

Note that when $$y \leq -1,$$ then $$\sec^{-1} y = \pi - \sec^{-1}(-y).$$ This comes from the way we define the inverse secant function; like the inverse cosine function, we use the second quadrant for negative values. And if $$y \leq -1$$ then $$-y \geq 1,$$ so $$\sec^{-1}(-y)$$ is a first-quadrant angle, so $$\pi - \sec^{-1}(-y)$$ is a second-quadrant angle and

$$\sec\left(\pi - \sec^{-1}(-y)\right) = -\sec\left(\sec^{-1}(-y)\right) = -(-y) = y,$$

as required. Now let $$x \leq -4$$; then $$-x \geq 4$$ and (substituting $$-x$$ for $$x$$ in the what we worked out above for $$x \geq 4$$) $$\sec^{-1}\left(\dfrac {(-x)}4\right) = \tan^{-1}\left(\dfrac{\sqrt{(-x)^2-16}}4\right) = \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right),$$ and $$\sec^{-1}\left(\dfrac x4\right) = \pi - \sec^{-1}\left(\dfrac {(-x)}4\right) = \pi - \tan^{-1}\left(\dfrac{\sqrt{x^2-16}}4\right).$$

• Ah, I finally can rest. This problem has been haunting me for a couple of months! One thing though. When you say, "when $x \le −4$ then $\frac{π}{2}< \sec^{−1}(\frac{x}{4}) \le \pi$, hence $\tan(\sec^{−1}(\frac{x}{4}))$ is non-negative, hence $\tan(\sec^{−1}(\frac{x}{4}))=−\frac{1}{4}\sqrt{x^2−16}$", wouldn't $\tan(\sec^{−1}(\frac{x}{4}))$ actually be negative on that interval? Also, how do you reach the conclusion that for $x \le -4$ $$\sec^{-1}(\frac{x}{4})=\pi-\tan^{-1}\biggl(\frac{\sqrt{x^2-16}}{4}$$? Is there an identity? Similarly, how do you determine the relationship for $x \ge 4$? Dec 26, 2022 at 5:50
• EDIT (because apparently, I can't edit the original comment): When you say, "when $x\le−4$ then $\frac{π}{2}<\sec^{−1}(\frac{x}{4})\le\pi$, hence $\tan(\sec^{−1}(\frac{x}{4}))$ is non-negative, hence $\tan(\sec^{−1}(\frac{x}{4}))=−\frac{1}{4}\sqrt{x^2−16}$", wouldn't $\tan(\sec^{−1}(\frac{x}{4}))$ actually be negative on that interval? Also, how do you reach the conclusion that for $x\le-4$ $$\sec^{-1}\biggl(\frac{x}{4}\biggr)=\pi-\tan^{-1}\biggl(\frac{\sqrt{x^2-16}}{4}\biggr)$$? Is there an identity? Similarly, how do you determine the relationship for $x\ge4$? Dec 26, 2022 at 6:06

\begin{aligned} \int \frac{\sqrt{x^2-16}}{x} d x=&\int \frac{x^2-16}{x \sqrt{x^2-16}} d x \\ = & \int \frac{x^2-16}{x^2} d\left(\sqrt{x^2-16}\right) \\ = & \int\left(1-\frac{16}{x^2}\right) d\left(\sqrt{x^2-16}\right) \\ = & \sqrt{x^2-16}-16 \int \frac{d\left(\sqrt{x^2-16}\right)}{\left(\sqrt{x^2-16}\right)^2+4^2} \\ = & \sqrt{x^2-16}-4 \tan ^{-1}\left(\frac{\sqrt{x^2-16}}{4}\right)+C \\ \end{aligned}

• You are right. Thank you.
– Lai
Dec 26, 2022 at 5:00
• I sense that there is a u-sub somewhere over here. I apologize if it is quite clear, but I've never seen a differential like that before (not in the course, at least). What does $d(\sqrt{x^2 - 16})$ mean? How does it work? Dec 28, 2022 at 11:59
• You may treat $u=\sqrt{x^2-16}$ if it makes you uncomfortable.
– Lai
Dec 28, 2022 at 12:09
• It was rather intriguing! Is there a name for this technique? How does it work? Dec 28, 2022 at 12:12