Floating-point row reduction is a bad way to show students (or yourself) the Gauss-Jordan method. A pivot of 1/3 becomes 0.3333333333333333, the next elimination step drifts, and the “step-by-step” write-up no longer matches the exact arithmetic you would do by hand.
I needed the opposite of that for a math site I work on, MathAI GPT (I built it, so treat this as a maintainer’s write-up, not a review). The result is a zero-dependency library that keeps every entry as an exact BigInt fraction, prints each row operation, and also does 2×2–4×4 cofactor determinants and 2×2/3×3 eigenvalues the same way.
The code is MIT-licensed at vaso81/matrix-rref-steps. It is not on the npm registry. Install it from GitHub:
npm install github:vaso81/matrix-rref-steps Here is a 3×3 system from the README: solve (x + 2y - z = -4), (2x + 3y - z = -11), (-2x - 3z = 22).
const { rrefWithSteps, determinantWithSteps, eigen2x2WithSteps } = require('matrix-rref-steps'); const r = rrefWithSteps([ [1, 2, -1, -4], [2, 3, -1, -11], [-2, 0, -3, 22], ]); console.log(r.rref); // [["1","0","0","-8"],["0","1","0","1"],["0","0","1","-2"]] // so x = -8, y = 1, z = -2 console.log(r.rank); // 3 console.log(r.steps[1]); // "R2 → R2 − 2·R1 to clear column 1: [[1, 2, -1, -4], [0, -1, 1, -3], [-2, 0, -3, 22]]" Decimals in the input are converted exactly (0.75 becomes 3/4). Strings like "7/4" are accepted as well, so you can feed it the same numbers you would write on paper.
Determinants use cofactor expansion along row 1 and show every minor. This example is also from the README and returns "49":
determinantWithSteps([ [2, -3, 1], [2, 0, -1], [1, 4, 5], ]).determinant; Eigenvalues for 2×2 and 3×3 matrices come with the characteristic polynomial. Rational roots are found exactly; complex and irrational cases fall back to numeric values. The test file checks 39 results against sympy.Matrix.
If you would rather click through the same method in a browser, the free calculator that uses this engine is here: RREF calculator with row-operation steps. No account is required.
Two sibling MIT libraries, also install-from-GitHub only, cover TI-84-style normalcdf / invNorm / binomial / interval work with keystrokes (vaso81/ti84-stats-steps, tested against SciPy) and polynomial factoring with the rational root theorem (vaso81/polynomial-factor-steps).
A last distinction that matters to me: this library is deterministic exact arithmetic. The AI solver on the same site is a different tool, and like any AI it can be wrong. For linear algebra homework, I would check the fraction engine or a trusted CAS, not an unverified chat answer.