Steply

Orthogonal basis from (1, 0, 1), (1, 1, 0), (0, 1, 1)

Step by step, with the reason for every step · Gram-Schmidt · Linear Algebra

Step by step

The question

Question: make (1, 0, 1), (1, 1, 0) and (0, 1, 1) orthogonal, with Gram-Schmidt.

v1 = [1; 0; 1], v2 = [1; 1; 0], v3 = [0; 1; 1]

We want new vectors u₁, u₂ and u₃, each at a right angle to the others, that make the same vectors as the old ones.

The idea: take away from each vector the parts along the earlier ones.

goal: u1, u2, u3 at right angles
(dot products 0), the same span

1 Keep the first

The first one stays: u₁ = v₁.

u1 = v1 = [1; 0; 1]

2 Make the second one perpendicular

u₂ is v₂ with its part along u₁ taken away.

u2 = v2 − proj on u1

The part along u₁, as in the projection lesson.

The top: v₂ • u₁.

v2 • u1 = 1 × 1 + 1 × 0 + 0 × 1 = 1 + 0 + 0 = 1

The bottom: u₁ • u₁.

u1 • u1 = 1 × 1 + 0 × 0 + 1 × 1 = 1 + 0 + 1 = 2

So the number is 1/2.

number = 12

Times u₁: every entry times 1/2.

The projection is (1/2, 0, 1/2).

proj on u1 = 12 × [1; 0; 1] = [1 over 2; 0; 1 over 2]

So u₂ is v₂ minus the projection.

u2 = [1; 1; 0] − [1 over 2; 0; 1 over 2]

Entry by entry: (1/2, 1, −1/2).

u2 = [1 over 2; 1; −1 over 2]

To clear the fractions, we multiply it by 2.

Same direction, still at a right angle.

u2 = [1; 2; −1]

3 Make the third one perpendicular

u₃ is v₃ with its parts along u₁ and u₂ taken away.

u3 = v3 − proj on u1 − proj on u2

Careful!

We project onto the new vectors u₁ and u₂, not onto the old ones.

Careful: project on the NEW u1, u2, not on v1, v2

The part along u₁, as in the projection lesson.

The top: v₃ • u₁.

v3 • u1 = 0 × 1 + 1 × 0 + 1 × 1 = 0 + 0 + 1 = 1

The bottom: u₁ • u₁.

u1 • u1 = 1 × 1 + 0 × 0 + 1 × 1 = 1 + 0 + 1 = 2

So the number is 1/2.

number = 12

Times u₁: every entry times 1/2.

The projection is (1/2, 0, 1/2).

proj on u1 = 12 × [1; 0; 1] = [1 over 2; 0; 1 over 2]

Now the part along u₂.

The top: v₃ • u₂.

v3 • u2 = 0 × 1 + 1 × 2 + 1 × (−1) = 0 + 2 − 1 = 1

The bottom: u₂ • u₂.

u2 • u2 = 1 × 1 + 2 × 2 + (−1) × (−1) = 1 + 4 + 1 = 6

So the number is 1/6.

number = 16

Times u₂: every entry times 1/6.

The projection is (1/6, 1/3, −1/6).

proj on u2 = 16 × [1; 2; −1] = [1 over 6; 1 over 3; −1 over 6]

So u₃ is v₃ minus both projections.

u3 = [0; 1; 1] − [1 over 2; 0; 1 over 2] − [1 over 6; 1 over 3; −1 over 6]

Entry by entry: (−2/3, 2/3, 2/3).

u3 = [−2 over 3; 2 over 3; 2 over 3]

To clear the fractions, we multiply it by 3/2.

Same direction, still at a right angle.

u3 = [−1; 1; 1]

So the orthogonal vectors are u₁ = (1, 0, 1), u₂ = (1, 2, −1) and u₃ = (−1, 1, 1).

= u1 = [1; 0; 1], u2 = [1; 2; −1], u3 = [−1; 1; 1]

4 Check

Let's check: every pair must have dot product 0.

u₁ • u₂.

u1 • u2 = 1 × 1 + 0 × 2 + 1 × (−1) = 1 + 0 − 1 = 0

u₁ • u₃.

u1 • u3 = 1 × (−1) + 0 × 1 + 1 × 1 = −1 + 0 + 1 = 0

u₂ • u₃.

u2 • u3 = 1 × (−1) + 2 × 1 + (−1) × 1 = −1 + 2 − 1 = 0

Every dot product is 0: the vectors are at right angles.

So the answer is right!

Let's look back.

First: keep the first.

Then: make the second one perpendicular.

Then: make the third one perpendicular.

Last: check.

Answer
= u1 = [1; 0; 1], u2 = [1; 2; −1], u3 = [−1; 1; 1]

Your turn

Try this one yourself, then check:

Gram-Schmidt on [1; 2; 1], [3; 1; 1], [2; 2; 1]
Show the answer
u1 = [1; 2; 1], u2 = [2; −1; 0], u3 = [1; 2; −5]

More from Gram-Schmidt

The whole lesson: Gram-Schmidt →