Gain function calculation (frequency response) Define moving average process $y_t := 0.5 x_t + 0.5 x_{t-1}$ where $x_t := e^{i2 \pi t}$. Its frequency response is then:

$$H(f) = 0.5 + 0.5 e^{-i2\pi f}$$

Recall that the frequency response in polar notation is:

$$H(f) = G(f)e^{i \theta}$$

where $G(f)$ is the gain function. We then have that:

$$ H(f) = 0.5 \big( e^{-i \pi f} + e^{i \pi f} \big)e^{-i \pi f}$$.

QUESTION: Can someone please explain why the last step is true? An explanation with some detail is much appreciated (I am new to signal analysis).
One way to see the equivalence is to first factor out the $0.5$ in your initial transfer function, i.e. 

$$
H(f) = 0.5(1 + e^{-i2\pi f}).
$$

Then you can rewrite the $1$ and $e^{-i2\pi f}$ as follows:

$$
H(f) = 0.5(e^{i\pi f}e^{-i\pi f} + e^{-i\pi f}e^{-i\pi f}) = 0.5(e^{i\pi f} + e^{-i\pi f})e^{-i\pi f}.
$$

Your result then follows as a trivial transform.