Use our free online Column Space Calculator to compute the basis and dimension of any matrix’s column space with step-by-step solutions. Try it now.
.csc-wrap { max-width: 700px; margin: 2em auto; background:#fafcff; border-radius:12px; box-shadow:0 0 10px #0001; padding:2em 1.5em; font-family:Arial,sans-serif; }
.csc-h2 { text-align:center; color:#1791c8; font-size:2em; margin-bottom:1.2em; }
.csc-section { margin:1.5em 0 1em 0; }
.csc-title { color:#1791c8; font-size:1.3em; font-weight:bold; margin-bottom:0.5em; text-align:center; }
.csc-matrix, .csc-colset { display:inline-block; vertical-align:middle; }
.csc-matrix table, .csc-colset table { border-collapse:collapse; background:#fff; }
.csc-matrix td, .csc-colset td { border:none; padding:2px 10px; font-size:1.2em; text-align:center; }
.csc-colset { margin:0 0.2em; }
.csc-colset .csc-brace-l,
.csc-colset .csc-brace-r { font-size:2.7em; vertical-align:middle; font-family:serif; }
.csc-colset .csc-cols { display:inline-flex; gap:1.5em; }
.csc-stepbox { background:#eaf7fb; border-left:4px solid #1791c8; border-radius:7px; padding:0.7em 1.2em; margin:1em 0; }
.csc-answer { background:#e0f7fa; border-left:4px solid #1791c8; border-radius:7px; padding:1em 1.5em; font-size:1.1em; margin-top:1.2em; }
.csc-btn { background:#1791c8; color:#fff; border:none; border-radius:4px; padding:0.5em 1.1em; margin:0.5em 0.2em; cursor:pointer; font-size:1em; }
.csc-btn:hover { background:#0b6fa4; }
.csc-copy-msg { color:green; font-weight:bold; margin-left:1em; }
.csc-inputs { display:flex; flex-wrap:wrap; gap:1em; align-items:center; justify-content:center; margin-bottom:1em; }
.csc-inputs label { font-weight:600; }
.csc-inputs input[type=number] { width:3.5em; padding:0.2em; text-align:center; border-radius:4px; border:1px solid #ccc; }
.csc-matrixinput { display:flex; justify-content:center; margin-bottom:1em; }
.csc-matrixinput table { background:#fff; }
.csc-matrixinput td { padding:2px 6px; }
.csc-matrixinput input { width:3em; text-align:center; font-size:1em; }
.csc-toggle { display:inline-flex; align-items:center; gap:0.5em; margin-bottom:0.7em; }.csc-comma { display:inline-block; margin:0 0.3em; font-size:1.2em; vertical-align:middle; }
.csc-colitem { display:inline-block; vertical-align:middle; }.csc-pastebox { width:100%; max-width:600px; margin:1em auto; display:flex; flex-direction:column; align-items:center; }
.csc-pastebox textarea { width:100%; height:100px; font-family:monospace; padding:0.6em; border-radius:6px; border:1px solid #ccc; }@media (max-width:600px) {
.csc-wrap { padding:1em 0.2em; }
.csc-matrix td, .csc-colset td { padding:2px 4px; }
.csc-colset .csc-cols { gap:0.5em; }
}
Column Space Calculator
Results copied!function prettyMatrix(mat, pivotCols = []) {
let html = ‘
‘;
for (let i = 0; i < mat.length; ++i) {
html += '‘;
for (let j = 0; j < mat[0].length; ++j) {
const highlight = pivotCols.includes(j) ? ' style="background:#d1f0ff;font-weight:bold;"' : '';
html += `${+mat[i][j].toFixed(6)} | `;
}
html += ‘
‘;
}
html += ‘
‘;
return html;
}function prettyColVector(vec) {
let html = ‘
‘;
for (let i = 0; i < vec.length; ++i) {
html += `${+vec[i].toFixed(6)} |
`;
}
html += ‘
‘;
return html;
}function prettyBasisSet(basis) {
const items = basis
.map(prettyColVector)
.map(html => `
${html}`)
.join(‘
,‘);
const useBigBrace = basis.length >= 3 ? ‘font-size:3.2em;’ : ”;
return `
{
${items}
}
`;
}function buildInputTable(r, c) {
let html = ‘
‘;
for (let i = 0; i < r; ++i) {
html += '‘;
for (let j = 0; j < c; ++j) {
html += ` | `;
}
html += ‘
‘;
}
html += ‘
‘;
document.getElementById(‘csc-matrixinput’).innerHTML = html;
}function parseMatrix(r, c) {
const mat = Array.from({length: r}, () => Array(c).fill(0));
let valid = true;
document.querySelectorAll(‘.csc-cell’).forEach(inp => {
let v = inp.value.trim() || ‘0’;
if (!/^[-+]?(\d+(\.\d*)?|\.\d+)?(e[-+]?\d+)?$/i.test(v)) {
inp.style.borderColor = ‘red’;
valid = false;
} else {
inp.style.borderColor = ‘#ccc’;
mat[+inp.dataset.row][+inp.dataset.col] = parseFloat(v);
}
});
return valid ? mat : null;
}function rrefSteps(mat) {
let m = mat.map(row => row.slice());
const rows = m.length, cols = m[0].length;
let lead = 0, steps = [], pivots = [];for (let r = 0; r = cols) break;
let i = r;
while (i < rows && Math.abs(m[i][lead]) < 1e-12) i++;if (i === rows) {
lead++;
r–;
continue;
}if (i !== r) {
[m[i], m[r]] = [m[r], m[i]];
steps.push(`Swap row ${i+1} with row ${r+1}`);
}let lv = m[r][lead];
for (let j = 0; j < cols; j++) m[r][j] /= lv;
steps.push(`Divide row ${r+1} by ${lv.toFixed(6)}`);for (let i2 = 0; i2 1e-12) {
let factor = m[i2][lead];
for (let j = 0; j mat.map(row => row[col]));
}function showResults(A, rref, pivots, basis, steps, showSteps) {
let html = ”;
const isTrivial = basis.length === 0;html += `
PROBLEM
Find the column space of ${prettyMatrix(A, pivots)}.
`;html += `
SOLUTION
The reduced row echelon form of the matrix is ${prettyMatrix(rref)}.
The column space is the span of the original columns that correspond to the pivot columns of the RREF.
`;if (isTrivial) {
html += `
All columns are linearly dependent. The column space is the trivial subspace {0}.
`;
} else {
html += `
Thus, the column space is ${prettyBasisSet(basis)}.
`;
}if (showSteps && steps.length) {
html += `
Steps:${steps.map(s => `- ${s}
`).join(”)}
`;
}html += `
ANSWER
The column space of the matrix is ${
isTrivial ? ‘{ 0 }’ : prettyBasisSet(basis)
}.
`;document.getElementById(‘csc-results’).innerHTML = html;
}document.getElementById(‘csc-gen’).onclick = () => {
let r = +document.getElementById(‘csc-rows’).value,
c = +document.getElementById(‘csc-cols’).value;
buildInputTable(r, c);
document.getElementById(‘csc-results’).innerHTML = ”;
};document.getElementById(‘csc-calc’).onclick = () => {
let r = +document.getElementById(‘csc-rows’).value,
c = +document.getElementById(‘csc-cols’).value;
let A = parseMatrix(r, c);
if (!A) return alert(‘Please enter valid numeric values.’);
let {rref, steps, pivots} = rrefSteps(A),
basis = getBasis(A, pivots);
showResults(A, rref, pivots, basis, steps, document.getElementById(‘csc-step-toggle’).checked);
};document.getElementById(‘csc-step-toggle’).onchange = () => {
document.getElementById(‘csc-calc’).onclick();
};document.getElementById(‘csc-copy’).onclick = () => {
let txt = document.getElementById(‘csc-results’).innerText.trim();
if (!txt) return;
navigator.clipboard.writeText(txt).then(() => {
let msg = document.getElementById(‘csc-copymsg’);
msg.style.display = ‘inline’;
setTimeout(() => msg.style.display = ‘none’, 1500);
});
};document.getElementById(‘csc-clear’).onclick = () => {
document.getElementById(‘csc-matrixinput’).innerHTML = ”;
document.getElementById(‘csc-results’).innerHTML = ”;
document.getElementById(‘csc-paste’).value = ”;
};document.getElementById(‘csc-paste-btn’).onclick = () => {
const lines = document.getElementById(‘csc-paste’).value.trim().split(‘\n’);
const mat = lines.map(line => line.trim().split(/[\s,]+/).map(Number));
if (!mat.length || mat.some(row => row.length !== mat[0].length)) {
alert(‘Invalid matrix format. Ensure rows have same number of columns.’);
return;
}
document.getElementById(‘csc-rows’).value = mat.length;
document.getElementById(‘csc-cols’).value = mat[0].length;
buildInputTable(mat.length, mat[0].length);
mat.forEach((row, i) => row.forEach((val, j) => {
document.querySelector(`.csc-cell[data-row=”${i}”][data-col=”${j}”]`).value = val;
}));
document.getElementById(‘csc-results’).innerHTML = ”;
};// initialize default
buildInputTable(3, 3);