As the title states, I want to find the derivative of
$$\frac{1}{N}\sum_i (x_i - \mu)^2$$ w.r.t $x_i$ (note that $\mu$ is also another function of $x_i$, of course). I've tried solving it and got the following result
$$\frac{2(N - 1)}{N^2}\sum_i (x_i - \mu)$$
Is this right? Am I doing something wrong?