Differentiating the variance.

I have a problem that involves differentiating the variance of a function in a lagrange multiplier problem!

I know that there are Summation terms in the variance....http://upload.wikimedia.org/math/c/e...23d885104a.png

what i don't know is what happens after you differentiate this with respect to ai??

It will still have summations and im wondering how you can get the value of what ai is equal to in the equation.....i.e something that would resemble an inner product.....

Any help would be greatly appreciated!!