TITLE: Gradient of a summation
QUESTION [6 upvotes]: How to calculate the gradient of the following summation in terms of $x_i$ ?
$$\sum_{i=0}^n(x_i-a)^2$$
is the following answer true?
$$2 \sum_{i=0}^n(x_i-a)$$
Thank you

REPLY [3 votes]: The gradient is the vector of the partial derivatives; $\partial_{x_i} \sum_{i=0}^n (x_i−a)^2=2(x_i−a)$. So the first component of your gradient is $2(x_1−a)$.