Orthonormal bases simplify projections, least squares and coordinate changes. The Gram–Schmidt process builds one from any set of vectors and is the basis of the QR decomposition.
How to use the Gram-Schmidt Calculator
- Number of vectors
- Number of coordinates
- v₁: x
- v₁: y
- v₁: z
- v₁: w
- v₂: x
- v₂: y
- v₂: z
- v₂: w
- v₃: x
- v₃: y
- v₃: z
- v₃: w
- v₄: x
- v₄: y
- v₄: z
- v₄: w
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Each vector has its components along the previous orthonormal vectors removed; what is left is normalised. Vectors that are combinations of earlier ones leave nothing and are dropped.
Formula
u₁ = v₁, uₖ = vₖ − Σⱼ (vₖ·eⱼ) eⱼ, eₖ = uₖ / ‖uₖ‖
Worked example
Inputs — Number of vectors: 3; Number of coordinates: 3; v₁: x: 1; v₁: y: 1; v₁: z: 0; v₂: x: 1; v₂: y: 0; v₂: z: 1; v₃: x: 0; v₃: y: 1; v₃: z: 1.
Results — Orthonormal basis = e₁ = (0.707107, 0.707107, 0)
e₂ = (0.408248, −0.408248, 0.816497)
e₃ = (−0.57735, 0.57735, 0.57735); Orthogonal vectors = u₁ = (1, 1, 0)
u₂ = (1/2, −1/2, 1)
u₃ = (−2/3, 2/3, 2/3); Steps = u₁ = (1, 1, 0), ‖u‖ = 1.4142136
u₂ = (0.5, −0.5, 1), ‖u‖ = 1.2247449
u₃ = (−0.666667, 0.666667, 0.666667), ‖u‖ = 1.1547005; Dimension of the span = 3.
Key terms
- Orthonormal
- Mutually perpendicular unit vectors.
Frequently asked questions
What does Gram–Schmidt do?
Converts a set of vectors into an orthonormal set with the same span.
What if the vectors are dependent?
Dependent vectors produce zero and are discarded.
Is the result unique?
It depends on the order of the input vectors.
Is it numerically stable?
The modified Gram–Schmidt version (used here) is more stable than the classical one.