# Why doesn't substitution using $2\sin^2x$ work?

I was solving the integral $$\int\sqrt{2x-x^2}\,\mathrm dx$$. I divided it as $$\int\sqrt{x}\sqrt{2-x}\,\mathrm dx$$ and used the substitution for $$x=2\sin^2t$$ and $$\mathrm dx=4\sin t\cos t\,\mathrm{d}t$$

The result I found was $$\arcsin\left(\sqrt{\frac{x}{2}}\right)-\frac{\sqrt{2x-x^2}}{2}({1-x})+C$$

However, on an online calculator I saw the result was $$\frac{(x-1)\sqrt{2x-x^2}+\arcsin(x-1)}{2}+C$$ Apparently it used the substitution with $$u=1-x$$ respectively $$u =\sin t$$ and rewriting the integral as $$\int \cos^2t\,\mathrm dt$$ it found the solution for $$t$$ and switched the substituted elements.

I understood the solution given there but why my solution gave a different result than that? I had a similar problem in another question as well. And the only difference is with $$\arcsin$$, I thought it was because I substituted with $$2\sin^2x$$ which is a power of a trigonometric function but I don't understand why that would be a problem. Is it actually related to that, or is there another reason why it didn't work?

The answer is that both solutions are valid: $$\frac12\arcsin(x-1)$$ and $$\arcsin\left(\sqrt{\frac x2}\right)$$ differ by a constant.
To see why this is true, suppose that $$\theta = \arcsin\left(\sqrt{\frac x2}\right).$$ Then $$\frac x2 = \sin^2\theta = \frac{1-\cos(2\theta)}2.$$ So $$\cos(2\theta) = 1-x$$. But $$\cos(2\theta) = -\sin(2\theta-\frac\pi2)$$, so $$\theta = \frac12\arcsin(x-1)+\frac\pi4.$$