Gram Schmidt Calculator

Turn 2–3 vectors into an orthonormal basis with the Gram–Schmidt steps shown.

100% FreeNo sign-upPrivate — runs in your browser

Vectors live in 3D space (x, y, z). The result is an orthonormal set: each vector has length 1 and is perpendicular to the others.

—

first orthonormal vector e1

Second vector e2
—
Third vector e3
—
If 3 vectors given

Copied to clipboard

How to use this tool

1
Enter the vectors

Type two or three vectors in 3D, one component per box. Switch to 3 vectors if you have a third.

2
Check independence

The vectors must not be multiples of each other — a dependent set has no orthonormal basis and the calculator says so.

3
Read the basis

The orthonormal vectors e1, e2 (and e3) appear in the results, each of length 1 and perpendicular to the rest.

4
Follow the steps

The step list shows each projection subtracted and each normalisation, so you can reproduce the working by hand.

Formula & worked example

For vectors v1, v2, v3: u1 = v1, e1 = u1 ÷ |u1|; u2 = v2 − (v2·e1)e1, e2 = u2 ÷ |u2|; u3 = v3 − (v3·e1)e1 − (v3·e2)e2, e3 = u3 ÷ |u3|. The result is orthonormal: ei·ej = 0 for i ≠ j and |ei| = 1.

For v1 = (1, 1, 0) and v2 = (1, 0, 1): e1 = (0.7071, 0.7071, 0). Subtracting the projection of v2 onto e1 leaves (0.5, −0.5, 1), which normalises to e2 = (0.4082, −0.4082, 0.8165). Their dot product is 0, as required.

Limitations — read this before you rely on it

This calculator works in 3D only (vectors with x, y, z components). It uses floating-point arithmetic, so components are rounded to 4 decimals and tiny residuals (~10⁻¹⁶) may appear in dot products. A dependent or zero vector set cannot be orthogonalised and returns an error rather than a fabricated basis.

Frequently asked questions

Ortho = perpendicular, normal = unit length. An orthonormal set is a set of mutually perpendicular vectors that each have length 1.

Orthonormal bases simplify projections, least-squares fits, QR decomposition and computer graphics — coordinates in such a basis are just dot products.

Then one vector adds no new direction, and Gram–Schmidt hits a zero vector when it tries to remove all known directions. Replace the dependent vector.

Yes — e1 always points along v1, so reordering the inputs gives a different (but equally valid) orthonormal basis for the same space.

In 3D space at most 3 vectors can be independent, so a fourth would always be dependent. Higher dimensions need a general implementation.