# Gram-Schmidt Calculator

URL: https://speedycalculator.com/calculators/math/gram-schmidt/
Last updated: 2026-10-30

> The Gram–Schmidt calculator turns up to four vectors (with up to four coordinates) into an orthogonal set and an orthonormal basis of the space they span.

## Inputs

- 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

## Results

- Orthonormal basis
- Orthogonal vectors
- Steps
- Dimension of the span

## Formula

```
u₁ = v₁,  uₖ = vₖ − Σⱼ (vₖ·eⱼ) eⱼ,  eₖ = uₖ / ‖uₖ‖
```

## Explanation

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.

## 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.

## FAQ

**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.


## Sources

- [Wolfram MathWorld – Gram-Schmidt orthonormalization](https://mathworld.wolfram.com/Gram-SchmidtOrthonormalization.html)
- [MIT OpenCourseWare – 18.06 Linear Algebra (Gilbert Strang)](https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/)
- [Jim Hefferon – Linear Algebra (free textbook)](https://hefferon.net/linearalgebra/)
