Write , , , , and , . Put . The product rule and chain rule give
Here are derivatives with respect to . In the first derivative, because the expression is scalar. Likewise if desired. This differentiation of a parameter-dependent quadratic form does not assume that is symmetric. The positive linear term contributes the positive chain-rule terms in the derivatives; it is independent of .