Evaluating an indefinite integral $\int\sqrt {x^2 + a^2} dx$ indefinite integral $$\int\sqrt {x^2 + a^2} dx$$
After some transformations and different substitution, I got stuck at this
$$a^2\ln|x+(x^2+a^2)| + \int\sec\theta\tan^2\theta d\theta$$
I am not sure I am getting the first step correct. Tried substituting $ x=a\tan \theta$ but that doesn't help either.
 A: Consider the integral
\begin{align}
I = \int \sqrt{x^{2}+ a^{2}} \, dx.
\end{align}
Make the substitution $x = a \sinh(t)$, $dx = a \cosh(t) dt$, it is seen that
\begin{align}
I &= a \int \sqrt{ a^{2} (1 + \sinh^{2}(t))} \, \cosh(t) \, dt \\
&= a^{2} \int \sqrt{\cosh^{2}(t)} \cosh(t) \, dt \\
&= a^{2} \int \cosh^{2}(t) \, dt \\
&= \frac{a^{2}}{2} \int (1 + \cosh(2t)) dt \\
&= \frac{a^{2}}{2} \left[ t + \frac{1}{2} \sinh(2t) \right] \\
&= \frac{a^{2}}{2} \left[ t + \sinh(t) \cosh(t) \right].
\end{align}
Now back substitute to obtain
\begin{align}
\int \sqrt{x^{2}+ a^{2}} \, dx &= \frac{a^{2}}{2} \left[ \sinh^{-1}(x/a) + (x/a) \cosh(\sinh^{-1}(x/a)) \right] \\
&= \frac{x}{2} \sqrt{x^{2} + a^{2}} + \frac{a^{2}}{2} \sinh^{-1}\left( \frac{x}{a} \right).
\end{align}
A: (I assume $a>0$, which is not restrictive.)
This can be treated in a way very similar to $\int\sqrt{a^2-x^2}\,dx$. Set $x=a\sinh t$, so $dx=a\cosh t\,dt$ and
$$
\sqrt{a^2\sinh^2t+a^2}=a\sqrt{\sinh^2t+1}=a\cosh t
$$
Thus you have to compute
$$
\int\cosh^2t\,dt
$$
The fundamental relation is
$$
\cosh^2t-\sinh^2t=1
$$
so
$$
\int\cosh^2t\,dt-\int\sinh^2t\,dt=t\rlap{\qquad(*)}
$$
(I'll omit the constant of integration). But, integrating by parts,
$$
\int\sinh t\sinh t\,dt=\cosh t\sinh t-\int\cosh t\cosh t\,dt
$$
or
$$
\int\sinh^2 t\,dt=\cosh t\sinh t-\int\cosh^2t\,dt
$$
and, replacing in $(*)$ we get
$$
2\int\cosh^2t\,dt=t-\cosh t\sinh t
$$
Now it's just a problem of back substitution: $\sinh t=\frac{x}{a}$ and
$$
\cosh t=\frac{\sqrt{x^2+a^2}}{a}
$$
while, from
$$
a\frac{e^t-e^{-t}}{2}=x
$$
we get
$$
ae^2t-2xe^t-a=0
$$
or
$$
e^t=\frac{x+\sqrt{x^2+a^2}}{a}
$$
and so
$$
t=\log\bigl(x+\sqrt{x^2+a^2}\,\bigr)-\log a
$$
A: Let $x=a\tan\theta$, so $dx=a\sec^{2}\theta d\theta$ to get
$\int\sqrt{x^2+a^2}\;dx=a^2\int\sec^{3}\theta\;d\theta$.  Using integration by parts with $u=\sec\theta$ and $dv=\sec^{2}\theta\;d\theta$ gives
$\hspace{.6 in}\sec^{3}\theta\;d\theta=\frac{1}{2}\left(\sec\theta\tan\theta+\ln|\sec\theta+\tan\theta|\right)+C$,
so $\int\sqrt{x^2+a^2}=\frac{a^2}{2}\left(\frac{\sqrt{x^2+a^2}}{a}\frac{x}{a}+\ln\left|\frac{\sqrt{x^2+a^2}}{a}+\frac{x}{a}\right|\right)+C$
$\hspace{.9 in}=\frac{1}{2}\left({x\sqrt{x^2+a^2}}+a^2\ln\left(\sqrt{x^2+a^2}+x\right)\right)+C$
A: Here we have another way to see this:
$$
\int \sqrt{x^2+a^2} dx 
$$
using the substitution
$$
t=x+\sqrt{x^2+a^2}\\
\sqrt{x^2+a^2}=t-x
$$
and squaring we have
$$
a^2 =t^2-2tx\\
x=\frac{t^2-a^2}{2t}.
$$
Finally we can use:
$$
dx=\frac{2t(t)-(t^2-a^2)(1)}{2t^2}dt = \frac{t^2+a^2}{2t^2}dt\\
\sqrt{x^2+a^2}=t-\frac{t^2-a^2}{2t}=\frac{t^2+a^2}{2t}.
$$
Thus:
$$
\int \sqrt{x^2+a^2} dx = \int \frac{t^2+a^2}{2t} \frac{t^2+a^2}{2t^2}dt=\int \frac{(t^2+a^2)^2}{4t^3}dt
$$
which is elementary, if we expand the square of the binomial:
$$
\int\frac{t}{4}dt+\int\frac{a^2}{2t}dt+\int\frac{a^4}{4t^3}dt=\frac{t^2}{8}+a^2\ln\sqrt{t}-\frac{a^4}{16t^4},
$$
where as stated $t=x+\sqrt{x^2+a^2}.$
A: $$\sqrt{x^2+a^2}dx = a^2\sqrt{\Big(\frac{x}{a}\Big)^2+1}\,d\frac{x}{a}.$$
Set $\sinh\theta=\frac{x}{a}$.
$$\sqrt{1+\sinh^2\theta}d\sinh\theta=\cosh^2\theta d\theta=\frac{1}{2}(\cosh2\theta+1)d\theta=\frac{1}{4}d(\sinh2\theta+2\theta).$$
A: $\displaystyle \int\sqrt{x^{2}+a^{2}}dx$
$\displaystyle x=a.\ sh(t)\Rightarrow dx=a\ ch(t)dt$
$\displaystyle \int\sqrt{x^{2}+a^{2}}dx
=a^{2}\int\ ch^{2}(t)dt=\frac{a^{2}}{2}\int(1+\ ch(2t))dt $
$\displaystyle =\frac{a^{2}}{2}(t+\frac{\ sh(2t)}{2})+c$
$\displaystyle t=\ sh^{-1}(\frac{x}{a})=ln(\frac{x}{a}+\sqrt{1+\frac{x^{2}}{a^{2}}})=ln(x+\sqrt{x^{2}+a^{2}})-ln(a)$
$\displaystyle\ sh(2t)=2\ sh(t)\ ch(t)=2\frac{x}{a}\sqrt{1+\frac{x^{2}}{a^{2}}}=2\frac{x}{a^{2}}\sqrt{a^{2}+x^{2}}$
$\displaystyle \int\sqrt{x^{2}+a^{2}}dx=\frac{a^{2}}{2}ln(x+\sqrt{x^{2}+a^{2}})+\frac{x}{2}\sqrt{x^{2}+a^{2}}+C$
