I tend to forget some of the trigonometric functions and someone showed me how to derive the double angle identities from what I think is Euler's formula:

=

=

I have a question about this step...I understand how the '2' from the e^(i2x) was pulled out, but is it okay to pull the '2' out from the '2x' of the trigonometric functions and to square the right hand expression? How does that work?