Skip to content
AllCalcHub

Linear Algebra Calculator

Test vectors for linear independence, find a basis, orthogonalise by Gram–Schmidt, find the rank, nullity and null space of a matrix, and solve least-squares problems, all with exact fractions.

About the Linear Algebra Calculator

Vectors are linearly independent when none is a combination of the others; row-reducing the matrix with the vectors as rows shows which survive, and the non-zero rows form a basis of their span. Gram–Schmidt turns a basis into an orthogonal one: subtract from each vector its projections on the earlier ones, uₖ = vₖ − Σ (vₖ·uⱼ/uⱼ·uⱼ)uⱼ, then divide by the lengths for an orthonormal basis.

For an m × n matrix, rank + nullity = n: the rank counts pivot columns (a basis of the column space) and the nullity counts free variables (a basis of the null space, the solutions of Ax = 0). When Ax = b has no exact solution, the least-squares solution minimises |Ax − b| and solves the normal equations AᵀAx = Aᵀb.

The formula

uₖ = vₖ − Σ (vₖ·uⱼ / uⱼ·uⱼ) uⱼ; rank + nullity = n; AᵀA x̂ = Aᵀb

Orthonormal
eₖ = uₖ/|uₖ|
Residual
r = b − Ax̂, orthogonal to every column of A

Worked example

v₁ = (1, 1, 0), v₂ = (1, 0, 1), v₃ = (0, 1, 1)

  1. u₁ = (1, 1, 0)
  2. u₂ = v₂ − ½u₁ = (1/2, −1/2, 1)
  3. u₃ = v₃ − ½u₁ − ⅓u₂ = (−2/3, 2/3, 2/3)

Questions people ask

Why use the normal equations?

The best x makes the error b − Ax perpendicular to every column of A, which is exactly Aᵀ(b − Ax) = 0.

What does a determinant of zero mean?

The matrix is singular: its rows are linearly dependent, it has no inverse, and Ax = b has either no solution or infinitely many.