Gram–Schmidt calculator

Enter a list of vectors and get the orthogonal vectors u₁, u₂, … of the Gram–Schmidt process as exact fractions, the orthonormal vectors e₁, e₂, … and their lengths. A vector that depends on the earlier ones is reported instead of breaking the result.

One vector per group, groups separated by semicolons, coordinates by spaces or commas: 1 1 0; 1 0 1. Fractions such as 1/2 work.
Orthogonal vectors uu1 = (1, 1, 0) u2 = (1/2, -1/2, 1) u3 = (-2/3, 2/3, 2/3)
Orthonormal vectors e = u / ‖u‖
e1 = (0.707107, 0.707107, 0) e2 = (0.408248, -0.408248, 0.816497) e3 = (-0.57735, 0.57735, 0.57735)
Lengths ‖u‖
‖u1‖ = 1.41421 ‖u2‖ = 1.22474 ‖u3‖ = 1.1547
Independent vectors (dimension of the span)
3

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type the vectors, one group per vector, separated by semicolons: 1 1 0; 1 0 1; 0 1 1.
  2. Choose whether the orthogonal vectors are shown as fractions or decimals.
  3. Read u₁, u₂, … (orthogonal), e₁, e₂, … (unit length) and the lengths.

How it works

The calculator keeps u₁ = v₁ and, for each next vector, subtracts its projection onto every earlier non-zero u:

uₖ = vₖ − Σ (vₖ·uⱼ / uⱼ·uⱼ) uⱼ

The projections use exact fractions, so the orthogonal vectors have no rounding error. Each orthonormal vector is eₖ = uₖ / ‖uₖ‖ with ‖uₖ‖ = √(uₖ·uₖ). If some uₖ comes out as the zero vector, vₖ was a combination of the earlier vectors; it is listed as dependent and skipped.

Worked example

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

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

The lengths are 1.41421, 1.22474 and 1.1547, and the orthonormal basis is e₁ = (0.707107, 0.707107, 0), e₂ = (0.408248, −0.408248, 0.816497), e₃ = (−0.57735, 0.57735, 0.57735).

Tips and common mistakes

  • Check orthogonality yourself: every pair of u vectors should have dot product 0.
  • Subtract the projection onto u (the new vectors), not onto the original v; that is the most common slip in hand calculations.
  • To get an orthonormal basis of the column space of a matrix, enter its columns as the vectors.

Frequently asked questions

What does the Gram–Schmidt process do?

It takes linearly independent vectors v₁, v₂, … and produces vectors u₁, u₂, … that span the same space and are pairwise perpendicular. Dividing each uₖ by its length gives an orthonormal basis e₁, e₂, …

What is the formula?

u₁ = v₁, and each next uₖ = vₖ minus its projections on the earlier u: uₖ = vₖ − Σ (vₖ·uⱼ / uⱼ·uⱼ) uⱼ. Then eₖ = uₖ / ‖uₖ‖.

Why are the orthonormal vectors decimals?

Lengths are usually square roots, such as √2 for (1, 1, 0), so the unit vectors are irrational. The orthogonal vectors stay exact fractions because the projections only divide by dot products.

Does the order of the vectors matter?

Yes. The first vector keeps its direction and each later one is adjusted against the earlier ones, so a different order gives a different, equally valid orthogonal basis of the same space.

More in Math

All tools in this category: Math ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.