⊥ Gram-Schmidt Calculator

Gram-Schmidt Orthogonalization

The Gram-Schmidt process converts a set of linearly independent vectors into an orthonormal set, and this calculator performs each projection step with full working. Enter column vectors as a matrix — each column is one vector. Full step-by-step projection subtraction shown.

⊥

Gram-Schmidt Orthogonalization

Each column of the input matrix is treated as a vector

✓ Step-by-Step✓ Normalized✓ Free⚡ Loading precision engine…
ℹ Enter the input vectors as columns of the matrix. E.g., for 3 vectors in ℝ², enter a 2×3 matrix.
Input Vectors (columns)
Quick Examples

The Gram-Schmidt Process

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

Algorithm

  1. Start with v₁, v₂, ..., vₙ (the input vectors)
  2. Set u₁ = v₁
  3. For each vₖ: subtract projections onto all previous orthogonal vectors:
    $$\mathbf{u}_k = \mathbf{v}_k - \sum_{j=1}^{k-1} \frac{\langle \mathbf{v}_k, \mathbf{u}_j \rangle}{\langle \mathbf{u}_j, \mathbf{u}_j \rangle} \mathbf{u}_j$$
  4. Normalize: eₖ = uₖ / ‖uₖ‖

Applications

  • QR decomposition of matrices
  • Finding orthonormal bases for subspaces
  • Least squares problems
  • Signal processing and data science (PCA)

What It Actually Does

Gram-Schmidt takes a set of vectors (the columns of your matrix) and turns them into a new set of vectors that all point in perpendicular directions from each other, while still covering the same overall space as the originals.

Worked Example (2D)

For vectors v₁ = (1,1) and v₂ = (0,1): the first output vector u₁ equals v₁ = (1,1). The second, u₂, is v₂ with the "shadow" of u₁ removed, giving u₂ = (0.5,-0.5) — perpendicular to u₁.

Frequently Asked Questions

Orthogonal vectors make many calculations simpler and more numerically stable, since they don't overlap in the directions they describe. This is the foundation behind QR decomposition.
If a vector is a multiple of an earlier one, it contains no new independent direction, and the process will produce a zero vector at that step, signaling the vectors aren't independent.
They're closely related — Gram-Schmidt is one method used to compute a QR decomposition. The perpendicular vectors it produces become the columns of Q.

Related Calculators