On continuity of an improper integral I am stuck in the middle of a problem which requires to prove that the following function defined on $[0,1]$ is continuous at $x = 1^-$.
For $0\leq x \leq 1 $, define:
$$ R(x) = \int\limits_0^1 \left(\frac{2}{\sqrt{1-xt^2}\sqrt{1-t^2}}-\frac{x}{1-xt}\right)dt.$$
Then show that $R(x)$ is continuous at $x=1^{-}$, that is
$$\lim\limits_{x\to 1^-}R(x) = R(1) = \int\limits_{0}^{1}\left(\frac{2}{1-t^2}-\frac{1}{1-t}\right) = \int\limits_{0}^{1} \frac{dt}{1+t} = \ln 2.$$
My all attempts till now were futile. My most rigorous attempt was to first consider
$$R(x) - R(1) = \int\limits_{0}^{1} \left(\frac{2}{\sqrt{1-xt^2}\sqrt{1-t^2}}-\frac{x}{1-xt} - \frac{1}{1+t} \right)dt = \int\limits_{0}^{1} \left(\frac{2}{\sqrt{1-xt^2}\sqrt{1-t^2}}-\frac{(1+x)\sqrt{1-t}}{(1-xt)\sqrt{1+t}\sqrt{1-t2}} \right)dt,$$
and then try to express the function inside the integral as product of two functions $g(t) F(x,t)$, such that $\int\limits_{0}^{1} g(t)dt$ converges and $F(x,t)$ is continuous on $[0,1] \times [0,1]$. I chose
$$g(t) = \frac{1}{\sqrt[4]{(1-xt)^3}}$$
and
$$F(x,t) = \frac{2\sqrt[4]{1-t^2}}{\sqrt{1-xt^2}} - \frac{(1+x)\sqrt[4]{1-t^2}\sqrt{1-t}}{(1-xt)\sqrt{1+t}}.$$
Unfortunately the above $F(x,t)$ is not continuous at $(1,1)$. For whatever $F(x,t)$ and $g(t)$ I am choosing, I am failing either to show that $F(x,t)$ is continuous or $g(t)$ converges.
The main result I am aiming at is:
$$ 2K(\sqrt{x}) \sim -\log(1-x) + C,$$
for some constant $C$. And $K(x)$ is the elliptic integral of first kind.
Any help is highly appreciated.
 A: As @Maxim mentioned in the comment, $R(x)$ is not continuous from the left. The problem is that $\frac{x}{1-xt}$ is not a good approximation for $\frac{2}{\sqrt{1-xt^2}\sqrt{1-t^2}}$ at $x\to 1$. It "catches" only the singular term ($\sim\log(1-x)$), the integral does not converge uniformly, and taking the limit under the integral sign is not justified.
Let's consider $R(x)=I_1(x)-I_2(x)$, where
$$I_1(x)=\int_0^1\frac{2}{\sqrt{1-x^2t^2}\sqrt{1-t^2}}dx$$
$$I_2(x)=\int_0^1\frac{x^2}{1-x^2t^2}dt$$
(for the convenience I took $x^2$ instead of $x$).
Making the change $ t=\frac{1}{s} $ in the first integral gives
$$ I_1(x)=2\int_1^\infty\frac{ds}{\sqrt{s^2-1}\sqrt{s^2-x^2}}$$
$$=(s-1=t; 1-x=\epsilon) \,\,\,\,\,2\int_0^\infty\frac{dt}{\sqrt t\sqrt{t+2}\sqrt{t+\epsilon}\sqrt{2+t+\epsilon}}$$
$$=(s=\sqrt t)\,\,\,\,4\int_0^\infty\frac{ds}{\sqrt{2+s^2}\sqrt{s^2+\epsilon}\,\sqrt{2+s^2+\epsilon}}$$
Noting that $\frac{d}{ds}\ln(s+\sqrt{s^2+\epsilon})=\frac{1}{\sqrt{s^2+\epsilon}}\,$ and integrating by part
$$I_1(\epsilon)=4\frac{\ln(s+\sqrt{s^2+\epsilon})}{\sqrt{2+s^2}\sqrt{2+s^2+\epsilon}}\Big|_0^\infty$$
$$+\,4\int_0^\infty\ln(s+\sqrt{s^2+\epsilon})\Big(\frac{1}{(2+s^2)^{3/2}\sqrt{2+s^2+\epsilon}}+\frac{1}{\sqrt{2+s^2}(2+s^2+\epsilon)^{3/2}}\Big)sds$$
The last two terms converge at $\epsilon=0$, so first asymptotics terms (at $\epsilon\to 0$) are
$$I_1(\epsilon)=-4\frac{\ln\sqrt\epsilon}{\sqrt2\sqrt{2+\epsilon}}+8\int_0^\infty\frac{\ln(2s)\,s}{(2+s^2)^2}ds+O(\epsilon\ln\epsilon)$$
$$=-\ln\epsilon+4\ln2\int_0^\infty\frac{dx}{(2+x)^2}+2\int_0^\infty\frac{\ln x \,dx}{(2+x)^2}+O(\epsilon\ln\epsilon)$$
$$I_1(\epsilon)=-\ln\epsilon+3\ln2+O(\epsilon\ln\epsilon)$$
(Basically, this way any asymptotics terms for $K(x)$ can be obtained).
$$I_2(\epsilon)=\int_0^1\frac{x^2}{1-x^2t^2}dt=-\ln(1-x^2t^2)\Big|_0^1=-\ln\epsilon-\ln2$$
$$\lim_{\epsilon\to 0}\Big(I_1(\epsilon)-I_2(\epsilon)\Big)=4\ln2 , \,\,\text{as @Maxim pointed out}$$
A: As pointed out by other users, the function $R(x)$ is not continuous at $x = 1$:

Here, we will try to compute the limit of $R(x)$ as $x \to 1^-$, which I guess is the original intention of the problem. This amounts to computing
$$ \lim_{\varepsilon \to 0^+} R(1 - \varepsilon). $$
Applying he substitution $t=\frac{s}{s+2\varepsilon}$ to the first integral comprising $R(1-\varepsilon)$ and then computing the second integral directly, we get
\begin{align*}
R(1-\varepsilon)
&= \int_{0}^{\infty} \frac{1}{\sqrt{(s+\varepsilon)(s + \varepsilon + s^2/4)}} \, \mathrm{d}s + \log \varepsilon \\
&= \int_{0}^{\infty} \biggl( \frac{1}{\sqrt{(s+\varepsilon)(s + \varepsilon + s^2/4)}} - \frac{1}{s+\varepsilon}\mathbf{1}_{[0, 1]}(s) \biggr) \, \mathrm{d}s + \underbrace{\int_{0}^{1} \frac{\mathrm{d}s}{s+\varepsilon} + \log \varepsilon}_{=\log(1+\varepsilon)}.
\end{align*}
Writing $f_{\varepsilon}(s)$ for the integrand of the last integral, we obtain the following bounds for $f_{\varepsilon}$:
$$ \left| f_{\varepsilon}(s)  \right|
= \begin{cases}
\frac{s^2}{2(s+\varepsilon)\sqrt{s+\varepsilon+s^2/4}\left( \sqrt{s+\varepsilon+s^2/4} + \sqrt{s+\varepsilon} \right) }
\leq \frac{1}{2\sqrt{1+s/4}\left( \sqrt{1+s/4} + 1 \right) }, & s \leq 1 \\
\frac{1}{\sqrt{(s+\varepsilon)(s + \varepsilon + s^2/4)}} \leq \frac{1}{s\sqrt{1+s/4}}, & s > 1.
\end{cases} $$
This tells that $f_{\varepsilon}(s)$ is dominated by an integrable function, and so, letting $\varepsilon \to 0^+$ gives
\begin{align*}
\lim_{\varepsilon \to 0^+} R(1-\varepsilon)
&= \int_{0}^{\infty} \biggl( \frac{1}{s\sqrt{1 + s/4}} - \frac{1}{s}\mathbf{1}_{[0, 1]}(s) \biggr) \, \mathrm{d}s \\
&= \left[ \log\left(\frac{\sqrt{s+4} - 2}{\sqrt{s+4} + 2}\right) - \log\min\{s,1\} \right]_{0^+}^{\infty} \\
&= 4\log 2.
\end{align*}
