The Two-Vector Construction
Gram–Schmidt begins with vectors that may point in overlapping directions and replaces them with orthogonal vectors that retain the same span. For two independent vectors, the calculation has a direct geometric interpretation: keep the direction of the first vector, then remove from the second vector exactly the part pointing along that first direction. The result is a nonzero residual perpendicular to the first vector. Normalizing the two perpendicular vectors produces an orthonormal pair.
We work over \(\mathbb{R}\) in a real inner product space. For vectors \(\mathbf{x},\mathbf{y}\), the inner product is written \(\langle\mathbf{x},\mathbf{y}\rangle\), and the norm is \(\|\mathbf{x}\|=\sqrt{\langle\mathbf{x},\mathbf{x}\rangle}\). In \(\mathbb{R}^n\) with the standard inner product, \(\langle\mathbf{x},\mathbf{y}\rangle=\mathbf{x}^{\top}\mathbf{y}\). A pair is orthonormal if each vector has norm \(1\) and their inner product is \(0\).
The construction requires \(\mathbf{v}_1\ne\mathbf{0}\), so that \(\mathbf{u}_1\) is defined. Linear independence guarantees this. It also guarantees that \(\mathbf{w}_2\ne\mathbf{0}\), so the final normalization is defined. The order matters: first subtract the component along \(\mathbf{u}_1\), then normalize what remains. If the second vector is normalized before its component is removed, that does not replace the subtraction step.
The scalar \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle\) is the coefficient of the component along the unit vector \(\mathbf{u}_1\). In particular, the vector being subtracted is \(\langle\mathbf{v}_2,\mathbf{u}_1\rangle\mathbf{u}_1\), not just the scalar coefficient. Since \(\mathbf{u}_1=\mathbf{v}_1/\|\mathbf{v}_1\|\), the same residual can be calculated directly from the original first vector:
This version can be convenient when the original vectors are given in coordinates. Its denominator is the squared norm of \(\mathbf{v}_1\), not the norm itself.
Why the Construction Works for Two Independent Vectors
Proof. Independence implies \(\mathbf{v}_1\ne\mathbf{0}\), so \(\|\mathbf{v}_1\|>0\) and \(\mathbf{u}_1\) is defined. Its norm is \(\|\mathbf{u}_1\|=\|\mathbf{v}_1\|/\|\mathbf{v}_1\|=1\). By the definition of the residual and the inner-product rules, \[ \langle\mathbf{w}_2,\mathbf{u}_1\rangle =\langle\mathbf{v}_2,\mathbf{u}_1\rangle -\langle\mathbf{v}_2,\mathbf{u}_1\rangle\langle\mathbf{u}_1,\mathbf{u}_1\rangle =0, \] because \(\langle\mathbf{u}_1,\mathbf{u}_1\rangle=1\). Thus the residual is orthogonal to \(\mathbf{u}_1\). If \(\mathbf{w}_2=\mathbf{0}\), then \(\mathbf{v}_2=\langle\mathbf{v}_2,\mathbf{u}_1\rangle\mathbf{u}_1\), so \(\mathbf{v}_2\) is a scalar multiple of \(\mathbf{u}_1\), and hence of \(\mathbf{v}_1\). That contradicts independence. Therefore \(\mathbf{w}_2\ne\mathbf{0}\), its norm is positive, and \(\mathbf{u}_2\) is defined. Scaling a nonzero vector to norm \(1\) gives \(\|\mathbf{u}_2\|=1\), and \(\langle\mathbf{u}_2,\mathbf{u}_1\rangle=\langle\mathbf{w}_2,\mathbf{u}_1\rangle/\|\mathbf{w}_2\|=0\). The output is orthonormal. For the span, \(\mathbf{u}_1=\mathbf{v}_1/\|\mathbf{v}_1\|\), so \(\mathbf{u}_1\) is in the span of the inputs and \(\mathbf{v}_1=\|\mathbf{v}_1\|\mathbf{u}_1\). Also, \(\mathbf{w}_2=\mathbf{v}_2-\langle\mathbf{v}_2,\mathbf{u}_1\rangle\mathbf{u}_1\) is in the span of the inputs, and \(\mathbf{u}_2=\mathbf{w}_2/\|\mathbf{w}_2\|\) is too. Thus the output span is contained in the input span. Conversely, \[ \mathbf{v}_2=\langle\mathbf{v}_2,\mathbf{u}_1\rangle\mathbf{u}_1 +\|\mathbf{w}_2\|\mathbf{u}_2. \] Both inputs are therefore in the output span, proving the reverse containment. \(\square\)
The proof gives practical checks for a calculation: the first output must have norm \(1\); the residual must have zero inner product with the first output; and the residual must not be zero when the inputs are independent. After normalizing the residual, the second output must also have norm \(1\). These checks catch arithmetic errors before the result is used.
Worked Calculations
Worked Example: A Pair in \(\mathbb{R}^2\)
Apply Gram–Schmidt to \(\mathbf{v}_1=(3,4)^{\top}\) and \(\mathbf{v}_2=(1,0)^{\top}\). First, \(\|\mathbf{v}_1\|=\sqrt{3^2+4^2}=5\), so \(\mathbf{u}_1=(3/5,4/5)^{\top}\). The component coefficient is \[ \langle\mathbf{v}_2,\mathbf{u}_1\rangle =(1)(3/5)+(0)(4/5)=3/5. \] The vector component is \((3/5)\mathbf{u}_1=(9/25,12/25)^{\top}\). Therefore \[ \mathbf{w}_2=(1,0)^{\top}-(9/25,12/25)^{\top} =(16/25,-12/25)^{\top}. \] Its norm is \[ \|\mathbf{w}_2\|=\sqrt{(16/25)^2+(-12/25)^2} =\sqrt{400/625}=4/5. \] Thus \(\mathbf{u}_2=\mathbf{w}_2/(4/5)=(4/5,-3/5)^{\top}\).
Check: \(\|\mathbf{u}_1\|^2=(9+16)/25=1\), \(\|\mathbf{u}_2\|^2=(16+9)/25=1\), and \(\langle\mathbf{u}_1,\mathbf{u}_2\rangle=(12-12)/25=0\). The inputs are recovered from the outputs: \(\mathbf{v}_1=5\mathbf{u}_1=(3,4)^{\top}\) and \(\mathbf{v}_2=(3/5)\mathbf{u}_1+(4/5)\mathbf{u}_2=(1,0)^{\top}\).
Worked Example: A Nonzero Projection in \(\mathbb{R}^3\)
Take \(\mathbf{v}_1=(1,1,0)^{\top}\) and \(\mathbf{v}_2=(2,0,1)^{\top}\). They are independent: if \(a\mathbf{v}_1+b\mathbf{v}_2=\mathbf{0}\), the third coordinate gives \(b=0\), and the second then gives \(a=0\). Since \(\|\mathbf{v}_1\|=\sqrt{2}\), \[ \mathbf{u}_1=\frac{1}{\sqrt{2}}(1,1,0)^{\top}. \] The coefficient along \(\mathbf{u}_1\) is \[ \langle\mathbf{v}_2,\mathbf{u}_1\rangle =\frac{2+0+0}{\sqrt{2}}=\sqrt{2}. \] Consequently the component to subtract is \(\sqrt{2}\mathbf{u}_1=(1,1,0)^{\top}\), giving \(\mathbf{w}_2=(1,-1,1)^{\top}\). Its norm is \(\sqrt{1+1+1}=\sqrt{3}\), so \(\mathbf{u}_2=(1,-1,1)^{\top}/\sqrt{3}\).
Check: \(\|\mathbf{u}_1\|^2=2/2=1\), \(\|\mathbf{u}_2\|^2=3/3=1\), and \(\langle\mathbf{u}_1,\mathbf{u}_2\rangle=(1-1+0)/\sqrt{6}=0\). Reconstruction gives \(\mathbf{v}_1=\sqrt{2}\mathbf{u}_1\) and \(\mathbf{v}_2=\sqrt{2}\mathbf{u}_1+\sqrt{3}\mathbf{u}_2 =(1,1,0)^{\top}+(1,-1,1)^{\top}=(2,0,1)^{\top}\).
Worked Example: Using the Formula with the Original First Vector
Let \(\mathbf{v}_1=(1,2,2)^{\top}\) and \(\mathbf{v}_2=(2,1,0)^{\top}\). Their independence follows, for example, because \(a\mathbf{v}_1+b\mathbf{v}_2=\mathbf{0}\) has third coordinate \(2a=0\), hence \(a=0\), and then \(b=0\). The first norm is \(3\), and \(\langle\mathbf{v}_2,\mathbf{v}_1\rangle=2+2+0=4\). The original-vector residual formula gives \[ \mathbf{w}_2=(2,1,0)^{\top}-\frac{4}{9}(1,2,2)^{\top} =(14/9,1/9,-8/9)^{\top}. \] Its norm is \[ \|\mathbf{w}_2\| =\frac{\sqrt{14^2+1^2+(-8)^2}}{9} =\frac{\sqrt{261}}{9} =\frac{\sqrt{29}}{3}. \] Therefore \[ \mathbf{u}_1=\frac{1}{3}(1,2,2)^{\top},\qquad \mathbf{u}_2=\frac{1}{3\sqrt{29}}(14,1,-8)^{\top}. \]
Check: The squared norm of \(\mathbf{u}_1\) is \(9/9=1\). For the second vector it is \((196+1+64)/(9\cdot29)=261/261=1\). Their inner product is \[ \langle\mathbf{u}_1,\mathbf{u}_2\rangle =\frac{14+2-16}{9\sqrt{29}}=0. \] Also, \(\mathbf{v}_1=3\mathbf{u}_1\), while \(\mathbf{v}_2=(4/3)\mathbf{u}_1+(\sqrt{29}/3)\mathbf{u}_2\); substituting the displayed vectors gives \((2,1,0)^{\top}\).
Common Mistake: Omitting the Denominator
A frequent error is to use the original vector \(\mathbf{v}_1\) in the projection formula as if it were already a unit vector. For example, let \(\mathbf{v}_1=(1,1)^{\top}\) and \(\mathbf{v}_2=(1,0)^{\top}\). A wrong calculation subtracts \(\langle\mathbf{v}_2,\mathbf{v}_1\rangle\mathbf{v}_1=(1,1)^{\top}\), producing the residual \((0,-1)^{\top}\). But this residual is not orthogonal to \(\mathbf{v}_1\), since \(\langle(0,-1),(1,1)\rangle=-1\ne0\). The mistake is that \(\mathbf{v}_1\) has squared norm \(2\), not \(1\).
The corrected calculation normalizes first, or equivalently divides by the squared norm in the original-vector formula. Here the coefficient is \(\langle\mathbf{v}_2,\mathbf{v}_1\rangle/\langle\mathbf{v}_1,\mathbf{v}_1\rangle=1/2\), so \[ \mathbf{w}_2=(1,0)^{\top}-\frac12(1,1)^{\top} =(1/2,-1/2)^{\top}. \] Now \(\langle\mathbf{w}_2,\mathbf{v}_1\rangle=1/2-1/2=0\), as required. Its norm is \(1/\sqrt{2}\), and its normalized version is \((1/\sqrt{2},-1/\sqrt{2})^{\top}\).
Reading the Output
The calculation separates the two original vectors into directions that do not overlap. The first output \(\mathbf{u}_1\) points along \(\mathbf{v}_1\). The second original vector splits as \[ \mathbf{v}_2=\langle\mathbf{v}_2,\mathbf{u}_1\rangle\mathbf{u}_1+\mathbf{w}_2. \] The first term lies along \(\mathbf{u}_1\); the second is perpendicular to it. Normalization changes lengths but not directions, so the final orthonormal pair spans exactly the same subspace as the inputs.
For two independent vectors, the calculation should be done in this order:
- Check that the first vector is nonzero and divide it by its norm.
- Take the inner product of the second vector with the first unit vector.
- Multiply that scalar by the first unit vector and subtract the resulting vector from the second input.
- Check that the residual is nonzero and perpendicular to the first unit vector.
- Divide the residual by its norm, then verify both output norms and their inner product.
The residual is not an arbitrary correction: it is the part of the second vector left after the first direction has been removed. Keeping track of the scalar coefficient and the vector being subtracted prevents a common mix-up. A complete answer should display both, since the coefficient alone is not the projected component.
Check Your Understanding
For each calculation, identify the first unit vector, the projection coefficient, and the residual before deciding how to normalize.
- Apply the two-vector construction to \((1,0)^{\top}\) and \((1,2)^{\top}\). Verify the resulting pair is orthonormal.
- For \(\mathbf{v}_1=(2,0,0)^{\top}\) and \(\mathbf{v}_2=(1,1,0)^{\top}\), compute \(\mathbf{u}_1\), \(\mathbf{w}_2\), and \(\mathbf{u}_2\).
- Explain why an independent pair cannot produce a zero residual.
- For \((1,1)^{\top}\) and \((1,0)^{\top}\), compute the residual using the original-vector formula and check its inner product with the first vector.
- State how the two original vectors can be recovered as combinations of the orthonormal outputs.