[tex]\tan^2x=\dfrac{\sin^2x}{\cos^2x}[/tex]
[tex]\tan^2x=\dfrac{\frac{1-\cos2x}2}{\frac{1+\cos2x}2}[/tex]
[tex]\tan^2x=\dfrac{1-\cos2x}{1+\cos2x}[/tex]
[tex]\tan x=\pm\sqrt{\dfrac{1-\cos2x}{1+\cos2x}}[/tex]
When [tex]\dfrac\pi2<x<\pi[/tex], you have [tex]\tan x<0[/tex], so for [tex]x=\dfrac{7\pi}8[/tex] you would take the negative root. Now,
[tex]\tan\dfrac{7\pi}8=-\sqrt{\dfrac{1-\cos\frac{7\pi}4}{1+\cos\frac{7\pi}4}}[/tex]
[tex]\tan\dfrac{7\pi}8=-\sqrt{\dfrac{1-\frac1{\sqrt2}}{1+\frac1{\sqrt2}}}[/tex]
[tex]\tan\dfrac{7\pi}8=-\sqrt{3-2\sqrt2}[/tex]