Approximate $\int_0^{\pi /2} \frac{ds}{\sqrt{1-x\sin^2s}}$ I am trying to approximate the following integral 
$$K(x)=\int\limits_0^{\pi /2} \frac{ds}{\sqrt{1-x\sin^2s}}$$
with $0<x<1$.
I need to show that for x close to one that $K(x)\sim -\frac{1}{2}\ln(1-x)$.
My first attempt was to Taylor expand the function $f(x)= (1-x\sin^2s)^{-1/2}$ about $x=1$. I did this using $f(x)\approx f(1)+f'(1)(x-1)$. I integrated the result and found that $K(x)\sim \left[\frac{5-x}{4}\ln|\sec s + \tan s|\right]_0^{\pi/2} - \left[\frac{1-x}{4}\sec s \tan s \right]_0^{\pi/2}$, which goes to infinity when $s=\pi/2$. 
I can't think of another way to approach this, so any advice would be helpful. 

The integral as written is the 
complete elliptic integral of the first kind and it can be expressed in term of hypergeometric function:
$$K(x) = \frac{\pi}{2}\,_2F_1(\frac12,\frac12;1;x)\tag{*1}$$
We know when $\gamma = \alpha + \beta$, $\alpha$ and $\beta \ne 0, -1, -2, \ldots$, $|\arg(1-x)| < \pi$, $|1-x| < 1$, the hypergeometric function has following 
expansion near $x = 1$:
$$\begin{align}
\,_2F_1(\alpha,\beta;\gamma;x) = 
& \frac{-\Gamma(\gamma)}{\Gamma(\alpha)\Gamma(\beta)}
\sum_{n=0}^{\infty}\frac{(\alpha)_n(\beta)_n}{n!^2}(1-x)^n \times\\
& \left\{
\psi(\alpha+n)+\psi(\beta+n) -2\psi(1+n) + \log(1-x)
\right\}
\end{align}$$
where $(t)_n$ is the rising Pochhammer symbol and $\psi(t)$ is the 
digamma function.
Substitute this back into $(*1)$ for $x$ near $1$, we have up to $O((1-x)\log(1-x))$,
$$K(x) \sim -\frac12 \left\{ 2\psi(\frac{1}{2}) - 2\psi(1) + \log(1-x)\right\}
          = \log 4 - \frac12\log(1-x)$$
Actually, we can derive this leading term by elementary means.
Let $\delta = \sqrt{\frac{1-x}{x}}$, $u = \cos s = \delta \sinh\theta$, we have
$$\begin{align}
K(x) 
= & \frac{1}{\sqrt{x}}\int_0^{\frac{\pi}{2}} \frac{ds}{\sqrt{\delta^2 + \cos^2\!s}}\\
= & \frac{1}{\sqrt{x}}\int_0^1 \frac{du}{\sqrt{\delta^2 + u^2}\sqrt{1-u^2}}\\
= & \frac{1}{\sqrt{x}}\left\{
\int_0^1  \frac{du}{\sqrt{\delta^2 + u^2}} + 
\int_0^1 \frac{1-\sqrt{1-u^2}}{\sqrt{\delta^2+u^2}} \frac{du}{\sqrt{1 - u^2}}
\right\}\\
= & \frac{1}{\sqrt{x}}\left\{
\int_0^1 \frac{du}{\sqrt{\delta^2 + u^2}} +
\int_0^{\frac{\pi}{2}}\frac{1-\sin s}{\sqrt{\delta^2 + \cos^2\!s}} ds
\right\}\\
= & \frac{1}{\sqrt{x}}\left\{
\int_0^{\sinh^{-1}\frac{1}{\delta}} d\theta +
\int_0^{\frac{\pi}{2}}\frac{1-\sin s}{\sqrt{\delta^2 + \cos^2\!s}} ds
\right\}\\
\end{align}$$
The $2^{nd}$ integral in the RHS has a finite limit as $\delta \to 0$. 
If we replace it by its limit, we will introduce an error that won't affect
our determination of the leading term. Up to $o(1)$$\color{blue}{^{[1]}}$, we find:
$$\begin{align}
K(x) 
\sim & \frac{1}{\sqrt{x}}\left\{\sinh^{-1}\frac{1}{\delta} + \int_0^{\frac{\pi}{2}}\frac{1-\sin s}{\cos s} ds
\right\}\\
= & \frac{1}{\sqrt{x}}\left\{ \log\left(\frac{1+\sqrt{1+\delta^2}}{\delta}\right) + \log 2\right\}\\
= & \frac{1}{\sqrt{x}}\left\{ \log\left(\frac{\sqrt{x}+1}{\sqrt{1-x}}\right) + \log 2\right\}\\
\sim & (1 + O(1-x))
\left\{\log\left(\frac{1 + O(1-x) + 1}{\sqrt{1-x}}\right) + \log 2\right\}\\
\sim & \log 4 - \frac12\log(1-x) + O((1-x)\log(1-x))
\end{align}$$
recovering the leading term as expected.
Notes


*

*$\color{blue}{[1]}$ A more careful analysis shows the error introduced in this step is of the order $O(\delta^2\log\delta) = O((1-x)\log(1-x))$.

