Hilbert-Matrix Determinant: Where FP64 Flips Sign
The Hilbert-matrix determinant is provably positive for every n. Computed in FP64, the sign comes out negative for n=14, 15, 16, and 20. This is not a library bug — it is what happens when the condition number exceeds the precision FP64 has to work with.
The Evidence
Mathematical Fact
The Hilbert matrix Hn has entries Hij = 1/(i+j-1). Its determinant is positive for every n — a proven theorem. So any negative sign a numerical routine returns is a precision artifact, not the true value.
| Matrix Size | FP64 Sign (NumPy) | VLA Sign | Correct Sign |
|---|---|---|---|
| n = 13 | + | + | |
| n = 14 | - | + | |
| n = 15 | - | + | |
| n = 16 | - | + | |
| n = 17-19 | + | + | |
| n = 20 | - | + |
4
FP64 sign errors (n=14,15,16,20)
0
VLA sign errors
Why This Happens
The Hilbert Matrix is Notoriously Ill-Conditioned
The condition number grows exponentially with n. For n=15, the condition number exceeds 1017 — meaning FP64's 15-16 significant digits are completely consumed.
NumPy uses FP64, which carries ~15 decimal digits. At n=15 the Hilbert matrix needs more precision than that to resolve the determinant's sign, so the computed sign can flip — a result the true value rules out.
VLA's Advantage
VLA uses 512-bit integer arithmetic providing 77 decimal digits of precision. Even for n=20 Hilbert matrices (condition number ~1028), VLA has enough precision to compute exact results.
Implications
Control Systems
Hilbert matrices appear in polynomial fitting and control system design. Wrong signs can lead to unstable controllers.
Optimization
Many optimization algorithms involve ill-conditioned matrices. If your solver gives wrong answers on Hilbert matrices, it will give wrong answers elsewhere too.
Validation
The Hilbert matrix is a standard ill-conditioning benchmark. If FP64 loses the sign here, it is worth checking where else in a pipeline conditioning quietly exceeds its precision.
Can Your Calculations Be Trusted?
Let us validate your numerical pipelines with exact arithmetic.
Get in touch