# complicated derivative with nested summations

How would I solve for this derivative?

$$s=\frac{1}{N} \sum_i^N \left[t_i - \left(\sum_j \left[c_j e^{-\frac{(r_i-r_j)^2}{2w^2}} + b\right]\right)\right]^2$$

I want to solve for $\dfrac{ds}{dw_j}$.

I don't have the first clue on how to solve this. It has been a while since I have done calculus.

-

## 1 Answer

It's not as complicated as it looks, assuming you meant $w_j$ instead of $w$: $$\frac{ds}{dw_j} =\frac{2}{N} \sum_i^N \left[t_i - \left(\sum_j \left[c_j e^{-\frac{(r_i-r_j)^2}{2w_j^2}} + b\right]\right)\right] \cdot \left[ -\frac{(r_i-r_j)^2}{2w_j^2}\cdot \frac{2(r_i-r_j)^2}{2w_j^3}c_j e^{-\frac{(r_i-r_j)^2}{2w_j^2}} \right]$$

-
Ah I see now. How could I forget about the chain rule... It really has been to long. Thanks for your help. –  still learning Jun 25 '13 at 19:28