<s>[INST] Integrate $\int{ \frac{r}{(h^2 + r^2 - 2^{1/2}hr)^{1/2}} dr }$ This integral comes from a physics book when calculating potential difference between vertex and center of cone. I'm not good at integration. Please help.
update:

This is the required answer.
The second integral is in ln form. I have reached there by using the required formula but equation inside ln is less by factor of $2$. What am i doing wrong?
Also how formula for ln is derived?
 [/INST] Let me write your integral as  $$ \int \frac{x}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx$$
Then first consider the change of variable  $u={x^2-\sqrt{2}ax+a^2} $, the  $du=(2x-\sqrt{2}a )dx$, thus the integral becomes: $$ \int \frac{x}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx = \frac{1}{2} \int \frac{2x-\sqrt{2}a+\sqrt{2}a}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx=$$ 
$$\frac{1}{2} \int \frac{2x-\sqrt{2}a}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx  + \frac{1}{2} \int \frac{\sqrt{2}a}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx  = $$
$$ \frac{1}{2} \int \frac{du}{\sqrt{u}} + \frac{a}{\sqrt{2}} \int \frac{1}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx  $$
The first integral is simply $\sqrt{u}$, again to the initial variable,  the first integral is  $\sqrt{x^2-\sqrt{2}ax+a^2}$.
Now, consider the second inetgral, and use complete square in the denomenator $$\int \frac{1}{\sqrt{x^2-\sqrt{2}ax+a^2}} =  \int \frac{dx}{\sqrt{x^2-\sqrt{2}ax+ \frac{a^2}{2}+\frac{a^2}{2}}}=  \int \frac{dx}{\sqrt{(x-\frac{a}{\sqrt{2}})^2+ \frac{a^2}{2}}}= \int \frac{dx}{\frac{a}{\sqrt{2}}\sqrt{\frac{2}{a^2}(x-\frac{a}{\sqrt{2}})^2+ 1}} =\frac{\sqrt{2}}{a}\int \frac{dx}{\sqrt{(\frac{\sqrt{2}}{a}x-1)^2+ 1}} $$
let $v= \frac{\sqrt{2}}{a}x-1$, then  $dv=\frac{\sqrt{2}}{a} dx $, and so this last integral can be written as  $$ \int \frac{dv}{\sqrt{v^2+1}}= arsinh(v) $$ thus your final integral is
$$ \int \frac{x}{\sqrt{x^2-\sqrt{2}ax+a^2}}dx=\sqrt{x^2-\sqrt{2}ax+a^2} +\frac{a}{\sqrt{2}} arcsinh\Big(\frac{\sqrt{2}}{a}x-1 \Big) +C$$
</s>