$$\int \frac{1}{x^2-a^2}dx$$
Now, I know this can be done by splitting the function into two integrable functions,
$\displaystyle\dfrac{1}{2a}\int \bigg(\dfrac{1}{x-a} - \dfrac{1}{x+a}\bigg)dx$
And then doing the usual stuff.
My question is, how can we do this by using trigonometric substitution?
The only thing that gets in my mind is $x=a\sec\theta$, but then got stuck on proceeding further.
Any help would be appreciated.
We have $$I=\int \frac{1}{x^2-a^2}dx$$
Let $x=a\cos\theta$, then $dx=-a\sin\theta d\theta$.
\begin{align} I &= \int \frac{1}{x^2-a^2}dx \\ &= \int \frac{-a\sin\theta}{a^2(\cos^2\theta-1)}d\theta \\ &=\int \frac{-a\sin\theta}{-a^2\sin^2\theta}d\theta \\ &= \frac1a\int \csc\theta d\theta \\ &= -\frac1a\ln\left\lvert\csc\theta+\cot\theta\right\rvert +C\\ &= -\frac1a\ln\left\lvert\frac{1}{\sin\theta}+\frac{\cos\theta}{\sin\theta}\right\rvert +C\\ &= -\frac1a\ln\left\lvert\frac{1+x/a}{\pm\sqrt{1-x^2/a^2}}\right\rvert +C\\ &= -\frac1a\ln\left\lvert\frac{\sqrt{1+x/a}\sqrt{1+x/a}}{\sqrt{1-x/a}\sqrt{1+x/a}}\right\rvert +C\\ &= -\frac1{2a}\ln\left\lvert\frac{1+x/a}{1-x/a}\right\rvert +C\\ &= -\frac1{2a}\ln\left\lvert\frac{a+x}{a-x}\right\rvert +C\\ \end{align}