SOLVETUTORMATH SOLVER

Instrument MI-01-257 · Mathematics

Gram-Schmidt Calculator

Give this sheet two vectors and it strips away the part of the second that already points along the first, leaving a piece guaranteed to sit at a right angle to it.

Instrument MI-01-257
Sheet 1 OF 1
Rev A
Verified
Type 05 — Linear Algebra SER. 2026-01257

u₂: x (orthogonal to v₁)

-0.40000000

u₂ₓ = v₂ₓ − proj_v₁(v₂)ₓ

1.20000000 u₂: y (orthogonal to v₁)
The working Every figure verified twice
  1. u2x = 2 − (2·3 + 2·1) ⁄ (3^2 + 1^2)·3 = -0.40000000
  2. u2y = 2 − (2·3 + 2·1) ⁄ (3^2 + 1^2)·1 = 1.20000000
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Gram-Schmidt takes two vectors that merely point in different directions and turns them into a pair that meet at a perfect right angle, without changing the direction v₁ already points. The first vector is left alone — u₁ = v₁ — and all the correcting happens to the second: subtract from v₂ whatever piece of it already lies along v₁, and what remains is u₂, the part of v₂ that is genuinely new, sitting at 90° to the first.

The piece being removed is a projection: proj_v₁(v₂) = ((v₂·v₁) ⁄ (v₁·v₁)) v₁, the shadow v₂ casts onto the line through v₁. Subtracting a vector's own shadow from itself always leaves a remainder perpendicular to the line that shadow fell on — that is simply what a shadow is — so u₂ = v₂ − proj_v₁(v₂) is orthogonal to v₁ by construction, not by coincidence, and the dot product v₁·u₂ works out to exactly zero every time.

The process only earns its result if v₁ and v₂ point in genuinely different directions to begin with. Feed it a v₂ that is already a scaled copy of v₁ — say v₂ = 2v₁ — and there is no shadow to strip away short of the whole vector, so u₂ collapses to (0, 0): the calculation's honest way of reporting that the second vector added no new direction at all. The method is named for Jørgen Pedersen Gram and Erhard Schmidt, though Pierre-Simon Laplace and Augustin-Louis Cauchy used the same subtract-the-projection idea decades earlier; in two dimensions it is small enough to check by hand, and the identical rule scales unchanged to build orthogonal bases out of dozens of vectors at once.

u2x=v2xprojv1(v2)xu_{2x} = v_{2x} - \operatorname{proj}_{v_1}(v_2)_xu2y=v2yprojv1(v2)yu_{2y} = v_{2y} - \operatorname{proj}_{v_1}(v_2)_yprojv1(v2)=v2v1v1v1v1\operatorname{proj}_{v_1}(v_2) = \frac{v_2 \cdot v_1}{v_1 \cdot v_1}\, v_1
v₁ — the fixed reference vector (x = v₁: x, y = v₁: y) · v₂ — the vector being corrected (x = v₂: x, y = v₂: y) · proj_v₁(v₂) — the component of v₂ lying along v₁ · u₂ — v₂ with that component removed, perpendicular to v₁ by construction.
  • Enter the first vector's components into v₁: x and v₁: y — this is the direction that stays fixed and becomes u₁.
  • Enter the second vector's components into v₂: x and v₂: y — this is the vector that gets corrected.
  • Read u₂: x (orthogonal to v₁) and u₂: y (orthogonal to v₁) — together they are v₂ with its projection onto v₁ removed.
  • Check the result yourself: multiply matching components and add, v1x×u2x + v1y×u2y — a correct answer always lands on zero.
  • Set v₂ to any multiple of v₁ and watch u₂ fall to (0, 0), the sheet's way of flagging that no new direction was added.

Worked example — orthogonalizing (3, 1) and (2, 2)

Set v₁: x = 3, v₁: y = 1, v₂: x = 2, and v₂: y = 2. The dot product v₂·v₁ is 2×3 + 2×1 = 8, and v₁·v₁ is 3² + 1² = 10, so the projection's scale factor is 8 ⁄ 10 = 0.8. Scaling v₁ by 0.8 gives the shadow (2.4, 0.8), and subtracting that shadow from v₂ leaves u₂: x = 2 − 2.4 = −0.4 and u₂: y = 2 − 0.8 = 1.2 — exactly what the sheet reports.

Check the result by hand: v₁·u₂ = 3×(−0.4) + 1×1.2 = −1.2 + 1.2 = 0, confirming u₂ sits perpendicular to v₁ to the last decimal. Geometrically, v₂ = (2, 2) pointed partly along v₁'s direction and partly across it; Gram-Schmidt kept only the across part, leaving a vector 0.4 units left and 1.2 units up from the origin, at a clean right angle to the vector it started from.

Questions

What does Gram-Schmidt actually compute?

It takes two vectors, v₁ and v₂, and returns a new vector u₂ built from v₂ by removing whatever part of it points along v₁. The result, u₂ = v₂ − proj_v₁(v₂), is always perpendicular to v₁, so {v₁, u₂} span the same plane as the original pair but now meet at exactly 90°.

Why does u₁ never change?

Gram-Schmidt processes vectors one at a time, in order, and the first vector has nothing earlier in the sequence to be corrected against — there is no projection yet to subtract from it — so u₁ is simply defined as v₁ itself. All the work happens from the second vector onward, which is why this sheet only asks for and reports u₂.

Why does the calculator report (0, 0) when v₂ is a multiple of v₁?

Because a scalar multiple of v₁ carries no direction beyond v₁'s own — its entire length is shadow, with nothing left over once that shadow is subtracted away. A result of (0, 0) is the process correctly reporting that v₂ added no genuinely new direction, which also means v₁ and v₂ were not independent enough to form a basis.

How do I confirm the answer is actually perpendicular to v₁?

Take the dot product v₁·u₂ = (v₁: x)(u₂: x) + (v₁: y)(u₂: y) by hand; a correct result always gives exactly zero, since that is the defining property Gram-Schmidt is built to guarantee. For the sheet's own worked example, 3×(−0.4) + 1×1.2 = 0 confirms it.

Does Gram-Schmidt only work in two dimensions?

No — this sheet only accepts x and y components, but the identical subtract-the-projection rule extends unchanged to three, four, or any number of dimensions, and to more than two starting vectors. Each new vector simply has the projections of every earlier orthogonal vector subtracted from it in turn, not just one.

How is this different from just finding the angle between two vectors?

Finding an angle answers how far apart two vectors point and stops there; Gram-Schmidt goes further, actually constructing a new vector that removes the shared direction entirely. Where an angle calculation returns a single number, this process returns a whole vector, u₂, ready to serve as one axis of a clean orthogonal coordinate system built from v₁ and v₂.

References