I'm currently reading through a document about the ellipse. I've attached the provided image and working out.

From here, it is easy enough to show that $|OP|\sin\gamma=|FP|\sin\alpha$ using say the Sine Rule.
However, they follow through with

I understand how they got the first two lines using the polar equation of the ellipse (with respect to the focus) $r=FP=\frac{a(1-e^2)}{1+e\cos\theta}$.
Where I have issue is with the "Summing the squares". I cannot see how they managed to get rid of all the $\alpha$ and have everything in terms of $\gamma$.
Is there some sort of identity that I am missing?