If $\frac{3-\tan^2\frac\pi7}{1-\tan^2\frac\pi7}=k\cos\frac\pi7$, find $k$ I need help solving this question:
$$
\text{If }\frac{3-\tan^2\frac\pi7}{1-\tan^2\frac\pi7}=k\cos\frac\pi7\text{, find k.}
$$
I simplified this down to:
$$
\frac{4\cos^2\frac\pi7-1}{2\cos^2\frac\pi7-1}
$$
But am unable to proceed further. The value of k is given to be 4, but I am unable to derive that result.
Kindly provide me with some insight, or with a step-by-step solution.
Thanks in advance,
Abhigyan

$$k\cos y=\dfrac{3-\tan^2y}{1-\tan^2y}=\dfrac{3\cos^2y-\sin^2y}{\cos^2y-\sin^2y}=\dfrac{4\cos^2y-1}{2\cos^2y-1}$$
$$\iff2k\cos^3y-4\cos^2y-k\cos y+1=0\  \ \ \ (1)$$
Now if $7y=(2n+1)\pi,$
$\cos4y=\cdots=-\cos3y$
Using $\cos2A=2\cos^2A-1,\cos3B=4\cos^3B-3\cos B$
The roots of $$8\cos^4y+4\cos^3y-8\cos^2y-3\cos y+1=0$$ are $$\cos\dfrac{(2n+1)\pi}7$$ where $n\equiv0,\pm1,\pm2,\pm3\pmod7$
As for $n=3,\cos\dfrac{(2n+1)\pi}7=-1,$ the roots of $$0=\dfrac{8\cos^4y+4\cos^3y-8\cos^2y-3\cos y+1}{\cos y+1}$$
$$\iff8\cos^3y-4\cos^2y-4\cos y+1=0\  \ \ \ (2)$$ will be $$\cos\dfrac{(2n+1)\pi}7$$ where $n\equiv0,\pm1,\pm2,3\pmod7$
Compare $(1),(2)$
