Gram-Schmidt Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter three linearly independent vectors in 3D to get the orthogonal vectors u₁, u₂, u₃ and the orthonormal vectors e₁, e₂, e₃ of the Gram-Schmidt process.
Result
e₁ x (v₁ normalized)
e₁ y (v₁ normalized)
- e₁ z (v₁ normalized)
- e₂ x (u₂ normalized)
- e₂ y (u₂ normalized)
- e₂ z (u₂ normalized)
- e₃ x (u₃ normalized)
- e₃ y (u₃ normalized)
- e₃ z (u₃ normalized)
- u₂ x = v₂ − (v₂·e₁)e₁
- u₂ y = v₂ − (v₂·e₁)e₁
- u₂ z = v₂ − (v₂·e₁)e₁
- u₃ x = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂
- u₃ y = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂
- u₃ z = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- v₁: x: enter a number.
- v₁: y: enter a number.
- v₁: z: enter a number.
- v₂: x: enter a number.
- v₂: y: enter a number.
- v₂: z: enter a number.
- v₃: x: enter a number.
- v₃: y: enter a number.
- v₃: z: enter a number.
- Read the result: e₁ x (v₁ normalized); the panel also shows e₁ y (v₁ normalized), e₁ z (v₁ normalized), u₂ x = v₂ − (v₂·e₁)e₁, u₂ y = v₂ − (v₂·e₁)e₁, u₂ z = v₂ − (v₂·e₁)e₁, e₂ x (u₂ normalized), e₂ y (u₂ normalized), e₂ z (u₂ normalized), u₃ x = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂, u₃ y = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂, u₃ z = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂, e₃ x (u₃ normalized), e₃ y (u₃ normalized) and e₃ z (u₃ normalized).
How this calculator works
The Gram-Schmidt process builds orthogonal vectors one by one: u₁ = v₁; u₂ = v₂ − proj(v₂ on u₁); u₃ = v₃ − proj(v₃ on u₁) − proj(v₃ on u₂). Each uₖ is then divided by its length to give the unit vector eₖ = uₖ / |uₖ|.
With unit vectors, the projection of v on eₖ is (v · eₖ) eₖ, which is what the calculator subtracts. If the vectors are linearly dependent, some uₖ is the zero vector and its unit vector cannot be formed (shown as —).
The formula
| Symbol | Meaning |
|---|---|
| v₁: x | |
| v₁: y | |
| v₁: z | |
| e₁ x (v₁ normalized) |
Worked example
| 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 |
| u₂ x = v₂ − (v₂·e₁)e₁ | 0.5 |
|---|---|
| e₂ x (u₂ normalized) | 0.4082 |
| u₃ x = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂ | -0.6667 |
| e₃ x (u₃ normalized) | -0.5774 |
| e₁ y (v₁ normalized) | 0.7071 |
| u₂ y = v₂ − (v₂·e₁)e₁ | -0.5 |
| e₂ y (u₂ normalized) | -0.4082 |
| u₃ y = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂ | 0.6667 |
| e₃ y (u₃ normalized) | 0.5774 |
| e₁ z (v₁ normalized) | 0 |
| u₂ z = v₂ − (v₂·e₁)e₁ | 1 |
| e₂ z (u₂ normalized) | 0.8165 |
| u₃ z = v₃ − (v₃·e₁)e₁ − (v₃·e₂)e₂ | 0.6667 |
| e₃ z (u₃ normalized) | 0.5774 |
e₁ x (v₁ normalized) 0.7071
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What does the Gram-Schmidt process do?
It turns a set of linearly independent vectors into orthonormal vectors (perpendicular, each of length 1) that span the same space.
What is e₁ for v₁ = (1, 1, 0)?
v₁ divided by its length √2: (0.7071, 0.7071, 0).