The Three-Vector Construction
Gram–Schmidt turns an ordered list of independent vectors into an orthonormal list by removing, one at a time, the components already accounted for. For three independent vectors in \(\mathbb{R}^3\), the first vector determines a direction; the second is adjusted to be perpendicular to that direction; and the third is adjusted to be perpendicular to both directions already obtained. Normalizing each nonzero result gives vectors of length \(1\).
All vectors here are columns in \(\mathbb{R}^3\), with the standard dot product \(\mathbf{x}\cdot\mathbf{y}=\mathbf{x}^{\top}\mathbf{y}\) and norm \(\|\mathbf{x}\|=\sqrt{\mathbf{x}\cdot\mathbf{x}}\). An ordered list is orthonormal when every vector has norm \(1\) and distinct vectors in the list have dot product \(0\). The order of the inputs matters: each subtraction uses the orthonormal vectors produced earlier in that order.
The coefficient \(\mathbf{v}\cdot\mathbf{q}\) is the amount of a vector \(\mathbf{v}\) in the direction of a unit vector \(\mathbf{q}\). In the third step, both earlier directions must be removed, using the original \(\mathbf{v}_3\) in each coefficient. The calculations below display both subtractions explicitly rather than combining them into a single unexplained result.
Why the Subtractions Remove the Earlier Directions
Proof. Take the dot product of the displayed expression for \(\mathbf{r}\) with \(\mathbf{q}_1\). Bilinearity of the dot product and the equalities \(\mathbf{q}_1\cdot\mathbf{q}_1=1\), \(\mathbf{q}_2\cdot\mathbf{q}_1=0\) give $$ \mathbf{r}\cdot\mathbf{q}_1 =\mathbf{v}\cdot\mathbf{q}_1-(\mathbf{v}\cdot\mathbf{q}_1)(1)-(\mathbf{v}\cdot\mathbf{q}_2)(0)=0. $$ Taking the dot product with \(\mathbf{q}_2\), and using \(\mathbf{q}_1\cdot\mathbf{q}_2=0\), \(\mathbf{q}_2\cdot\mathbf{q}_2=1\), gives $$ \mathbf{r}\cdot\mathbf{q}_2 =\mathbf{v}\cdot\mathbf{q}_2-(\mathbf{v}\cdot\mathbf{q}_1)(0)-(\mathbf{v}\cdot\mathbf{q}_2)(1)=0. $$ Thus the residual is orthogonal to each of the two earlier vectors. \(\square\)
Proof. For each \(i\), \(\|\mathbf{x}_i/\|\mathbf{x}_i\|\|=1\), since \(\|\mathbf{x}_i\|>0\). For distinct \(i,j\), $$ \frac{\mathbf{x}_i}{\|\mathbf{x}_i\|}\cdot \frac{\mathbf{x}_j}{\|\mathbf{x}_j\|} =\frac{\mathbf{x}_i\cdot\mathbf{x}_j}{\|\mathbf{x}_i\|\|\mathbf{x}_j\|}. $$ The denominator is positive. Therefore the normalized vectors have dot product \(0\) exactly when \(\mathbf{x}_i\cdot\mathbf{x}_j=0\). This proves both directions: orthogonality of the original list gives orthonormality after normalization, and orthonormality of the normalized list implies orthogonality of the original vectors. \(\square\)
Worked Calculation: Three Independent Inputs
Worked Example: Two Successive Subtractions
Apply Gram–Schmidt to \(\mathbf{v}_1=(1,1,0)\), \(\mathbf{v}_2=(1,0,1)\), and \(\mathbf{v}_3=(0,1,1)\), in that order.
First, the vectors are independent: the determinant of the matrix with these columns is \(\det\begin{bmatrix}1&1&0\\1&0&1\\0&1&1\end{bmatrix}=-2\ne0\). Set \(\mathbf{u}_1=\mathbf{v}_1=(1,1,0)\). Its squared norm is \(1^2+1^2+0^2=2\), so \(\|\mathbf{u}_1\|=\sqrt{2}\) and \(\mathbf{q}_1=(1,1,0)/\sqrt{2}\).
For the second vector, its coefficient along \(\mathbf{q}_1\) is \(\mathbf{v}_2\cdot\mathbf{q}_1=(1+0+0)/\sqrt{2}=1/\sqrt{2}\). The component to subtract is therefore \((1/\sqrt{2})\mathbf{q}_1=(1/2,1/2,0)\), giving
Its squared norm is \(1/4+1/4+1=3/2\), so its norm is \(\sqrt{6}/2\). Dividing each entry by that norm gives \(\mathbf{q}_2=(1,-1,2)/\sqrt{6}\).
For the third vector, first remove its component along \(\mathbf{q}_1\). The coefficient is \(\mathbf{v}_3\cdot\mathbf{q}_1=1/\sqrt{2}\), and that component is \((1/2,1/2,0)\). Next compute its coefficient along \(\mathbf{q}_2\): \(\mathbf{v}_3\cdot\mathbf{q}_2=(0-1+2)/\sqrt{6}=1/\sqrt{6}\). The second component is \((1/\sqrt{6})\mathbf{q}_2=(1,-1,2)/6\). Subtract both components:
The squared norm of \(\mathbf{u}_3\) is \(4/9+4/9+4/9=4/3\), so \(\|\mathbf{u}_3\|=2/\sqrt{3}\). Normalizing gives \(\mathbf{q}_3=(-1,1,1)/\sqrt{3}\).
Check: The squared lengths of \(\mathbf{q}_1,\mathbf{q}_2,\mathbf{q}_3\) are respectively \(2/2=1\), \(6/6=1\), and \(3/3=1\). Their pairwise dot products are \[ \mathbf{q}_1\cdot\mathbf{q}_2=\frac{1-1+0}{\sqrt{12}}=0,\quad \mathbf{q}_1\cdot\mathbf{q}_3=\frac{-1+1+0}{\sqrt{6}}=0,\quad \mathbf{q}_2\cdot\mathbf{q}_3=\frac{-1-1+2}{\sqrt{18}}=0. \] Thus the final list is orthonormal.
A Second Exact Calculation
Worked Example: A Different Set of Directions
Use Gram–Schmidt on \(\mathbf{v}_1=(1,0,1)\), \(\mathbf{v}_2=(1,1,0)\), \(\mathbf{v}_3=(0,1,1)\). The determinant of the matrix with these columns is \(2\), so the inputs are independent.
The first vector has norm \(\sqrt{2}\), giving \(\mathbf{q}_1=(1,0,1)/\sqrt{2}\). Since \(\mathbf{v}_2\cdot\mathbf{q}_1=1/\sqrt{2}\), subtract its component \((1/2,0,1/2)\): $$ \mathbf{u}_2=(1,1,0)-\left(\frac12,0,\frac12\right) =\left(\frac12,1,-\frac12\right). $$ Here \(\|\mathbf{u}_2\|^2=1/4+1+1/4=3/2\), so \(\mathbf{q}_2=(1,2,-1)/\sqrt{6}\).
For \(\mathbf{v}_3\), the coefficient along \(\mathbf{q}_1\) is \(1/\sqrt{2}\), giving component \((1/2,0,1/2)\). Its coefficient along \(\mathbf{q}_2\) is \((0+2-1)/\sqrt{6}=1/\sqrt{6}\), giving component \((1,2,-1)/6\). Consequently,
Check: Each \(\mathbf{q}_i\) has squared norm \(1\). The pairwise dot products have numerators \(1+0-1=0\), \(-1+0+1=0\), and \(-1+2-1=0\), respectively, over nonzero denominators. Hence these three outputs are orthonormal.
The Order of the Inputs Matters
Gram–Schmidt starts by preserving the direction of the first input, so changing the order can change the resulting orthonormal list. This is not a failure: the new list still consists of mutually perpendicular unit vectors. The next example reorders the first set and carries out the same checks.
Worked Example: Reordering the Same Three Vectors
Use the order \(\mathbf{v}_1=(1,1,0)\), \(\mathbf{v}_2=(0,1,1)\), \(\mathbf{v}_3=(1,0,1)\). These are the same independent vectors as in the first example, with the last two exchanged.
The first normalized vector remains \(\mathbf{q}_1=(1,1,0)/\sqrt{2}\). Since \(\mathbf{v}_2\cdot\mathbf{q}_1=1/\sqrt{2}\), the first subtraction gives \(\mathbf{u}_2=(0,1,1)-(1/2,1/2,0)=(-1/2,1/2,1)\). Its squared norm is \(1/4+1/4+1=3/2\), so \(\mathbf{q}_2=(-1,1,2)/\sqrt{6}\).
For the last input, the first coefficient is \(\mathbf{v}_3\cdot\mathbf{q}_1=1/\sqrt{2}\), producing \((1/2,1/2,0)\). The second coefficient is \(\mathbf{v}_3\cdot\mathbf{q}_2=(-1+2)/\sqrt{6}=1/\sqrt{6}\), producing \((-1,1,2)/6\). Thus
Check: The three squared norms are \(1\). The pairwise dot-product numerators are \( -1+1+0=0\), \(1-1+0=0\), and \(-1-1+2=0\), so the list is orthonormal. Its second and third vectors differ from those in the first calculation, as expected from the changed order.
Common Mistake: Omitting the Denominator
When subtracting a projection onto a vector that is not a unit vector, the coefficient must include a denominator. In the first calculation, \(\mathbf{u}_2=(1/2,-1/2,1)\) has squared norm \(3/2\), not \(1\). Also, \(\mathbf{v}_3\cdot\mathbf{u}_2=1/2\). A mistaken calculation might subtract \((1/2)\mathbf{u}_2\) directly, as though \(\mathbf{u}_2\) were a unit vector.
That mistake gives $$ \left(0,1,1\right)-\left(\frac12,\frac12,0\right) -\frac12\left(\frac12,-\frac12,1\right) =\left(-\frac34,\frac34,\frac12\right). $$ But its dot product with \(\mathbf{u}_2\) is \((-3/8)+(-3/8)+1/2=-1/4\ne0\), so it has not removed the component in that direction. The correct coefficient for subtracting along \(\mathbf{u}_2\) is \((\mathbf{v}_3\cdot\mathbf{u}_2)/(\mathbf{u}_2\cdot\mathbf{u}_2)=(1/2)/(3/2)=1/3\). Alternatively, normalize first and use the coefficient \(\mathbf{v}_3\cdot\mathbf{q}_2\). The two approaches agree when the coefficient and vector are paired correctly.
A Reliable Check at the End
For three outputs, a complete orthonormality check has six pieces: three norm calculations and three pairwise dot products. The norms confirm that the vectors were normalized; the dot products confirm that each subtraction removed the intended earlier directions. Checking only that each output has norm \(1\) is insufficient, because unit vectors need not be perpendicular.
The calculation is also order-sensitive. The first output is set by the first input, the second is determined after removing its component along the first, and the third is determined after removing two components. Use the ordered inputs consistently, keep each residual visible, and normalize only after completing its subtractions. If the inputs are independent, the Gram–Schmidt process applies with nonzero residuals; in a specific calculation, the displayed residuals and their norms make that check concrete.
Check Your Understanding
For each calculation, keep the vectors as columns and show the residual before normalizing.
- For \((1,0,1)\), \((0,1,1)\), \((1,1,0)\), find the three Gram–Schmidt outputs and check all pairwise dot products.
- In the first worked example, calculate \(\mathbf{v}_3\cdot\mathbf{q}_2\) directly from the coordinates of \(\mathbf{v}_3\) and \(\mathbf{q}_2\).
- Why does the coefficient for subtracting a component along a unit vector have no additional denominator?
- Give all three norm checks needed to confirm that a list of three vectors has unit length.
- Explain why changing the input order can change the outputs without preventing them from being orthonormal.