Enter the coefficients of your 3×4 matrix (augmented matrix) to calculate the reduced row echelon form and solve systems of linear equations.
Resulting Matrix
What is Reduced Row Echelon Form (RREF)?
Reduced Row Echelon Form is a specific type of matrix resulting from Gaussian elimination. A matrix is in RREF if it satisfies several criteria: all non-zero rows are above any rows of all zeros, the leading coefficient (pivot) of a non-zero row is always 1 and is strictly to the right of the pivot above it, and every column containing a leading 1 has zeros elsewhere.
How the Gauss-Jordan Elimination Process Works
To reach the Reduced Row Echelon Form, we use three types of elementary row operations:
Row Swapping: Swapping two rows to move a non-zero element to the pivot position.
Scalar Multiplication: Multiplying a row by a non-zero constant to make the leading coefficient equal to 1.
Row Addition: Adding a multiple of one row to another row to create zeros above and below the pivots.
Why use RREF?
Converting a matrix to RREF is the standard method for solving systems of linear equations. In an augmented matrix (where the final column represents the constants after the equals sign), the RREF directly reveals the values of the variables. It also helps in determining the rank of a matrix, finding the inverse of a matrix, and identifying if a system has a unique solution, infinitely many solutions, or no solution at all.
By entering these values into our calculator, the process performs forward and backward elimination. The resulting identity matrix on the left side reveals the solution: x=2, y=-1, z=3.
function calculateRREF() {
var matrix = [];
var rows = 3;
var cols = 4;
// Load data from inputs
for (var i = 0; i < rows; i++) {
matrix[i] = [];
for (var j = 0; j < cols; j++) {
var val = parseFloat(document.getElementById('m' + i + j).value);
if (isNaN(val)) val = 0;
matrix[i][j] = val;
}
}
var lead = 0;
for (var r = 0; r < rows; r++) {
if (cols <= lead) break;
var i = r;
while (matrix[i][lead] === 0) {
i++;
if (rows === i) {
i = r;
lead++;
if (cols === lead) return displayMatrix(matrix, rows, cols);
}
}
// Swap rows i and r
var temp = matrix[i];
matrix[i] = matrix[r];
matrix[r] = temp;
// Divide row r by matrix[r][lead]
var val = matrix[r][lead];
if (val !== 0) {
for (var j = 0; j < cols; j++) {
matrix[r][j] /= val;
}
}
for (var i = 0; i < rows; i++) {
if (i !== r) {
var val = matrix[i][lead];
for (var j = 0; j < cols; j++) {
matrix[i][j] -= val * matrix[r][j];
}
}
}
lead++;
}
displayMatrix(matrix, rows, cols);
}
function displayMatrix(matrix, rows, cols) {
var displayDiv = document.getElementById('matrix-display');
var resultArea = document.getElementById('result-area');
var summaryDiv = document.getElementById('solution-summary');
var html = '
';
for (var i = 0; i < rows; i++) {
html += '
';
for (var j = 0; j < cols; j++) {
var num = matrix[i][j];
// Format to 3 decimal places and remove trailing zeros
var formatted = Math.abs(num) < 0.0000001 ? "0" : Number(num.toFixed(3)).toString();
var color = (j === 3) ? 'color: #1a73e8;' : 'color: #333;';
var margin = (j === 2) ? 'margin-right: 15px; border-right: 1px dashed #ccc; padding-right: 10px;' : 'margin-right: 15px;';
html += '' + formatted + '';
}
html += '
';
}
html += '
';
displayDiv.innerHTML = html;
// Check for solutions
var solX = matrix[0][3];
var solY = matrix[1][3];
var solZ = matrix[2][3];
// Basic solution interpretation for a standard 3×3 augmented matrix
var summaryText = "Interpretation:";
if (Math.abs(matrix[2][0]) < 0.001 && Math.abs(matrix[2][1]) < 0.001 && Math.abs(matrix[2][2]) 0.001) {
summaryText += "The system is Inconsistent (No Solution). The last row implies 0 = " + matrix[2][3].toFixed(3);
} else {
summaryText += "The system has Infinitely Many Solutions (Dependent System).";
}
} else {
summaryText += "Unique solution found: ";
summaryText += "x = " + Number(solX.toFixed(4)) + ", ";
summaryText += "y = " + Number(solY.toFixed(4)) + ", ";
summaryText += "z = " + Number(solZ.toFixed(4));
}
summaryDiv.innerHTML = summaryText;
resultArea.style.display = 'block';
resultArea.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
function resetMatrix() {
var inputs = document.querySelectorAll('#matrix-inputs input');
inputs.forEach(function(input) {
input.value = 0;
});
document.getElementById('result-area').style.display = 'none';
}