How this calculation works
A sum-of-squares certificate proves nonnegativity by reconstructing a polynomial as weighted squares with nonnegative weights. This calculator handles homogeneous quartics in two variables through their one-parameter rational Gram family. It searches a declared finite candidate set, verifies positive semidefiniteness exactly and returns a weighted-square decomposition when found. An unsuccessful search is explicitly inconclusive rather than a nonnegativity verdict.
f=zᵀGz, z=(x²,xy,y²); exact PSD G yields f=Σ d_i(a_i x²+b_i xy+c_i y²)² with d_i≥0.A worked example
For x⁴+2x²y²+y⁴, choose z=(x²,xy,y²) and G=[[1,0,1],[0,0,0],[1,0,1]]. The matrix is positive semidefinite and zᵀGz=(x²+y²)². Its exact weighted-square certificate has one square with weight one and coefficient row (1,0,1). Expanding that square recovers every coefficient of the original polynomial.
Good to know
Only homogeneous bivariate quartics, including zero. Search candidates are t=c/2, zero, the rational endpoints ±sqrt(ae) when available, and scaled rationals with numerators −32…32 and denominators 1…8, where c is the x²y² coefficient and scale is max(1, absolute coefficients). This is not a complete semidefinite optimizer. All returned certificates are exact; failure to find one does not prove negativity, non-SOS status or nonexistence. General degrees and nonhomogeneous polynomials are rejected.
Reference: MOSEK Modeling Cookbook — semidefinite and sum-of-squares models (opens in a new tab) ↗
Matching coefficients leaves one free Gram entry
Write f=a x⁴+b x³y+c x²y²+d xy³+e y⁴. For basis z=(x²,xy,y²), the Gram matrix can be written [[a,b/2,t],[b/2,c−2t,d/2],[t,d/2,e]]. Every t gives the same polynomial, but only some t values may make the matrix positive semidefinite. A coefficient match alone is not yet a nonnegativity certificate.
The engine checks every principal minor, not only the leading ones. For a symmetric matrix, all principal minors being nonnegative characterize positive semidefiniteness. Using only positive diagonal entries or only the determinant would miss indefinite matrices and could falsely label a polynomial as a sum of squares.
The Quadratic form inertia calculator with congruence transformation classifies a quadratic form, while this page searches a quartic polynomial Gram family and reconstructs weighted quadratic squares.
Bounded search failure must remain inconclusive
The chosen rational grid is a practical certificate search, not an exhaustive search of all real Gram parameters. A feasible interval can be narrow or a useful parameter can lie outside the tested set. Consequently no certificate found cannot be translated into this polynomial takes negative values or this polynomial is not a sum of squares.
Conversely, every returned certificate is checked independently of the search path. Exact congruence diagonalization gives nonnegative rational weights, and the resulting quadratic squares are expanded back into coefficients. A numerical matrix with a tiny negative eigenvalue is not rounded into a positive-semidefinite exact certificate.
Weighted rational squares avoid pretending square roots are rational
A nonnegative rational diagonal weight need not be a square of a rational number. The expression d q(x,y)² with d≥0 is still a valid real sum-of-squares certificate, since it equals (sqrt(d) q(x,y))². Keeping the weight separate preserves exact rational data without inventing a rational square root.
The displayed coefficient rows refer to x²,xy,y² in that order. The zero polynomial has the empty weighted-square sum and a zero Gram matrix. Testing that boundary case, verified positive examples and deliberately indefinite examples ensures the page distinguishes a proved certificate from an unsupported input or an incomplete search.
A few questions, answered
Does inconclusive mean the polynomial is negative somewhere?
No. It only means this finite rational candidate search found no verified Gram certificate.
Why are weights shown separately from squares?
A positive rational weight can have an irrational square root. Keeping the weight outside the square maintains an exact rational certificate.