I've got:
$\frac{\partial}{\partial \textbf{w}} \bigg( \textbf{x}^T\textbf{w}\bigg)^2$
when taking the derivative, does this result in
$2 (\underbrace{\textbf{x} ~\textbf{x}^T}_{\Sigma_x}) \textbf{w}^T$
or in the dot product of the $\textbf{x}$s
$2 (\underbrace{\textbf{x}^T ~\textbf{x}}_{scalar}) \textbf{w}^T$
$$ \frac{\partial}{\partial \vec{w}}\left(\vec{x}^T \vec{w} \right)^2 = 2 (\vec{x}^T \vec{w})\frac{\partial}{\partial \vec{w}} (\vec{x}^T \vec{w}) =2 (\vec{x}^T \vec{w}) \vec{x}^T = 2 \vec{w}^T (\vec{x} \vec{x}^T) $$ So it is the second one you wrote down. If you are differentiating with respect to vectors, it is sometimes nicer to use indices, so in this case $x^i = \vec{x}$, $\vec{w}= w^i$, then: $$\frac{\partial}{\partial \vec{w}}\left(\vec{x}^T \vec{w} \right)^2 =\sum_{i} \frac{\partial}{\partial w^i}\left(\sum_j x^j w^j \right)^2 = \sum_i 2\left(\sum_j x^j w^j \right) \left(\sum_j x^j \underbrace{\frac{\partial w^j}{\partial w^i}}_{\delta_{ij}}\right) $$ $$ = \sum_i 2 \left(\sum_j x^j w^j \right) x^i = 2 \sum_i \sum_j x^j w^j x^i=2 \vec{w}^T (\vec{x} \vec{x}^T) $$ Which you can check is the same fairly easily.