Complex trig function example. If $\cos z=5$, why does $e^{2iz}-10e^{iz}+1=0$? The example in my book says this:

equation 1 is:
$$\cos{z} = \frac{1}{2} ( e^{iz} + e^{-iz} )$$
Where is $e^{2iz} - 10e^{iz} + 1 = 0 $ coming from? Can someone show me how they are doing this solution?

$\frac12(e^{iz}+\frac1{e^{iz}})=5\implies e^{2iz}-10e^{iz}+1=0.$
