Let $\mu,u,x\in \mathbb{R}^m, z\in \mathbb{R}$
$$\frac{\partial}{\partial z}\|\mu + zu-x\|^2 = 2\langle \mu+zu-x,u\rangle$$
Why?
I can see that
$$\|\mu + zu-x\|^2 = (\mu + zu-x)(\mu + zu-x)$$
So (ignoring for a moment that we're dealing with vectors):
$\frac{\partial}{\partial z}\|\mu + zu-x\|^2$
$=u(\mu + zu-x) + (\mu + zu-x) u$
$= 2u(\mu + zu-x)$
So since we're dealing with vectors, let's interpret the multiplication as dot product ...
$= 2\langle u, \mu + zu-x \rangle$
et voilà (?)!
It's working out in this case ... but I'm really not sure about the methodology behind this. Is it customary to differentiate vector terms in such a way? Or if not, what would be the proper way to arrive at the solution?
Let $v=\mu-x$. Then
$f(z):=\|\mu + zu-x\|^2=\|v+ zu\|^2=||v||^2+2z<v,u>+z^2||u||^2$ and so
$f'(z)=2<v,u>+2z||u||^2$.
Your turn !