# Simplifying expression using Euler's formula

I'm trying to simplify this expression.

$$a + be^{-iw} + be^{-2iw} + ae^{-3iw} =$$

$$e^{-iw3/2} \cdot [2 a \cdot \cos(3w/2) + 2b\cdot \cos(w/2) ]$$

How do I go from the left hand side of the equation to the right hand side? I realize that I'm supposed to use Euler's formula, what I don't really get is how.

The exponents go from $-0iw$ to $-3iw$, so take the middle point $-3iw/2$, getting $$e^{-3iw/2}\cdot[ae^{+3iw/2}+be^{iw/2}+be^{-iw/2}+ae^{-3iw/2}]=\\ e^{-3iw/2}\cdot\left[2a\frac{e^{+3iw/2}+e^{-3iw/2}}{2}+2b\frac{e^{iw/2}+e^{-iw/2}}{2}\right]$$