On this page
The Gram–Schmidt process turns vectors that lean on each other at awkward angles into an orthonormal set spanning the same space: keep the first vector, remove from each later one every part along the vectors already fixed, then scale everything to length 1. Below is the whole process on (1,1,0), (1,0,1) and (0,1,1), with every line of arithmetic shown.
What does the Gram–Schmidt process actually do?
The Gram–Schmidt process is a method for constructing an orthonormal basis from a set of linearly independent vectors in an inner product space, such as ordinary 3D space (Wikipedia: Gram–Schmidt process). The vectors it produces span the same subspace as the ones you started with. Orthonormal means every pair is perpendicular and every vector has length 1.
Why bother? In an orthonormal basis, a vector's coordinate along e₁ is just its dot product with e₁, so you never solve simultaneous equations to find components. MIT OpenCourseWare's page for Gilbert Strang's 18.06 Lecture 17 puts it in one line: "Many calculations become simpler when performed using orthonormal vectors or orthogonal matrices" (MIT OpenCourseWare 18.06, Lecture 17).
How do you subtract a projection?
The projection of v onto u is (v·u / u·u) u, the orthogonal projection of v onto the line through u (Wikipedia: Gram–Schmidt process). It is the Class 12 idea of the component of one vector along another.
What is left over, v minus its projection, is perpendicular to u. Check: its dot product with u is v·u − (v·u / u·u)(u·u) = 0. The whole process is that one move, repeated:
Set u₁ = v₁.
Set u₂ = v₂ minus the projection of v₂ onto u₁.
Set u₃ = v₃ minus the projection of v₃ onto u₁, minus the projection of v₃ onto u₂.
Divide each u by its length to get e₁, e₂, e₃.
A full 3D worked example: (1,1,0), (1,0,1), (0,1,1)
Take v₁ = (1,1,0), v₂ = (1,0,1) and v₃ = (0,1,1).
Step 1. u₁ = (1,1,0), and u₁·u₁ = 2.
Step 2. v₂·u₁ = 1, so the projection is (1/2)(1,1,0). Then u₂ = (1,0,1) − (1/2, 1/2, 0) = (1/2, −1/2, 1), and u₂·u₂ = 1/4 + 1/4 + 1 = 3/2.
Step 3. v₃·u₁ = 1, giving (1/2, 1/2, 0). Next, v₃·u₂ = 0 − 1/2 + 1 = 1/2, giving (1/2 ÷ 3/2)u₂ = (1/3)u₂ = (1/6, −1/6, 1/3). So u₃ = (0,1,1) − (1/2, 1/2, 0) − (1/6, −1/6, 1/3) = (−2/3, 2/3, 2/3), with u₃·u₃ = 4/3.
Step 4. Normalise: e₁ = (1,1,0)/√2, e₂ = (1,−1,2)/√6, e₃ = (−1,1,1)/√3.
Now check. e₁·e₂ = (1 − 1 + 0)/√12 = 0. e₁·e₃ = (−1 + 1 + 0)/√6 = 0. e₂·e₃ = (−1 − 1 + 2)/√18 = 0. Each has length 1; for e₂, (1 + 1 + 4)/6 = 1.
How is Gram–Schmidt linked to QR decomposition?
Applying the Gram–Schmidt process to the columns of a full-column-rank matrix gives its QR decomposition, a product of an orthogonal matrix and a triangular matrix (Wikipedia: Gram–Schmidt process). Put v₁, v₂, v₃ as the columns of A, and e₁, e₂, e₃ as the columns of Q. Because v₁ uses only e₁, v₂ uses only e₁ and e₂, and v₃ uses all three, R = QᵀA is upper triangular. Its entries are dot products you have already met:
Row 1: e₁·v₁ = √2, e₁·v₂ = 1/√2, e₁·v₃ = 1/√2
Row 2: 0, e₂·v₂ = 3/√6, e₂·v₃ = 1/√6
Row 3: 0, 0, e₃·v₃ = 2/√3
So A = QR. A free check: the determinant of A is 1(0 − 1) − 1(1 − 0) + 0 = −2, and the product of R's diagonal is √2 × 3/√6 × 2/√3 = 2, the same size. The minus sign belongs to Q, whose columns here form a left-handed set.
One warning for later: on a computer, rounding errors make the classical process lose orthogonality, so it is called numerically unstable; modified Gram–Schmidt gives the same result in exact arithmetic with smaller errors in finite precision (Wikipedia: Gram–Schmidt process).
Which Gram–Schmidt mistakes cost the most marks?
Projecting v₃ onto v₂ instead of u₂. Try it: you get (−1, 1/2, 1/2), whose dot product with u₂ is −1/4, not zero.
Dividing by the length of u instead of u·u in the projection. If you work with unit vectors, the projection becomes (v·e)e, with nothing to divide.
Ignoring a zero vector. If some u comes out as zero, your starting vectors were linearly dependent; checking the rank of the matrix with echelon form tells you that before you start.
If you get stuck on which projection goes where, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer. To revisit dot products and projections themselves, the Fermi Concept Library covers concepts across physics, chemistry, biology, mathematics and computing.
Orthogonal bases return when you study eigenvectors; a good next read is our guide to eigenvalues of a 2×2 matrix.



