Let $a>0.$ Using substitution, determine $$\int{\frac{1}{x^2-a^2}}\,\mathbb{d}x.$$
My book's attempt:
$$\int{\frac{1}{x^2-a^2}}\mathbb{d}x\\ [\text{let}\ x=a\sec\theta,\ \therefore dx=a\sec\theta\tan\theta d\theta]\\ =\int{\frac{1}{a^2\sec^2\theta-a^2}}a\sec^2\theta d\theta\\ =\int{\frac{1}{a^2(\sec^2\theta-1)}}a\sec\theta\tan\theta d\theta\\ =\int{\frac{1}{a^2\tan^2\theta}}a\sec\theta\tan\theta d\theta\\ =\frac{1}{a}\int{\frac{\sec\theta}{\tan\theta}}d\theta\\ =\frac{1}{a}\int{\frac{\frac{1}{\cos\theta}}{\frac{\sin\theta}{\cos\theta}}}d\theta\\ =\frac{1}{a}\int{\csc\theta d\theta}\\ =\frac{1}{a}\int{\frac{\csc\theta(\csc\theta+\cot\theta)}{(\csc\theta+\cot\theta)} d\theta}\\ =-\frac{1}{a}\int{-\frac{\csc^2\theta+\csc\theta\cot\theta}{(\csc\theta+\cot\theta)} d\theta}\\ =-\frac{1}{a}\ln|\csc\theta+\cot\theta|+C$$
$$=-\frac{1}{a}\ln\left|\frac{x}{\sqrt{x^2-a^2}}+\frac{a}{\sqrt{x^2-a^2}}\right|+C\\ =-\frac{1}{a}\ln\left|\frac{x+a}{\sqrt{x-a}\sqrt{x+a}}\right|+C\\ =-\frac{1}{a}\ln\left|\frac{\sqrt{x+a}}{\sqrt{x-a}}\right|+C\\ =-\frac{1}{a}{\ln\left|\frac{x+a}{x-a}\right|}^{\frac{1}{2}}+C\\ =-\frac{1}{2}.\frac{1}{a}\ln\left|\frac{x+a}{x-a}\right|+C\\ =\frac{1}{2a}{\ln(\left|\frac{x+a}{x-a}\right|)}^{-1}+C\\ =\frac{1}{2a}\ln\left|\frac{x-a}{x+a}\right|+C.$$
Someone told me that this work contains many errors. The second line clearly has a typo ($\sec^2\theta$ should be replaced with $\sec\theta\tan\theta$ there); what are the other errors?