# Matrix Calculus - Differentiate powered quadratic form

I want to differentiate:

$$(w'Aw)^{y}$$

with respect to w (w is a nx1 vector, A is a nxn matrix, A does not depend on w, w' means the transpose of w, y belongs to the set {-1,+1}

I know how to do it when there is no y but since y is present, I have no idea how to handle this. Really appreciate any help

The usual chain rule is going to work here; the answer will be $$\partial_\mu \left( w_\nu A^\nu_\tau w^\tau \right)^n = n \left( A^\mu_\tau w^\tau + w_\nu A^\nu_\mu \right)\left( w_\nu A^\nu_\tau w^\tau \right)^{n-1}$$