# Help evaluating $\int \frac {\sqrt{x^2-1}}x \ dx$ [duplicate]

This question already has an answer here:

Before anything, I'd like to clarify that I have no background in calculus (I'm still in school). I only try to learn calculus as a hobby. Please be gentle.

I'm trying to evaluate the aforementioned integral but the answer I got doesn't seem to match with 3 sources different sources that I found online. My process was to substitute in $$x = \sec u, \ dx = \tan u\sec u\, du$$. This led me to the answer $$\tan (\mathrm{arcsec}\ x) - \mathrm{arcsec}\ x$$. However after trying to check my answer I saw that WolframAlpha says it's $$\arctan \left(\frac 1{\sqrt{x^2-1}}\right) + \sqrt{x^2-1}$$, Symbolab says it's $$-\arctan (\sqrt{x^2-1}) + \sqrt{x^2-1}$$, and this video says it's $$-\mathrm{arcsec} \,x + \sqrt{x^2-1}$$.

I plotted all four results on a graph. Symbolab and WolframAlpha only differ by a constant so I assume that both of them have the correct result whereas the video and I have the wrong ones. Also it can be seen that all the results are the same on the positive side of the x axis but things break down on the negative side.

My final questions are:

• Where did the video creator and I go wrong?
• What is happening on the negative x axis?

EDIT: It seems this post might be a duplicate of this one. I hope this post doesn't get removed because I believe what I asked is a bit different from what was asked there. EDIT 2: Upon further inspection, I guess it's reasonable for this post to be removed.

## marked as duplicate by Jyrki Lahtonen, user99914, Strants, grndl, ChickenmancerAug 17 '18 at 22:20

• Always check your results by taking the derivative. – Yves Daoust Aug 17 '18 at 12:09
• @YvesDaoust The problem is, differentiating inverse trigonometric functions is out of my knowledge 😅. – Typo Aug 17 '18 at 12:19
• Then you can't do this exercise which does involve an inverse trigonometric function (which apparently you master ?!?). – Yves Daoust Aug 17 '18 at 12:25
• @YvesDaoust What do you mean by "which you apparently master"? The method by which I arrived at my answer did not involve integrating any derivatives of inverse trigonometric functions. By the end, I just had to integrate $\tan^2 u$. If I knew the derivative of tangent beforehand, I would've taken your approach. – Typo Aug 17 '18 at 12:45
• sorry, my bad. If you don't know the derivatives of the inverse trigonometric functions, you can't solve this exercise – Yves Daoust Aug 17 '18 at 12:47

This is a good question, and ultimately it's about a subtle point in trigonometry more than calculus.

As you already know, the occurrence of the expression $\sqrt{x^2 - 1}$ suggests the substitution $$x = \sec \theta, \qquad dx = \sec \theta \tan \theta \,d\theta.$$

Here's the first subtlety: There are many values of $\theta$ satisfying $x = \sec \theta$ for any $x \in (-\infty, -1] \cup [1, \infty)$, but we can force a unique choice by requiring $\theta \in [0, \pi] - \{\frac{\pi}{2}\}$. This is how $\operatorname{arcsec}$ is usually defined---it is the inverse of the restriction of $\sec$ to that set, and so by definition $\theta = \operatorname{arcsec} x$.

Now, in the computation, the video uses (and presumably you used) a reference triangle to show that $\sqrt{x^2 - 1} = \tan \theta$. And indeed, this is true for the angles that can occur in the reference triangle, namely those in $[0, \frac{\pi}{2})$, for which $\tan \theta$ is always positive. But in general $\sqrt{x^2 - 1} = \sqrt{\sec^2 \theta - 1} = |\tan \theta|$, and we cannot ignore the absolute value for negative values of $\tan \theta$, which occur for the possible values $\theta \in (\frac{\pi}{2}, \pi]$.

So, if we restrict the integrand to positive $x$, then $\theta \in [0, \frac{\pi}{2})$, so $\tan \theta \geq 0$ and $\sqrt{x^2 - 1} = \tan \theta$, so our integral is $$\int \frac{\sqrt{x^2 - 1} \,dx}{x} = \int \frac{\tan \theta \cdot \sec \theta \tan \theta \,d\theta}{\sec \theta} = \int \tan^2 \theta \,d\theta = \tan \theta - \theta + C .$$ Substituting back gives $$\sqrt{x^2 - 1} - \operatorname{arcsec} x + C ,$$ as expected.

On the other hand, if we restrict the integrand to negative $x$, then $\theta \in (\frac{\pi}{2}, \pi]$, so $\tan \theta \leq 0$ and thus $\sqrt{x^2 - 1} = -\tan \theta$, so the integral is $$\int \frac{\sqrt{x^2 - 1} \,dx}{x} = \int \frac{-\tan \theta \cdot \sec \theta \tan \theta \,d\theta}{\sec \theta} = -\int \tan^2 \theta \,d\theta = -\tan \theta + \theta + C' ,$$ and substituting back now gives $$\sqrt{x^2 - 1} + \operatorname{arcsec} x + C' .$$ We can unify these answers and reconcile them with the correct answers given in the question: Carefully unwinding definitions gives that for $x \geq 1$, $\operatorname{arcsec} x = \arctan \sqrt{x^2 - 1}$ but that for $x \leq -1$, $\operatorname{arcsec} x = \pi - \arctan \sqrt{x^2 - 1}$, so by absorbing $\pi$ into the constant we can write the antiderivative for both positive and negative $x$ simultaneously as $$\boxed{\sqrt{x^2 - 1} - \arctan \sqrt{x^2 - 1} + C} .$$ The appearance of the term $\arctan \frac{1}{\sqrt{x^2 - 1}}$ in one of the answers arises from the identity $\arctan u + \arctan \frac{1}{u} = \pm \pi$, where the sign $\pm$ is the sign of $u$.

• This gives me some intuition. I unfortunately understood only part of your answer because of my inexpertise but I think I got the gist of it. Is there a way for me to detect these sorts of nuances? Say, if I got a question like this in an exam, subtleties like these aren't apparent in the slightest and I would've probably went along with my first answer because there just isn't a clue that tells me that secant has properties like this. – Typo Aug 17 '18 at 13:24
• The key observation here is that $\sqrt{\sec^2 \theta - 1} = |\tan \theta|$, rather than just $\tan x$. This tells you that to proceed this way you need to split cases according to the sign of $\tan \theta$, and unwinding the definition shows that this turns out to be the same as the sign of $x$. – Travis Willse Aug 17 '18 at 15:53
• Knowing that for $x > 0$ we have $\operatorname{arcsec} x = \pi - \arctan \sqrt{1 - x^2}$ rather than just $\sqrt{x^2 - 1}$, is less obvious, but (1) remember that the equations we deduce from reference triangles sometimes apply only in situations where one can actually draw the triangle, and (2) there's nothing wrong with writing an antiderivative using multi-part notation. – Travis Willse Aug 17 '18 at 15:58
• I didn't actually use the triangle, I only used simple algebra and substitution. Because of the lack of any real-time "feedback" from my answer while writing it, things like this often go under my radar and it's the reason why I was so surprised by the answer being correct for only positive x. I was intrigued to point of seeking online help. It's quite hard to explain this feeling, sorry if I'm just rambling now. – Typo Aug 17 '18 at 19:53
• This is really a subtle issue, and it's something that can occur when making (especially trigonometric) substitutions, but it's really not something that comes up often in practice. In this particular case, there's a shortcut that lets you get around the analysis of the $x < 0$ case, namely that since the original integrand is odd, we can produce an even antiderivative by taking our answer for the $x > 0$ case and reflecting it across the $y$-axis. – Travis Willse Aug 17 '18 at 22:41
• With $\tan t=\sqrt{\sec^2t-1}$ your answer is $$\tan (\mathrm{arcsec}\ x) - \mathrm{arcsec}\ x=- \mathrm{arcsec}\ x+ \sqrt{x^2-1}+\color{blue}{C}=-\arctan \sqrt{x^2-1} + \sqrt{x^2-1}+\color{blue}{C}$$
• From $\arctan\dfrac1t=\dfrac{\pi}{2}-\arctan t$ we have $$\arctan \left(\frac 1{\sqrt{x^2-1}}\right) + \sqrt{x^2-1}+\color{blue}{C}=-\arctan \sqrt{x^2-1} + \sqrt{x^2-1}+\color{blue}{C}+\dfrac{\pi}{2}$$
• I didn't see the video, but $-\mathrm{arcsec} (\sqrt{x^2-1}) + \sqrt{x^2-1}$ is wrong.

Edit:

• For $x>0$, $\mathrm{arcsec}\ x=\arctan \sqrt{x^2-1}$.
• For $x<0$, $\mathrm{arcsec}\ x=\color{red}{-}\arctan \sqrt{x^2-1}\color{red}{+\pi}$. This caused your graph be negative with a $\color{red}{\pi}$ shift.
• Yes sorry, the video actually says $-\mathrm{arcsec} \, x + \sqrt{x^2-1}$. With this, all the answers are actually the same. My current problem is that, if they're all just differing by some constant, why is it that in the graph both my and the video's answer different to the actual answer? It has got to do something with secant but what is it? – Typo Aug 17 '18 at 12:41

Let $x=\sqrt{u^2+1}$. We have

$$\int\frac{\sqrt{x^2-1}}{x}dx=\int\frac{u}{\sqrt{u^2+1}}\frac{u}{\sqrt{u^2+1}}du=\int\left(1-\frac1{u^2+1}\right)du=u-\arctan u+C.$$

Note that $-\arctan u$ and $\arctan\dfrac1u$ only differ by a constant.