Purpose
Use Quadratic Forms to solve the optimization stuff

Constraint - The point lies on a sphere

> B <- diag(3)

Maximize

> A <- matrix(1:9, byrow = T, nrow = 3)

Pick a point randomly on a sphere

> par(mfrow = c(1, 1))
> temp <- seq(-pi, pi, length = 100)
> x <- c(rep(1, 100) %*% t(cos(temp)))
> y <- c(cos(temp) %*% t(sin(temp)))
> z <- c(sin(temp) %*% t(sin(temp)))
> scatterplot3d(x, y, z, highlight.3d = TRUE, angle = 120, col.axis = "blue",
+     col.grid = "lightblue", cex.axis = 1.3, cex.lab = 1.1, main = "Sphere",
+     pch = 20)

QuadraticForms-003.jpg

> result <- vector()
> for (i in seq_along(x)) {
+     X <- matrix(c(x[i], y[i], z[i]), byrow = F, ncol = 1)
+     result <- c(result, t(X) %*% A %*% X)
+ }
> plot(seq_along(x), result, pch = 19, col = "blue")

QuadraticForms-004.jpg

  1. Manually find the max point
> max.pt <- which(result == max(result))
> print(c(x[max.pt], y[max.pt], z[max.pt]))
[1] -0.3568862 -0.5418589 -0.7609344
> max(result)
[1] 16.45504

Now use Eigen vectors to get the same answer

> eigval <- eigen(solve(B) %*% A)$values
> max(eigval)
[1] 16.11684

QuadraticForms-006.jpg

Thus max eigen val and max pt from manual search concur

> max(result)
[1] 16.45504
> max(eigval)
[1] 16.11684

Takeaway :

If you have a constraint in a quadratic form and a max or min in a quadratic form, just by merely looking at the eigen values you can compute the min or max of the objective function