# Completing the squares for matrices question

How does one go from

$e^{(-\frac{1}{2\sigma_n^2}(\vec{y} - X^T\vec{w})^T(\vec{y}-X^T\vec{w}))}e^{-\frac{1}{2}\vec{w}\Sigma^{-1}\vec{w}}$

to

$e^{-\frac{1}{2}(\vec{w}- w')^T(\frac{1}{\sigma^2_n}XX^T + \Sigma^{-1})(\vec{w} - w')}$

where $w' = \sigma_n^{-2}(\sigma_n^{-2}XX^T + \Sigma^{-1})^{-1}$

I'm sure the algebra works out upon expansion, but how do you come up with this?

-