So I was attempting a basic indefinite integral problem which goes like $$\int \frac{1}{{x^3}\sqrt{x^2-a^2}}dx$$ for which I used the substitution $x=a\sec\theta$ which on differentiating gave $$dx=a\sec\theta\tan\theta d\theta$$. Now after further substitution and evaluation, I get the following steps-
$$I=\int\frac{a\sec\theta\tan\theta d\theta}{{a^3\sec^3\theta}{\sqrt{a^2(\sec^2\theta-1)}}}$$
Now using $$\sec^2\theta-1=\tan^2\theta$$ and further cancelling the terms,
$$I=\int\frac{\cos^2\theta d\theta}{a^3}$$
which on integrating using $$\cos^2\theta= \frac{1+\cos2\theta}{2}$$ and substituting back $$\theta=\sec^{-1}\frac{x}{a}$$ , the final answer looks something like
$$I=\frac{\sec^{-1}\left(\frac{x}{a}\right)+\frac{1}{2}\sin\left(2\sec^{-1}\left(\frac{x}{a}\right)\right)}{4a^3} + c $$
But I saw some solutions on internet and none of them matches with my solution. So I want to know where have I went wrong using this approach. Also I skipped some intermediate steps here in this question so please rectify me at what step I went wrong and suggest the correct substitution.
P.S. I am new to LaTeX so I tried my best to format but there might be errors so please edit if required.