Prove $4\sin^{2}\frac{\pi}{9}-2\sqrt{3}\sin\frac{\pi}{9}+1=\frac{1}{4}\sec^{2}\frac{\pi}{9}$. While attempting to algebraically solve a trigonometry problem in (Question 3535106), I came across the interesting equation

$$
4\sin^{2}\frac{\pi}{9}-2\sqrt{3}\sin\frac{\pi}{9}+1=\frac{1}{4}\sec^{2}\frac{\pi}{9}
$$

which arose from the deduction that $\frac{1}{4}\sqrt{\frac{256\sin^{4}40^{\circ}-80\sin^{2}40^{\circ}+12-\ 8\sqrt{3}\sin40^{\circ}}{\left(16\sin^{4}40^{\circ}-4\sin^{2}40^{\circ}+1\right)}}=\cos50^{\circ}$. Despite the apparent simplicity of the relationship, it seems quite tricky to prove. I managed to prove it by solving the equation as a quadratic in $(\sin\frac{\pi}{9})$ and then using the identity $\sqrt{\sec^2 x-1}=|\tan x|$, the double angle formulae and finally that $\frac{\sqrt{3}}{2}\cos x-\frac{1}{2}\sin x$ can be written in the form $\sin\left(x+\frac{2\pi}{3}\right)$.
But it seems like quite a neat problem. So, does anyone have a better way of proving it?
 A: Evaluate
$$
\begin{aligned}
4\cos ^2\frac{π}{9}&\left( LHS-RHS \right) \\
= \ &16\sin ^2\frac{π}{9}\cos ^2\frac{π}{9}-8\sqrt{3}\sin \frac{π}{9}\cos ^2\frac{π}{9}+4\cos ^2\frac{π}{9}-1\\
=\ &4\sin ^2\frac{2π}{9}-4\sqrt{3}\sin \frac{2π}{9}\cos \frac{π}{9}+2\left( 1+\cos \frac{2π}{9} \right) -1 \\
= \ &2\left( 1-\cos \frac{4π}{9} \right) -2\sqrt{3}\left( \frac{\sqrt3}2+\sin \frac{π}{9} \right) +2\cos \frac{2π}{9}+1\\
= \ &2\cos \frac{2π}{9}-2\cos \frac{4π}{9}-2\sqrt{3}\sin \frac{π}{9}\\
= \ &4\sin \frac{π}{3}\sin \frac{π}{9}-2\sqrt{3}\sin \frac{π}{9}=0
\end{aligned}
$$
where $\sin\fracπ3 = \frac{\sqrt3}2$ is used.
A: Using
$$\sin \frac{\pi}{3}=\frac{\sqrt 3}{2},~\cos \frac{\pi}{3}=\frac{1}{2},~\sec \frac{\pi}{3}=\frac{1}{\cos \frac{\pi}{3}}=2$$
see this.
and the triple angle forumla for $\sec$
$$2=\frac{\sec^3\frac{\pi}{9}}{4-3\sec^2\frac{\pi}{9}}=\frac{\sec\frac{\pi}{9}}{4\cos^2\frac{\pi}{9}-3}$$
$$\Leftrightarrow 2\left(4\cos^2\frac{\pi}{9}-3\right) = \sec\frac{\pi}{9}$$
squaring both sides and dividing by $4$
$$\Leftrightarrow \left(4\cos^2\frac{\pi}{9}-3\right)^2 = \\ 1-8\sin^2\frac{\pi}{9}+16\sin^4\frac{\pi}{9} = \frac{1}{4}\sec^2\frac{\pi}{9}$$
then using the triple angle formula for $\sin$
$$1-8\sin^2\frac{\pi}{9}+4\sin\frac{\pi}{9}\left(3\sin\frac{\pi}{9}-\sin\frac{\pi}{3}\right) = \\ 4\sin^2\frac{\pi}{9}-4\sin\frac{\pi}{3}\sin\frac{\pi}{9}+1 = \frac{1}{4}\sec^2\frac{\pi}{9}$$
$$\Leftrightarrow 4\sin^2\frac{\pi}{9}-2\sqrt 3\sin\frac{\pi}{9}+1 = \frac{1}{4}\sec^2\frac{\pi}{9}$$
A: We need to prove that:
$$4\sin^220^{\circ}-4\sin60^{\circ}\sin20^{\circ}+1=\frac{1}{4\cos^220^{\circ}}$$ or
$$4\sin^240^{\circ}-8\sin60^{\circ}\sin40^{\circ}\cos20^{\circ}+4\cos^220^{\circ}=1$$ or
$$2-2\cos80^{\circ}-4\sin60^{\circ}(\sin60^{\circ}+\sin20^{\circ})+2+2\cos40^{\circ}=1$$ or
$$\cos40^{\circ}-\cos80^{\circ}-2\sin60^{\circ}\sin20^{\circ}=0,$$ which is obvious.
A: Let $s=\sin 20° \quad → \sin (3×20°) = \frac{\sqrt{3}}{2} = 3s-4s^3$
Let $c=\cos 20° \quad → \cos (3×20°) = \frac{1}{2} = -3c+4c^3$
$LHS = 4s^2 - 2\sqrt{3}\,s + 1 = 4s^2 - 4s\,(3s-4s^3) + 1 = (1-4s^2)^2$
$\displaystyle RHS = \left(\frac{1}{2c}\right)^2 = \left(-3+4c^2\right)^2 = (1-4s^2)^2$
