[Math] Derivative of double summation and dot notation

derivativespartial derivativestatisticssummation

I am trying to differentiate the following summation:

$$ L(\mu, \tau_1, \ldots, \tau_i)= \sum_{i=1}^v \sum_{t=1}^{r_i} (y_{it}-\mu – \tau_i)^2 $$

$$\frac{dL}{d\mu} = y_{\cdot\cdot}-n\mu – \sum_{i=1}^v r_i \tau_i$$

$$\frac{dL}{d\tau_i} = y_{i\cdot}-r_i \mu – r_i \tau_i$$

I tried taking the derivative in terms of $\mu$ and $\tau $ but the dot notation/summations confuse me in terms of expanding the equation of the derivative.

For instance, I don't understand how you get $y_{\cdot\cdot}$, $n$, and $\sum r_i$ (within the terms) when taking the derivative in terms of $\mu$. Or when taking the derivative in terms of $\tau$, I don't get why you get $y_{i\cdot}$ and $r_i$.

I brushed up on taking derivatives of summations and I still don't understand.

I'd appreciate it if someone can help me understand, thank you.

Best Answer

$$ \begin{align} \frac{d}{d\mu} \sum_{i=1}^v \sum_{t=1}^{r_i} (y_{it}-\mu - \tau_i)^2 & = \sum_{i=1}^v \sum_{t=1}^{r_i} \frac{d}{d\mu} (y_{it}-\mu - \tau_i)^2 \\[6pt] & = \sum_{i=1}^v \sum_{t=1}^{r_i} 2(y_{it}-\mu - \tau_i)(-1) \\[6pt] & = -2 \left(\sum_{i=1}^v \sum_{t=1}^{r_i} y_{it}\right) -2 \left(\sum_{i=1}^v \sum_{t=1}^{r_i} \mu \right) -2 \left(\sum_{i=1}^v \sum_{t=1}^{r_i} \tau_i\right) \\[6pt] & = -2 y_{\cdot\cdot} - n\mu + \sum_{i=1}^v r_i t_i. \end{align} $$ The fact that $\displaystyle\sum_{i=1}^v \sum_{t=1}^{r_i} y_{it}=y_{\cdot\cdot}$ is just the definition of $y_{\cdot\cdot}$. The second sum is $n\mu$ because it's a sum of $n$ terms, each equal to $\mu$. For the third sum, one has $\displaystyle\sum_{t=1}^{r_i} \tau_i = r_i\tau_i$ because it's a sum of $r_i$ terms, each equal to $\tau_i$.

PS: It would be a mistake to write something like this: $$\frac{d}{d\tau_i}\sum_{i=1}^v \sum_{t=1}^{r_i} (y_{it}-\mu - \tau_i)^2$$

Let's say $n=3$, so that $i=\text{either 1, 2, or 3}$. In the expression $\dfrac{d}{d\tau_i}$, the $i$ is either $1$, $2$, or $3$. But in the expression $\displaystyle\sum_{i=1}^3$, the index $i$ runs through the whole list of three values and you add up the terms, while the $i$ in $\dfrac{d}{d\tau_i}$ stays put!

So instead, write $$\frac{d}{d\tau_i}\sum_{j=1}^v \sum_{t=1}^{r_j} (y_{jt}-\mu - \tau_j)^2.$$ This is $$\sum_{j=1}^v \frac{d}{d\tau_i} \sum_{t=1}^{r_j} (y_{jt}-\mu - \tau_j)^2,$$ and $$ \frac{d}{d\tau_i} (y_{jt}-\mu - \tau_j)^2 = \begin{cases} 0 & \text{when }j\ne i, \\[8pt] \sum_{t=1}^{r_i} 2(y_{it} -\mu -\tau_i)(-1) & \text{when }j=i. \end{cases} $$

Thus all of the terms in the sum $\sum_{j=1}^v$ are $0$ except the $i$th term.

Related Question