TITLE: Show $\frac52\cot\frac{4\pi}7+\frac34\cot\frac\pi7\sec\frac{2\pi}7+\cot\frac{2\pi}7\cos\frac\pi7=\sqrt7$
QUESTION [9 upvotes]: While solving a definite integral in different ways, I found that the trigonometric expression involving the heptagonal angles below simply reduces to $\sqrt7$ $$\frac52\cot\frac{4\pi}7+\frac34\cot\frac\pi7\sec\frac{2\pi}7+\cot\frac{2\pi}7\cos\frac\pi7$$
I verified it numerically, but could not resist trying to do the same by hand.
Unlike the familiar ones, such as $4\sin\dfrac{2\pi}7-\tan \dfrac\pi7 =\sqrt7$, I have not come across any resembling patterns anywhere and would like to find a clean path to derive it analytically.

REPLY [3 votes]: Notice that
$$ \cos(\pi/7)=-\cos(6\pi/7)\quad \text{ and }
\quad\cot(\pi/7)=-\cot(6\pi/7). \tag{1}$$ Define
$$ x:=\frac{2\pi}7,\; y:=\frac52\cot\frac{4\pi}7+
\frac34\cot\frac\pi7\sec\frac{2\pi}7
+\cot\frac{2\pi}7\cos\frac\pi7,\; z:=e^{ix}. \tag{2}$$
Now $$ y = \frac52 \cot(2x)-\frac34 \cot(3x)\sec(x)
-\cot(x)\cos(3x). \tag{3}$$
Check that $\,y^2-7\,$ is a rational
function in $\,z\,$ with a factor of $\,\sum_{n=0}^6 z^n\,$
in the numerator, but this $=0$ since $\,z\,$ is a 7th root of unity thus
$\,y=\sqrt{7}.$ I used Mathematica to do the rational function
expansion but some other Computer Algebra System could be used instead.
My Mathematica code is
y = 5/2 Cot[2x] - 3/4 Cot[3x]Sec[x] - Cot[x]Cos[3x];
Factor[TrigToExp[y^2-7] /. x->Log[z]/I]