How to integrate $\sec^{-1}\sqrt\frac{x}{a-x}$ $\int\sec^{-1}\sqrt\frac{x}{a-x}dx$
How to solve the above integration? Please give me some hint about what substitution I should make.
Thanks in advance. 
 A: $$\int \:arcsec\left(\frac{\sqrt{x}}{\sqrt{a-x}}\right)dx$$
Put $u=\sqrt{x}$ so $\frac{du}{dx}=\frac{1}{2\sqrt{x}}$ so $dx=2\sqrt{x}du$
$$2\int \:u\:arcsec\left(\frac{u}{\sqrt{a-u^2}}\right)du$$
Integrate by parts
$∫fg′= fg−∫f′g$
NOTE-Ignore the factor of $2$ and continue with the integral, we will include in end
$$f=arcsec\left(\frac{u}{\sqrt{a-u^2}}\right)$$ and $g$′$=u$
$$f′=\frac{\sqrt{a-u^2}\left(\frac{1}{\sqrt{a-u^2}}+\frac{u^2}{\left(a-u^2\right)^{\frac{3}{2}}}\right)}{u\sqrt{\frac{u^2}{a-u^2}-1}}$$
$$g=\frac{u^2}{2\:}$$
$$=\frac{u^2\:arcsec\left(\frac{u}{\sqrt{a-u^2}}\right)}{2}-\int \:\frac{u\sqrt{a-u^2}\left(\frac{1}{\sqrt{a-u^2}}+\frac{u^2}{\left(a-u^2\right)^{\frac{3}{2}}}\right)}{2\sqrt{\frac{u^2}{a-u^2}-1}}du$$
Now consider the integral in second term only 
Put $v=u^2$ so $\frac{dv}{du}=2u$ and $du=\frac{1}{2u}dv$
$$\frac{a}{2}\int \:\frac{u}{\left(a-u^2\right)\sqrt{\frac{u^2}{a-u^2}-1}}du$$
$$\frac{a}{2}\int \frac{1}{\left(a-v\right)\sqrt{\frac{v}{a-v}-1}}dv$$
Put $w=\sqrt{\frac{v}{a-v}-1}$ so $\frac{dw}{\:dv}=\frac{\frac{a}{\left(a-v\right)^2}}{2\sqrt{\frac{v}{a-v}-1}}$ and $w^2+1=\frac{v}{a-v}$ 
$$\frac{a}{2}\int \:\frac{\left(a-v\right)}{a}dw$$
Put $w^2+2=\frac{a}{a-v}$
$$=\frac{a}{2}\int \:\frac{1}{w^2+2}dw$$
This is a standard integral
$\int \:\frac{1}{y^2+1}dy=arctan\left(y\right)$
$$\left(\frac{a}{2}\right)\frac{arctan\left(\frac{w}{\sqrt{2}}\right)}{\sqrt{2}}$$
Put back $w=\sqrt{\frac{v}{a-v}-1}$ and $v=u^2$
$$\frac{a\:arctan\left(\frac{\sqrt{\frac{u^2}{a-u^2}-1}}{\sqrt{2}}\right)}{2^{\frac{3}{2}}}$$
So combining this with the previously calculated first term
$$\frac{u^2\:arcsec\left(\frac{u}{\sqrt{a-u^2}}\right)}{2}-\frac{a\:arctan\left(\frac{\sqrt{\frac{u^2}{a-u^2}-1}}{\sqrt{2}}\right)}{2^{\frac{3}{2}}}$$
Put back $u=\sqrt{x}$ and multiply the missing factor of $2$ (See note)
So the final answer is
$$\:x\:arcsec\left(\frac{\sqrt{x}}{\sqrt{a-x}}\right)-\frac{a\:arctan\left(\frac{\sqrt{\frac{x}{a-x}-1}}{\sqrt{2}}\right)}{\sqrt{2}}+ C$$
A: \begin{align}
I&=\int\sec^{-1}\sqrt\frac{x}{a-x}\ dx,\quad \color{red}{\sqrt\frac{x}{a-x}=y}\\
&=\int\sec^{-1}(y)\frac{2ay}{(1+y^2)^2}\ dy\quad \color{red}{\text{apply IBP}}\\
&=-\frac{a\sec^{-1}(y)}{1+y^2}+a\int\frac{dy}{y(1+y^2)\sqrt{y^2-1}},\quad \color{red}{y=\sec\theta}\\
&=-\frac{a\sec^{-1}(y)}{1+y^2}+a\int\frac{d\theta}{1+\sec^2\theta},\quad \color{red}{y=\sec\theta}\\
\end{align}
Lets take care of the last integral:
\begin{align}
K&=\int\frac{d\theta}{1+\sec^2\theta}\\
&=\int\frac{1}{2+\tan^2\theta}\ d\theta, \quad\color{red}{1=\sec^2\theta-\tan^2\theta}\\
&=\int\frac{\sec^2\theta-\tan^2\theta}{2+\tan^2\theta}\ d\theta\\
&=\int\frac{\sec^2\theta}{2+\tan^2\theta}\ d\theta-\int\frac{\tan^2\theta\color{red}{+2-2}}{2+\tan^2\theta}\ d\theta\\
&=\frac1{\sqrt{2}}\tan^{-1}\left(\frac{\tan\theta}{\sqrt{2}}\right)-\int\left(1-\frac{2}{2+\tan^2\theta}\ d\theta\right)\\
&=\frac1{\sqrt{2}}\tan^{-1}\left(\frac{\tan\theta}{\sqrt{2}}\right)-\theta+2K\\
-K&=\frac1{\sqrt{2}}\tan^{-1}\left(\frac{\tan\theta}{\sqrt{2}}\right)-\theta\\
\end{align}
