Gram-Schmidt Orthogonalization

Compute orthogonal1 and orthonormal2 bases using the Gram-Schmidt process3.
Enter matrix dimensions \(m \times n\), generate input matrix \(A\), fill values, and calculate. Columns of \(A\) are the vectors. If linearly dependent, a subset will be used.

The Gram-Schmidt process converts a set of linearly independent vectors into an orthogonal (or orthonormal) set that spans the same subspace.

Algorithm:

Starting with vectors \(\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_n\):

  • \(\mathbf{u}_1 = \mathbf{v}_1\)
  • \(\mathbf{u}_k = \mathbf{v}_k - \sum_{j=1}^{k-1} \frac{\mathbf{v}_k \cdot \mathbf{u}_j}{\mathbf{u}_j \cdot \mathbf{u}_j} \mathbf{u}_j\) (orthogonal vectors)
  • \(\mathbf{e}_k = \frac{\mathbf{u}_k}{\|\mathbf{u}_k\|}\) (orthonormal vectors)

Applications:

  • QR decomposition: \(A = QR\) where \(Q\) has orthonormal columns
  • Solving least squares problems
  • Finding orthonormal bases for subspaces

This calculator uses exact arithmetic via a custom Fraction class and displays results using surd notation4 when possible.

Set matrix dimensions

Enter dimensions and click Generate Matrix to create the input grid.

1 — Set Up
Loads a pre-filled 3×3 matrix — ready to orthogonalize.
2 — Compute
Applies the Gram–Schmidt process step-by-step to produce orthogonal and orthonormal bases.
Resets all dimensions, matrix entries, and results.