Quadratic Form Calculator
Evaluate a quadratic form Q(x) = x^T A x for a symmetric 2×2 matrix and a vector (x₁, x₂). Use it to test whether a matrix is positive definite, negative definite, or indefinite.
About this calculator
A quadratic form associated with a symmetric 2×2 matrix A is the scalar function Q(x₁, x₂) = a11·x₁² + 2·a12·x₁·x₂ + a22·x₂². This is the expanded version of the matrix expression Q = xᵀAx, where x = (x₁, x₂)ᵀ. The off-diagonal coefficient a12 appears doubled because the symmetric matrix contributes both a12·x₁·x₂ and a21·x₂·x₁, and a12 = a21 for symmetric matrices. The definiteness of A classifies Q: if Q > 0 for all non-zero x, A is positive definite (checked via a11 > 0 and det(A) > 0); if Q < 0 always, it is negative definite; otherwise it is indefinite or semi-definite. Quadratic forms are fundamental in optimization, where the Hessian matrix's definiteness determines whether a critical point is a minimum, maximum, or saddle point.
How to use
Let A = [[4, 1], [1, 3]] and x = (2, −1). Enter a11=4, a12=1, a22=3, x1=2, x2=−1. Apply the formula: Q = a11·x1² + 2·a12·x1·x2 + a22·x2² = 4·(2²) + 2·1·(2)·(−1) + 3·(−1²) = 4·4 + 2·(−2) + 3·1 = 16 − 4 + 3 = 15. Since Q = 15 > 0 for this vector, and checking definiteness: a11 = 4 > 0 and det(A) = 4·3 − 1·1 = 11 > 0, so A is positive definite.
Frequently asked questions
How do you determine if a quadratic form is positive definite?
A quadratic form Q = xᵀAx (with symmetric A) is positive definite if Q > 0 for every non-zero vector x. For a 2×2 matrix, you can check this using Sylvester's criterion: A is positive definite if and only if all leading principal minors are positive, meaning a11 > 0 and det(A) = a11·a22 − a12² > 0. If a11 > 0 but det(A) < 0, the form is indefinite. If both conditions fail with reversed signs, the form is negative definite.
What is the difference between a quadratic form and a bilinear form?
A quadratic form Q(x) is a homogeneous degree-2 polynomial in one vector argument, such as Q(x₁, x₂) = a11·x₁² + 2·a12·x₁·x₂ + a22·x₂². A bilinear form B(x, y) takes two vector arguments and is linear in each, like B(x, y) = xᵀAy. Every quadratic form arises from a bilinear form by setting both arguments equal: Q(x) = B(x, x). The relationship is foundational in linear algebra and differential geometry, where quadratic forms describe curvature and metric structures.
Why are quadratic forms important in optimization and machine learning?
In optimization, the second-order behavior of a function near a critical point is captured by its Hessian matrix H, and the associated quadratic form xᵀHx determines the nature of that point. If H is positive definite, the point is a local minimum; negative definite means a local maximum; indefinite means a saddle point. In machine learning, quadratic forms appear in regularization terms (like L2 penalty), covariance matrices in Gaussian distributions, and the energy functions of quadratic optimization problems such as support vector machines.