How to integrate $\int\sqrt{x^2+1}dx$

Making the substitution $x=\sinh u$ we have $$\int \sqrt{x^2+1} \; \mathrm{d}x=\int \cosh^2 u \;\mathrm{d}u=\int \frac{\cosh 2u+1}{2} \; \mathrm{d}u=\frac{\sinh 2u}{4}+\frac{u}{2}=\frac{\sinh u \cosh u}{2}+\frac{u}{2}$$ Using the hyperbolic functions and their sum of arguements. As we know $$\sinh u=x, \cosh u=\sqrt{x^2+1}, u=\sinh^{-1} x$$ the answer is $$\frac{1}{2} \left(x \sqrt{x^2+1}+\sinh^{-1} x\right)$$ Where $\sinh^{-1} x$ denotes the inverse hyperbolic sine function.


So really you are interested in,

$$I=\int \sec^3(x) dx$$

Integration by parts , integrating $\sec^2 x$ and differentiating $\sec x$, gives:

$$=\sec x \tan x- \int \sec x \tan^2 x$$

$$=\sec x \tan x-\int \sec x (\sec x^2-1)$$

$$=\sec x \tan x-I+\ln (\sec x +\tan x)+C_1$$

So that

$$I=\frac{1}{2}\sec x \tan x+\frac{1}{2}\ln (\sec x+\tan x)+C$$

Now set up a triangle to figure out what $\sec \theta, \tan \theta$ are.


If we stick with your idea, we have $$ \int \sqrt{x^2 + 1}\,dx = \int \sqrt{\tan^2\theta + 1}\, \sec^2\theta \,d\theta = \\ \int\sec^3\theta\,d \theta $$ For this integral, one would use the formula $$ \int\sec^3\theta\,d \theta = \int (1 + \tan^2 \theta) \sec \theta\,d \theta =\\ \int \sec \theta \,d \theta + \int \tan \theta (\tan \theta \sec \theta) \,d\theta $$ The first integral has a formula you can look up, using the trick $$ \int \sec \theta \,d \theta = \int \frac{\sec \theta \tan \theta + \sec^2 \theta}{\sec \theta + \tan \theta} \,d \theta $$ or using the half-angle substitution. The second can be done by parts, which gets you $$ \int \tan \theta (\tan \theta \sec \theta) \,d\theta = \tan \theta \sec \theta - \int \sec^3 \theta \, d\theta $$ which brings you to an equation on $\int \sec^3 \theta \, d\theta$ that can be solved.