If
$C = \frac{1}{2}(y - a)^2$
where $y$ is a given value, $a = \sigma(z)$, and $z = wx + b$.
Then the partial derivative of $C$ with respect to w should be: $\frac{\partial C}{\partial w} = (y-a)\sigma'(z)$
However, Michael Nielsen wrote this in his book Neural Networks and Deep Learning: $\frac{\partial C}{\partial w} = (y-a)\sigma'(z)x$
Why could he change the signs of $a$ and $y$ in the right side of the partial derivative expression?
Thanks in advance.
The one written by Michael Nielsen is correct. There is a minus sign in front of $a$ in $C = \frac{1}{2}(y-a)^{2}$, so from the chain rule we must remember to multiply by $-1$ when computing the derivative, i.e. $\frac{\partial C}{\partial w} = (y-a) \times (-1)\times \frac{\partial a}{\partial w}$.