A free and open-source RREF Calculator that converts matrices into reduced row echelon form using Gauss-Jordan elimination.
It provides step-by-step row operations to help students understand matrix reduction instead of only showing the final answer.
Live demo: https://rref-calculator.org
- Compute Reduced Row Echelon Form (RREF)
- Generate step-by-step row operations
- Use exact fraction arithmetic through
mathjs - Accept integers, decimals, fractions, and blank values
- Format matrices as plain text or LaTeX
- Encode and parse shareable matrix solve slugs
- Work with ordinary matrices and augmented matrices
npm install rref-calculator
import { formatMatrixPlain, formatStepPlain, rref } from 'rref-calculator'; const result = rref([ [1, 2, 5], [3, 4, 7], ]); for (const [index, step] of result.steps.entries()) { console.log(`Step ${index}: ${formatStepPlain(step)}`); console.log(formatMatrixPlain(step.matrix)); } console.log('Final RREF:'); console.log(formatMatrixPlain(result.rref));
Output:
Final RREF:
[1 0 -3]
[0 1 4]
Computes the reduced row echelon form of a matrix.
const result = rref([ ['1/2', '1/3'], ['1/4', '1/6'], ]);
Returns:
type RrefResult = { input: FractionMatrix; rref: FractionMatrix; steps: RrefStep[]; rank: number; pivotColumns: number[]; };
Step objects are structured so applications can render them as English text, localized UI labels, LaTeX, or custom educational explanations.
type RrefStep = | { type: 'initial'; matrix: FractionMatrix } | { type: 'swap'; rowA: number; rowB: number; matrix: FractionMatrix } | { type: 'scale'; row: number; factor: FractionValue; matrix: FractionMatrix } | { type: 'eliminate'; targetRow: number; pivotRow: number; factor: FractionValue; matrix: FractionMatrix; };
formatFraction(value); formatFractionLatex(value); formatMatrixPlain(matrix); formatMatrixLatex(matrix); formatStepPlain(step); formatStepLatex(step);
buildSolveSlug(rows, cols, values); parseSolveSlug(slug); normalizeMatrixValue(value); encodeSolveValue(value);
Example:
buildSolveSlug(2, 2, ['1/2', '2', '0', '2']); // 2x2-1~2_2_0_2
Supported values include:
5
-2
1.25
-0.5
3/4
-7/9
Blank values are treated as 0.
npm install
npm test
npm run buildMIT