First and second derivative of a summation

$f'(\mu) = -2\sum_{i = 1}^{n} (x_i - \mu)$ and $f''(\mu)=2n$


$$\frac{d}{d \mu} f(\mu) = -2 \sum_{i=1}^n (x_i - \mu) = -2 \sum_{i=1}^n x_i + 2 n \mu $$

$$\frac{d^2}{d \mu^2} f(\mu) = 2 n $$


Adding an answer here to further clarify the other ones which are simply answers without steps. To get the first derivative, this can be re-written as:

$$\frac{d}{d\mu}\sum(x-\mu)^{2} \\ = \sum\frac{d}{d\mu}(x-\mu)^{2} $$

After that it's standard fare chain rule

$$ = \sum-1 \cdot 2(x-\mu) \\ = -2\sum(x-\mu) $$

Second derivative: you can observe the same property of linear summation: $$ \frac{d}{d\mu}-2\sum(x-\mu) \\ =-2\sum\frac{d}{d\mu}(x-\mu) \\ =-2\sum(-1) \\ =2n $$