If the matrix is not exactly symmetric, the calculator uses (A + A^T) / 2 because x^T A x only depends on the symmetric part.
Quadratic Form Calculator
Use this Quadratic Form Calculator to enter values, adjust options, and review results in a compact responsive workspace.
Results are calculated automatically as you enter data.
▼ See explanations and tips below ▼
Related Calculators
What Is a Quadratic Form?
A quadratic form is a polynomial expression in which every term has total degree \(2\). In linear algebra, the most useful way to write it is as a matrix expression:
Here, \(\mathbf{x}\) is a vector of variables and \(A\) is the matrix that represents the form. For a two-variable form, \(\mathbf{x} = [x \; y]^T\); for a three-variable form, \(\mathbf{x} = [x \; y \; z]^T\).
Quadratic forms matter because they describe whether an expression is always positive, always negative, flat in some directions, or positive in some directions and negative in others. This is called the definiteness of the form. Definiteness is a central idea in linear algebra, multivariable calculus, optimization, statistics, physics, and engineering.
For example, the form \(x^2 + y^2\) is always positive except at the origin, so it is positive definite. The form \(x^2 - y^2\) can be positive or negative depending on the direction, so it is indefinite.
Why Definiteness Matters
Definiteness turns a formula into geometric information. It tells you the basic shape of a quadratic expression:
- Positive definite: bowl-shaped upward, with a strict minimum at the origin.
- Negative definite: bowl-shaped downward, with a strict maximum at the origin.
- Semidefinite: never changes sign, but may be zero along a line, plane, or other nonzero direction.
- Indefinite: has both positive and negative directions, often producing a saddle-like shape.
Students often meet this idea when using the second derivative test in multivariable calculus. The Hessian matrix of a function creates a local quadratic approximation, and the definiteness of that quadratic form helps decide whether a critical point behaves like a minimum, maximum, saddle point, or a flatter case that needs more analysis.
Quadratic forms also appear in least-squares problems, covariance matrices, energy expressions, conic sections, ellipsoids, and stability analysis. In each case, the signs of the eigenvalues help explain the behavior of the expression.
Key Terms to Know
- Quadratic form: An expression that can be written as \(\mathbf{x}^T A \mathbf{x}\), where every term has degree \(2\).
- Symmetric matrix: A matrix satisfying \(A = A^T\). Real quadratic forms are normally represented by symmetric matrices.
- Cross term: A mixed product such as \(xy\), \(xz\), or \(yz\).
- Eigenvalue: A number \(\lambda\) that describes how a matrix scales one of its eigenvector directions.
- Definiteness: The sign behavior of the quadratic form over all nonzero vectors.
- Principal minor: The determinant of a square submatrix formed by keeping the same set of row and column indices.
- Leading principal minor: A principal minor taken from the upper-left \(k \times k\) block of the matrix.
- Orthogonal diagonalization: A change of coordinates that rewrites a symmetric matrix using perpendicular eigenvector directions.
How Quadratic Form Definiteness Works
A real quadratic form is easiest to study through a symmetric matrix. For two variables, a symmetric matrix has the form:
Then:
This is why a cross term is split between the two symmetric off-diagonal entries. If the expression contains \(4xy\), then the matching matrix entries are \(2\) and \(2\), not \(4\) and \(4\):
A non-symmetric matrix can represent the same quadratic form as its symmetric part:
So the sign behavior of a real quadratic form is controlled by a symmetric matrix.
Eigenvalues and Diagonal Form
The main reason eigenvalues are so useful is that every real symmetric matrix can be orthogonally diagonalized. In practical terms, this means the variables can be rotated or reflected into new coordinates where the cross terms disappear.
If \(A\) has eigenvalues \(\lambda_1, \lambda_2, \ldots, \lambda_n\), the quadratic form can be rewritten as:
The variables \(u_1, u_2, \ldots, u_n\) are coordinates measured along eigenvector directions. Since each squared term \(u_i^2\) is never negative, the sign of each coefficient \(\lambda_i\) determines the sign behavior of the whole form.
| Eigenvalue pattern | Definiteness classification | Meaning |
|---|---|---|
| All \(\lambda_i > 0\) | Positive definite | The form is positive for every nonzero vector. |
| All \(\lambda_i < 0\) | Negative definite | The form is negative for every nonzero vector. |
| All \(\lambda_i \ge 0\), with at least one zero | Positive semidefinite | The form is never negative, but may be zero away from the origin. |
| All \(\lambda_i \le 0\), with at least one zero | Negative semidefinite | The form is never positive, but may be zero away from the origin. |
| Both positive and negative eigenvalues | Indefinite | The form takes both positive and negative values. |
Principal Minors and Sylvester-Style Checks
Principal minors give a determinant-based way to inspect a matrix. The leading principal minors are commonly written as:
For a real symmetric matrix, Sylvester's criterion says the matrix is positive definite exactly when all leading principal minors are positive:
Negative definiteness can be checked by applying the same positive-definite test to \(-A\). This produces alternating signs in the leading minors of \(A\).
Principal minors connect determinant information with definiteness. This calculator uses their exact signs for the authoritative classification, avoiding the scale-dependent zero thresholds that can affect numerical eigenvalues.
Examples of Quadratic Form Definiteness in Practice
Example 1: A Positive Definite Form
Consider:
The cross-term coefficient \(4\) is split across the symmetric off-diagonal entries:
For a \(2 \times 2\) symmetric matrix, the eigenvalues can be found from the trace and determinant. Here, the eigenvalues are:
Both values are positive, so the quadratic form is positive definite. Geometrically, it behaves like an upward-opening bowl after a rotation of coordinates.
Example 2: An Indefinite Form
Consider:
Its matrix is already diagonal:
The eigenvalues are \(1\) and \(-1\). Because one is positive and the other is negative, the form is indefinite.
You can see this directly from the expression. Along the \(x\)-axis, \(q(x,0)=x^2\), which is positive for \(x \ne 0\). Along the \(y\)-axis, \(q(0,y)=-y^2\), which is negative for \(y \ne 0\).
Example 3: A Semidefinite Edge Case
Consider:
Expanding gives:
The symmetric matrix is:
The eigenvalues are \(2\) and \(0\). The form is never negative, but it is zero whenever \(x=y\):
Because there is a zero eigenvalue and no negative eigenvalue, the form is positive semidefinite rather than positive definite.
How to Interpret the Result
The most important result is the classification. It tells you whether the quadratic form is positive definite, negative definite, positive semidefinite, negative semidefinite, or indefinite.
Exact principal-minor signs determine the reported classification. The displayed approximate eigenvalues explain the corresponding diagonalized shape: positive coefficients give upward directions, negative coefficients give downward directions, and mixed signs give both.
The diagonalized form shows the same idea in a coordinate system where the cross terms have been removed:
The leading minors and full set of principal minors determine the calculator's exact definiteness classification. Eigenvalues and the diagonalized form are displayed as numerical supporting information and include a residual check.
The symmetric matrix shown in the result is the matrix actually used to classify the form. If a non-symmetric matrix was entered, the displayed symmetric matrix may differ from the entries typed into the input grid.
The contour preview gives a visual sense of the shape. For a \(2 \times 2\) form, it represents contours of \(q(x,y)\). For a \(3 \times 3\) form, it represents only the \(z=0\) slice, so it should not be read as a full three-dimensional picture.
Common Mistakes and Misconceptions
One common mistake is putting the full cross-term coefficient into each off-diagonal entry. In a symmetric \(2 \times 2\) matrix, the off-diagonal entry \(b\) creates a cross term \(2bxy\). Therefore, a term like \(6xy\) corresponds to off-diagonal entries \(3\) and \(3\).
Another mistake is assuming that a non-symmetric matrix is used exactly as typed. For a real quadratic form, only the symmetric part affects \(\mathbf{x}^T A \mathbf{x}\). The skew-symmetric part cancels out of the quadratic expression.
Near-zero eigenvalues also need care. A value displayed as \(0\) or very close to zero may reflect numerical tolerance rather than an exact symbolic result. This matters most when distinguishing definite forms from semidefinite forms.
Users also sometimes expect a quadratic-expression input to accept linear terms, constants, parentheses, functions, or symbolic parameters. A quadratic form contains only degree-\(2\) terms such as \(x^2\), \(xy\), \(xz\), and \(yz\).
For \(3 \times 3\) forms, the contour preview can be misunderstood. It shows a two-dimensional slice, not the complete three-variable geometry.
When to Use Quadratic Form Definiteness
Use quadratic form definiteness when you need to understand the sign or shape of a second-degree expression.
Common uses include:
- Classifying a quadratic expression as positive definite, negative definite, semidefinite, or indefinite.
- Checking the sign behavior of a symmetric matrix.
- Understanding a Hessian matrix in a multivariable calculus problem.
- Studying whether a critical point behaves like a local minimum, maximum, or saddle point.
- Interpreting conic sections, ellipses, hyperbolas, ellipsoids, and saddle-like surfaces.
- Checking whether a covariance-like or Gram-like matrix has nonnegative quadratic forms.
- Comparing eigenvalue and determinant-based criteria for the same matrix.
Limitations and Things to Keep in Mind
Classification is exact for supported decimal and scientific-notation inputs. The calculator displays exact rational symmetric-matrix entries and principal minors, then uses their signs for classification. It does not provide symbolic eigenvalue radicals; eigenvalues and the diagonalized form are binary64 approximations.
Decimal and scientific-notation inputs are converted to exact rational values for determinants and classification. Approximate eigenvalues are computed after scaling the matrix. If an eigenvalue is below the reliable numerical resolution, the interface says so while keeping the exact principal-minor classification authoritative.
Only \(2 \times 2\) and \(3 \times 3\) forms are supported. Variables beyond \(x\), \(y\), and \(z\) are not supported. Expression input must use supported quadratic terms only; constants, linear terms, non-quadratic powers, parentheses, functions, and symbolic parameters are outside the supported input format.
Very large magnitudes can be difficult for numerical calculations. Inputs with absolute value greater than \(10^{100}\) are rejected, and non-finite values are not allowed.
Exact matrix entries and principal minors remain exact. Approximate eigenvalues are rounded to readable significant digits, while very small or very large values appear in scientific notation.
The graph is a visual preview, not a proof. Some level curves may not appear within the fixed viewing window, and the \(3 \times 3\) preview only shows the \(z=0\) slice.
For exams, proofs, engineering work, scientific modeling, or other high-stakes uses, double-check important results and confirm whether numerical tolerance, rounding, or exact symbolic requirements affect the conclusion.
How to Use This Calculator
- Choose whether to enter the quadratic form as a matrix or as an expression.
- Select the size: \(2 \times 2\) for variables \(x\) and \(y\), or \(3 \times 3\) for variables \(x\), \(y\), and \(z\).
- In matrix mode, enter every visible matrix entry. If the matrix is not symmetric, the symmetric part will be used.
- In expression mode, enter a supported quadratic expression using squared terms and cross terms, such as \(x^2\), \(xy\), \(xz\), or \(yz\).
- Optionally load a preset example for a positive definite, negative definite, indefinite, semidefinite, or expression-based form.
- Review the classification, eigenvalues, diagonalized form, leading minors, full principal-minor table, symmetric matrix, contour preview, and calculation steps.
- Use the graph download option when a contour preview is available and you want to save it as an image.
Frequently Asked Questions
What does positive definite mean for a quadratic form?
Positive definite means the quadratic form is positive for every nonzero input vector. In eigenvalue terms, a real symmetric matrix is positive definite when all of its eigenvalues are positive.
What is the difference between positive definite and positive semidefinite?
A positive definite form is strictly positive for every nonzero vector. A positive semidefinite form is never negative, but it can equal zero for some nonzero vector. A zero eigenvalue is the usual sign that the form may be semidefinite rather than definite.
Why are cross-term coefficients divided by two in the matrix?
In a symmetric matrix, the entries \(A_{12}\) and \(A_{21}\) both contribute to the \(xy\) term. If both entries equal \(b\), their combined contribution is \(2bxy\). That is why a cross term like \(8xy\) corresponds to off-diagonal entries \(4\) and \(4\).
Can a non-symmetric matrix define a quadratic form?
A non-symmetric matrix can appear in \(\mathbf{x}^T A \mathbf{x}\), but only its symmetric part affects the result. The equivalent symmetric matrix is \(\frac{A+A^T}{2}\), so definiteness is normally discussed for symmetric matrices.
Why do eigenvalues decide definiteness?
A real symmetric matrix can be orthogonally diagonalized, so eigenvalue signs explain the geometry of the sum of squared transformed variables. This calculator reports classification from exact rational principal-minor signs; its displayed eigenvalues are binary64 approximations that support that interpretation.
Does the contour preview show the whole form?
For two variables, the contour preview shows level curves of \(q(x,y)\). For three variables, it shows only the \(z=0\) slice. It is useful for intuition, but the classification comes from the matrix calculations.
Can this handle constants, linear terms, or higher powers?
No. A quadratic form uses only degree-\(2\) terms. Terms such as \(x\), \(3\), \(x^3\), \(\sin(x)\), or parenthesized symbolic expressions are not part of the supported quadratic-form input.
Sources and References
Books and Open Textbooks
- David Austin. Understanding Linear Algebra. Grand Valley State University / Mathematics LibreTexts. Sections 7.1 “Symmetric Matrices and Variance” and 7.2 “Quadratic Forms.” Accessed July 4, 2026. Section 7.1; Section 7.2.
- W. Keith Nicholson. Linear Algebra with Applications. Lyryx / Mathematics LibreTexts. Section 8.3 “Positive Definite Matrices.” Accessed July 4, 2026. Section 8.3.
- Stephen Boyd and Lieven Vandenberghe. Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares. Cambridge University Press, 2018. Chapter 6 and Exercise 10.36. Book PDF.
Online Course Materials
- Massachusetts Institute of Technology OpenCourseWare. “Symmetric Matrices and Positive Definiteness.” 18.06SC Linear Algebra, Fall 2011. Accessed July 4, 2026. MIT OpenCourseWare.