In this case you have to take into account the constraint on the vector `x`. The quadratic form `x`_{i}D_{ij}x_{j} is unbounded on `R`^{n}, so a derivative test (even with an Hessian test) is only going to find local extreme points, and there is no guarantee that those points will lie on the surface of interest (i.e. `x'x = 1`.) The difference is that for a point to be a local maximum when `x` is constrained, the derivative only needs to be zero when evaluated in the tangent space of the constraining surface at that point, not zero in every direction.

The standard way to include the surface constraint is to use Lagrangian multipliers.

Comment onRe^2: Help with Matrix math!