Gram-Schmidt Calculator

Select the number of coordinates for the vectors.
Input each vector as an array, separated by commas. Example: [1,2], [3,4]

A Gram-Schmidt Calculator is a mathematical tool used to perform the Gram-Schmidt orthogonalization process.

This process transforms a set of linearly independent vectors into an orthogonal or orthonormal set of vectors.

Gram-Schmidt Example Chart

StepVectorCalculationResult
1u₁v₁(1, 1, 0)
2e₁u₁ / ‖u₁‖(1/√2, 1/√2, 0)
3u₂v₂ – proj_u₁(v₂)(-1, 1, 0)
4e₂u₂ / ‖u₂‖(-1/√2, 1/√2, 0)
5u₃v₃ – proj_u₁(v₃) – proj_u₂(v₃)(0, 0, 2)
6e₃u₃ / ‖u₃‖(0, 0, 1)

Gram-Schmidt Formula

The Gram-Schmidt Formula for orthogonalization is:

  1. u₁ = v₁
  2. u₂ = v₂ – proj_u₁(v₂)
  3. u₃ = v₃ – proj_u₁(v₃) – proj_u₂(v₃) …

Where proj_u(v) is the projection of v onto u, given by:

proj_u(v) = (v · u / u · u) * u

Let’s orthogonalize the vectors v₁ = (1, 1, 0), v₂ = (0, 1, 0), and v₃ = (0, 1, 1).

  1. u₁ = v₁ = (1, 1, 0)
  2. u₂ = v₂ – proj_u₁(v₂) = (0, 1, 0) – ((0, 1, 0) · (1, 1, 0) / (1, 1, 0) · (1, 1, 0)) (1, 1, 0) = (0, 1, 0) – (1/2) (1, 1, 0) = (-1/2, 1/2, 0)
  3. u₃ = v₃ – proj_u₁(v₃) – proj_u₂(v₃) = (0, 1, 1) – (1/2) (1, 1, 0) – (1/3) (-1/2, 1/2, 0) = (-1/2, 1/6, 1)

The resulting orthogonal set is {(1, 1, 0), (-1/2, 1/2, 0), (-1/2, 1/6, 1)}.

Gram-Schmidt Process

The Gram-Schmidt process takes a finite, linearly independent set of vectors S = {v₁, …, vₖ} and generates an orthogonal set S’ = {u₁, …, uₖ} that spans the same k-dimensional subspace of Rⁿ as S.

The process works as follows:

  1. Start with the first vector: u₁ = v₁
  2. For each subsequent vector vᵢ (i = 2, …, k): a. Subtract from vᵢ its projection onto each of the previous orthogonalized vectors uj (j = 1, …, i-1) b. The result is the next orthogonal vector uᵢ

Mathematically, this is expressed as:

uᵢ = vᵢ - Σ(j=1 to i-1) proj_uj(vᵢ)

Where proj_u(v) = (v · u / u · u) * u

Let’s apply the Gram-Schmidt process to the vectors v₁ = (1, 0, 1), v₂ = (1, 1, 0), and v₃ = (1, 1, 1) in R³.

  1. u₁ = v₁ = (1, 0, 1)
  2. u₂ = v₂ – proj_u₁(v₂) = (1, 1, 0) – ((1, 1, 0) · (1, 0, 1) / (1, 0, 1) · (1, 0, 1)) (1, 0, 1) = (1, 1, 0) – (1/2) (1, 0, 1) = (1/2, 1, -1/2)
  3. u₃ = v₃ – proj_u₁(v₃) – proj_u₂(v₃) = (1, 1, 1) – (2/2) (1, 0, 1) – (1/3) (1/2, 1, -1/2) = (0, 1, 0) – (1/6, 1/3, -1/6) = (-1/6, 2/3, 1/6)

The resulting orthogonal set is {(1, 0, 1), (1/2, 1, -1/2), (-1/6, 2/3, 1/6)}.

Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *