Are the following two derivations correct?
$$ \nabla_{\mathbf{w}}\mathbf{w}^T\mathbf{w} = 2 \mathbf{w} $$
$$ \nabla_{\mathbf{w}} ||\mathbf{y}-\mathbf{X}\mathbf{w}||_2^2 = 2\mathbf{X}^T(\mathbf{y}-\mathbf{X}\mathbf{w}) $$
(I assume that $\mathbf{y}$ and $\mathbf{X}$ are not functions of $\mathbf{w}$)
What are the rules involed to solve these problems?