# 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.

-

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]$$