I'm trying to take the partial derivative of $-\sum\limits_{i=1}^n \frac{(x_i-\mu)^2}{2\sigma^2}$ with respect to $\mu$. The correct answer is $\sum\limits_{i=1}^n \frac{x_i-\mu}{\sigma^2}$. It looks like some u-substitution work where $u = x_i-\mu$ and $du = -1$ so it's $\sum\limits_{i=1}^n \frac{u^2}{2\sigma^2}du$ which ends up being $\sum\limits_{i=1}^n\frac{2(x_i-\mu)}{2\sigma^2} \times (-1)$

it all cancels out but why does this still work when inside of a summation?

Usually when I do derivatives of summations, I have to incorporate the $n$ into the equation to rid myself of the summation operator. For example, $$\prod\limits_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} = \bigg(\frac{1}{\sqrt{2\pi\sigma^2}}\bigg)^n$$

The summation operator throws me off when it involves derivatives and the only way it makes sense to me is to restructure the format so that it doesn't include the summation operator. How can this be reorganized so the derivative makes sense?

  • 2
    $\begingroup$ Because a (finite) sum of derivatives is the derivative of the sum. $\endgroup$
    – user296602
    Commented Jan 19, 2016 at 3:27

1 Answer 1


The derivative and thus the partial derivative are linear operators, i.e. for a sum of functions $f_i$ and $a \in \mathbb{R}$:$${\partial \over \partial x}\left( \sum a\cdot f_i \right)= a\cdot \sum {{\partial f_i \over \partial x}}$$

So in your case we have

$${\partial \over \partial \mu}\left( -\sum\limits_{i=1}^n \frac{(x_i-\mu)^2}{2\sigma^2} \right) = -{1 \over 2 \sigma^2}\sum\limits_{i=1}^n{\partial \over \partial \mu} \left( {(x_i-\mu)^2}\right) = -{1 \over 2 \sigma^2}\sum\limits_{i=1}^n -2{(x_i-\mu)} $$ $$= {1 \over \sigma^2}\sum\limits_{i=1}^n {x_i-\mu} $$

Which is exactly what you have as a result. Further, I don't know what you mean by the u-substitution. This is plain application of the chain rule. Moreover, what you have here is not correct:

$$\sum\limits_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} \color{red}{\neq} \bigg(\frac{1}{\sqrt{2\pi\sigma^2}}\bigg)^n$$

Summation does not result in exponentiation, but just multiplication. You should have gotten:

$$\sum\limits_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} = \frac{n}{\sqrt{2\pi\sigma^2}}$$

  • $\begingroup$ sorry about that! i meant to put product for that one. i will edit the question on that last bit $\endgroup$
    – O.rka
    Commented Jan 19, 2016 at 7:34
  • 2
    $\begingroup$ Some people learn the chain rule through a sort of misuse of notation in calling it u substitution, I know Stewart's calculus does that... $\endgroup$
    – Triatticus
    Commented Jan 19, 2016 at 8:50
  • $\begingroup$ yea, i learned the chain rule years ago in high school but i've always remembered how to do it by substituting the expression with an abstract variable u $\endgroup$
    – O.rka
    Commented Jan 19, 2016 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .