# Derivative of the elliptic integral of the first kind

The complete elliptic integral of the first kind is defined as $$K(k)=\int_0^{\pi/2} \frac{dx}{\sqrt{1-k^2\sin^2{x}}}$$ and the complete elliptic integral of the second kind is defined as $$E(k)=\int_0^{\pi/2}\sqrt{1-k^2\sin^2{x}}~dx$$ for $0\leq k<1$.

I'm supposed to prove the following relation $$K'(k)=\frac{E(k)}{k(1-k^2)}-\frac{K(k)}{k}.$$

What I tried so far

Without much thought about the exchange of integration and differentiation I tried to compute \begin{align}K'(k)&=\int_0^{\pi/2} \frac{k\sin^2{x}}{(1-k^2\sin^2{x})^{3/2}}dx=-\frac{1}{k}\int_0^{\pi/2}\left(\frac{1-k^2\sin^2{x}}{(1-k^2\sin^2{x})^{3/2}}-\frac{1}{(1-k^2\sin^2{x})^{3/2}}\right)dx\\ &=-\frac{K(k)}{k}+\frac{1}{k}\int_0^{\pi/2}\frac{1}{(1-k^2\sin^2{x})^{3/2}} dx.\end{align} Comparing this with the result I'm supposed to obtain it would remain to show $$\int_0^{\pi/2}\frac{1}{(1-k^2\sin^2{x})^{3/2}} dx=\int_0^{\pi/2}\frac{\sqrt{1-k^2\sin^2{x}}}{1-k^2}dx.$$ Some numerical computations suggest that this identity is correct but I have know idea how to show it. Any hints or solutions would be appreciated!

Let us make the change of variables $t=\sin^2x$, $\displaystyle dx=\frac{dt}{2\sqrt{t(1-t)}}$ so that \begin{align} &K(k)=\frac12\int_0^{1}\frac{dt}{\sqrt{t(1-t)(1-k^2 t)}},\tag{1}\\ &E(k)=\frac12\int_0^{1}\sqrt{\frac{1-k^2t}{t(1-t)}}\,dt=\frac12\int_0^{1}\frac{(1-k^2t)dt}{\sqrt{t(1-t)(1-k^2 t)}}\,dt.\tag{2} \end{align} Then, using (1) and (2), we deduce that \begin{align} &k(1-k^2)K'(k)-E(k)+(1-k^2)K(k)=\\ &=\frac12\int_0^1\frac{k^2(1-k^2)t\,dt}{(1-k^2t)\sqrt{t(1-t)(1-k^2 t)}}-\frac12\int_0^1\frac{k^2(1-t)dt}{\sqrt{t(1-t)(1-k^2 t)}}=\\ &=-k^2\int_0^{1}\frac{d}{dt}\left(\sqrt{\frac{t(1-t)}{1-k^2t}}\,\right)dt=\\ &=0. \end{align} At the last step we integrated the derivative of a function vanishing at the endpoints.
P.S. If instead you would like to show your last identity, the idea remains the same: use that $$\frac{1}{(1-k^2\sin^2x)^{3/2}}-\frac{(1-k^2\sin^2x)^{1/2}}{1-k^2}=-\frac{k^2}{1-k^2} \frac{d}{dx}\left(\frac{\sin x\cos x}{\sqrt{1-k^2\sin^2x}}\right).$$