I was calculating the antiderivative of the function $\frac{1}{\sqrt{2ax-x^2}}$. I got two different answers in two different ways.
First way: $$\int \frac{dx}{\sqrt{2ax-x^2}}=\int \frac{dx}{\sqrt x\cdot\sqrt{2a-x}}=2\int \frac{\frac{1}{2\sqrt x}dx}{\sqrt{2a-(\sqrt x)^2}}=\int \frac{d(\sqrt x)}{\sqrt{(\sqrt {2a})^2-(\sqrt x)^2}}=2\sin^{-1}\sqrt{\frac{x}{2a}}+c$$
Second way: $$\int \frac{dx}{\sqrt{2ax-x^2}}=\int \frac{dx}{\sqrt{a^2-(x-a)^2}}=\int \frac{d(x-a)}{\sqrt{a^2-(x-a)^2}}=\sin^{-1}\frac{x-a}{a}+c$$
It seems that $2\sin^{-1}\sqrt{\frac{x}{2a}}$ and $\sin^{-1}\frac{x-a}{a}$ are unequal. So I think one of my methods is wrong. But I've checked and found nothing wrong. So what is happening here? And if both of my methods are correct, how to show that these two expressions are equal?
You can take the sine or cosine of both expressions, if you account for a $\pi/2$ shift (the integration constants are different).
For the first part, $$\cos\left(2\sin^{-1}\sqrt\frac{x}{2a}\right)=1-2\sin^2\left(\sin^{-1}\sqrt\frac{x}{2a}\right)=1-2\frac x{2a}=1-\frac xa$$
For the second one, you need to shift by $\pi/2$, $$\cos\left(\sin^{-1}\frac{x-a}a+\frac\pi2\right)=-\sin\left(\sin^{-1}\frac{x-a}a\right)=1-\frac xa$$
You can see this in