# How to prove $\lim_{n \to \infty}\frac{\pi}{2n+1}\sum_{k=1}^{n}(-1)^{k+1}\cot\frac{k\pi}{2n+1}=\ln2$

I am trying to prove the following:

$$\lim_{n \to \infty}\frac{\pi}{2n+1}\sum_{k=1}^{n}(-1)^{k+1}\cot\frac{k\pi}{2n+1}=\ln2$$

I tried some values and it seems convincing.

I wonder if this is a new result. If not, any reference or related article/reading material? Thanks in advance.

I tried to link it to the following, but failed.

$$\lim_{n \to \infty}\sum_{k=1}^{n}\frac{1}{n}f\left(\frac{k}{n}\right)=\int_0^1 f(x) dx$$

AFTER THE SOLUTION OBTAINED, THE FOLLOWING CAN BE PROVED AS WELL.

$$\lim_{n \to \infty}\frac{\pi}{2n}\sum_{k=1}^{n-1}(-1)^{k+1}\cot\frac{k\pi}{2n}=\ln2$$

>

I think we only use $$\cot{x}=\dfrac{1}{x}+o(1/x),x\to 0$$ so $$\cot{\dfrac{k\pi}{2n+1}}\approx \dfrac{2n+1}{k\pi},n\to \infty$$ so $$\lim_{n\to\infty}\dfrac{\pi}{2n+1}\sum_{k=1}^{n}(-1)^{k+1}\cot{\left(\dfrac{k\pi}{2n+1}\right)}=\lim_{n\to\infty}\sum_{k=1}^{n}(-1)^{k+1}\dfrac{1}{k}$$ and note $$\sum_{k=1}^{\infty}(-1)^{k+1}\dfrac{1}{k}=\ln{(1+x)}|_{x=1}= \ln{2}$$