I've been struggling to understand how the L2 norm decomposition of the error in PCA: $\|\vec x_i - \langle\vec x_i, \vec w\rangle \vec w\|$ results in $\|\vec x_i\|^2 - \langle\vec w, \vec x_i\rangle^2$, note that $\vec w^{\mathsf{T}} \vec w = 1$
Is my approach of foiling out the norm as follows valid:
$(\vec x_i - \langle\vec x_i, \vec w\rangle \vec w) ^{\mathsf{T}} (\vec x_i - \langle\vec x_i, \vec w\rangle \vec w) $
$ \|\vec x_i\|^2 - 2\vec x_i^{\mathsf{T}}(\langle\vec x_i, \vec w\rangle \vec w) + \langle\vec x_i, \vec w\rangle^2 \|\vec w\|^2$
$ \|\vec x_i\|^2 - 2\vec x_i^{\mathsf{T}}(\langle\vec x_i, \vec w\rangle \vec w) + \langle\vec x_i, \vec w\rangle^2 $
This is where I get stuck and don't know how to proceed. Any pointers would be greatly appreciated. Thanks!
Note $<x_i, w>$ is a scalar, which you can move to the front in the middle term. Then $$<x_i, w>x_i^Tw=<x_i,w><x_i,w>=<x_i,w>^2$$ So you multiply this by $-2$ and add it to the last term. If you notice that $<x_i,w>=<w,x_i>$, you get the desired expression.