Skip to the lesson
FixTheRobot Explore Robotics / Linear Algebra / M4 Orthogonality and Projections / M4-T1

Linear Algebra · Theory · M4

M4-T1 — Orthogonal Vectors

Perpendicular directions do not interfere with each other. That single fact makes computation, estimation and control far simpler.

  • Lesson 1 of 6
  • Module 4: Orthogonality and Projections
  • Orthogonality
  • About 8 minutes to read

A wheel axle is perpendicular to the direction of travel, a wall is perpendicular to its normal, and the part of a force along a surface does not affect the part across it. This lesson turns “perpendicular” into algebra and shows why perpendicular directions are so convenient.

Learning objectives

After this lesson, you should be able to:

  • Test whether two vectors are orthogonal using the dot product.
  • Prove and use the Pythagorean identity for orthogonal vectors.
  • Show that a set of non-zero mutually orthogonal vectors is linearly independent.
  • Split a vector into components along and across a direction and apply it to robot motion and forces.

Introduction and motivation

Whenever two quantities can be varied independently, without one disturbing the other, the underlying directions are perpendicular. Forward and lateral velocity of a robot, a surface normal and the surface itself, the cross-track and along-track errors of a path: each pair is orthogonal, which is why they can be treated separately. Orthogonality is what turns hard coupled problems into easy independent ones, and it is the geometric ingredient behind least squares and PCA.

The intuition

Two vectors are orthogonal when they meet at a right angle. Algebraically, from the dot product lesson, the angle is 90° exactly when the dot product is zero. Orthogonal vectors have no shadow on each other: moving along one does not change your position along the other.

Interactive figure. Two arrows u and v start at the origin. The shadow of u on the line through v is drawn in green. When the vectors are perpendicular the shadow vanishes and the dot product is zero. This figure needs JavaScript to be interactive.

Drag u until its shadow on v disappears: that is the moment u · v = 0 and the vectors are orthogonal. The readout shows the dot product, the angle and the shadow length going to zero together.
Pythagoras for orthogonal vectorsTwo perpendicular arrows u and v form the legs of a right triangle whose hypotenuse is u plus v. The squared length of the hypotenuse equals the sum of the squared lengths of the legs.u v u + v ‖u + v‖² = ‖u‖² + ‖v‖² holds exactly when u · v = 0 In general:‖u + v‖² = ‖u‖² + 2 u · v + ‖v‖² the cross term 2 u · v vanishes at a right angle
Orthogonal vectors obey Pythagoras: the squared length of the sum is the sum of the squared lengths.

Geometric and physical interpretation

Geometric view. Orthogonal vectors are the legs of a right triangle, and their sum is the hypotenuse. Splitting a vector into a part along a direction and a part perpendicular to it replaces one two-dimensional question with two one-dimensional ones. Physical view. Work done by a force along a displacement uses only the parallel component; the perpendicular component does no work (a normal force on a sliding object, a centripetal force on a circling one). A wheel rolling without slipping moves along its heading and not across it.

The mathematics

u ⟂ v
u and v are orthogonal (perpendicular).
‖u‖
the length of u.
{v₁, …, vk}
a set of vectors; “mutually orthogonal” means vi · vj = 0 for i ≠ j.

Orthogonality

u ⟂ v   ⇔   u · v = 0

What it means. The dot product measures how much two arrows agree; zero means they do not agree at all, which for non-zero arrows means a right angle. The zero vector is orthogonal to everything.

Pythagoras

u ⟂ v   ⇒   ‖u + v‖² = ‖u‖² + ‖v‖²

What it means. For perpendicular vectors the lengths combine like the sides of a right triangle. In general the identity has an extra term, 2 u · v, which is exactly the part that measures how aligned the vectors are.

Independence of orthogonal sets

v1, ..., vk non-zero and mutually orthogonal   ⇒   v1, ..., vk are linearly independent

What it means. Perpendicular directions are automatically all different directions, so none can be built from the others.

Splitting a vector

v = vparallel + vperp     vparallel = ((v · û) û),     vperp = v − vparallel,     vperp ⟂ û

What it means. Every vector splits into the part along a unit direction û and the part perpendicular to it. The two parts are orthogonal, so their squared lengths add.

Orthogonal means a zero dot product. Orthogonal vectors obey Pythagoras, are automatically independent, and let a problem split into independent pieces.

Step-by-step derivation: Pythagoras, independence and the splitting formula

Pythagoras in vector form. Expand the squared length of a sum with the dot product, using that the dot product is symmetric and distributes over addition:

‖u + v‖² = (u + v)·(u + v) = u·u + u·v + v·u + v·v = ‖u‖² + 2 u·v + ‖v‖²

What it means. The middle terms combine into 2 u·v. This identity holds for any two vectors; it is the law of cosines in disguise.

If u · v = 0 the middle term vanishes, leaving ‖u‖² + ‖v‖².

Orthogonal sets are independent. Suppose c₁v₁ + … + ckvk = 0 for mutually orthogonal non-zero vectors.

  1. Take the dot product of both sides with vj: c₁(v₁·vj) + … + cj(vj·vj) + … + ck(vk·vj) = 0.
  2. All terms with i ≠ j vanish by orthogonality, leaving cj ‖vj‖² = 0.
  3. Since vj ≠ 0, ‖vj‖² > 0, so cj = 0. This holds for every j, so only the trivial combination gives zero: the vectors are independent.

The splitting formula. Let û be a unit vector and v_perp = v − (v·û)û. Then v_perp · û = v·û − (v·û)(û·û) = v·û − v·û = 0, using û·û = 1. So the remainder is orthogonal to û, and by Pythagoras ‖v‖² = (v·û)² + ‖v_perp‖².

A worked example: checking, splitting and verifying Pythagoras

  • Test. u = (3, 1) and v = (−1, 3): u·v = −3 + 3 = 0, so they are orthogonal.
  • Pythagoras. u + v = (2, 4) and ‖u + v‖² = 4 + 16 = 20, while ‖u‖² + ‖v‖² = 10 + 10 = 20. ✓ For the non-orthogonal pair (3, 1) and (1, 3) the sum is (4, 4) with squared length 32, but 10 + 10 = 20; the difference is 2 u·v = 2·6 = 12. ✓
  • Independence. The vectors (1, 1, 0), (1, −1, 0) and (0, 0, 2) are non-zero and mutually orthogonal (all three dot products are 0), so they are independent and form a basis of R³.
  • Splitting. Split v = (4, 3) along û = (1, 0): v_parallel = (4, 0), v_perp = (0, 3). Along the direction û = (0.6, 0.8): v·û = 2.4 + 2.4 = 4.8, v_parallel = (2.88, 3.84), v_perp = (1.12, −0.84), and indeed v_perp·û = 0.672 − 0.672 = 0; also 4.8² + ‖v_perp‖² = 23.04 + 1.96 = 25 = ‖v‖². ✓

Robotics application

Along-track and cross-track. The path-following error splits into a component along the path direction and one across it, orthogonal by construction. Controllers regulate them separately, a decomposition at the heart of Stanley and cross-track control.

Sliding on a wall. When a mobile robot's velocity points into a wall, the collision-avoidance layer removes the component along the wall normal and keeps the tangential component, exactly v_perp with respect to the normal. The robot slides instead of stopping.

Forces and work. A normal force on a contact is orthogonal to the contact surface and does no work as the object slides; a joint torque balancing a payload cares only about the part of the force perpendicular to the lever arm (see the cross product lesson).

Sensor geometry. A scan line from a 2D LiDAR is orthogonal to the surface normal at the point where the beam grazes a wall: the dot product of beam direction and normal is how incidence angle (and therefore expected range accuracy) is computed. The SLAM track's lesson on LiDAR point clouds uses these incidence angles.

Engineering implications and limitations

Practical rules

  • Test orthogonality with a tolerance, relative to the lengths. Use |u·v| ≤ tol · ‖u‖‖v‖, never u·v == 0, because floating-point dot products are almost never exactly zero.
  • Orthogonal is not the same as independent. Independent vectors need only point in different directions. Orthogonality is stronger and is what makes the computations easy.
  • Normalise before comparing directions. Splitting with a non-unit direction needs the factor 1/(u·u); using a unit vector avoids that mistake.
  • Rounding erodes orthogonality. Vectors that start out orthogonal drift away from it as they are updated repeatedly (for example a rotation matrix integrated from a gyro); re-orthogonalise periodically (Module 7).
  • Orthogonality depends on the metric. It means a zero dot product in the units used. Mixing metres and radians in one vector makes “perpendicular” meaningless.

Limits

All of this assumes the ordinary dot product. When coordinates carry different uncertainties, the natural notion of perpendicular changes to a weighted dot product (Module 9, Mahalanobis distance), and “orthogonal in the plain sense” stops being the useful property.

Common misconceptions

“Orthogonal vectors must have equal length.”

Length is irrelevant: (3, 0) and (0, 0.1) are orthogonal. Equal length and orthogonality together characterise an orthonormal pair (next lesson).

“Two vectors with a small dot product are nearly orthogonal.”

Not necessarily: the dot product scales with the lengths. Compare u·v with ‖u‖‖v‖ (the cosine) to judge the angle.

“Independent vectors are always orthogonal.”

No. (1, 0) and (1, 1) are independent but form a 45° angle. Orthogonal is a special, convenient kind of independent.

“Pythagoras works for any two vectors.”

Only when the cross term 2 u·v is zero, that is, for orthogonal vectors. The general identity has that extra term.

Engineering takeaways

  1. u ⟂ v exactly when u · v = 0 (and the zero vector is orthogonal to everything).
  2. For orthogonal vectors ‖u + v‖² = ‖u‖² + ‖v‖²; in general there is an extra 2 u · v term.
  3. Non-zero mutually orthogonal vectors are automatically linearly independent.
  4. Any vector splits as a part along a unit direction û and a part perpendicular to it; their squared lengths add.
  5. Along-track/cross-track errors, sliding on walls and work by forces are all orthogonal decompositions.

References and further reading

Primary papers and authoritative documentation.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

Are u = (2, 6, −3) and v = (3, 0, 2) orthogonal? Check Pythagoras for their sum.

Explanation

u·v = 6 + 0 − 6 = 0, so they are orthogonal. ‖u‖² = 4 + 36 + 9 = 49 and ‖v‖² = 9 + 0 + 4 = 13, so the sum of squares is 62. Then u + v = (5, 6, −1) has squared length 25 + 36 + 1 = 62. ✓

Question 2

A robot slides along a wall whose unit normal is n = (0, 1). Its commanded velocity is (1.2, −0.5) m/s, pointing into the wall. What velocity does the collision layer keep, and what is removed?

Explanation

The component along the normal is v·n = −0.5, so the part to remove is (v·n) n = (0, −0.5). The kept velocity is v − (v·n) n = (1.2, 0): the tangential component, perpendicular to the normal. The robot slides along the wall at 1.2 m/s instead of stopping.

Question 3

Why can a set of mutually orthogonal non-zero vectors never be linearly dependent? Use a dot product in your argument.

Explanation

Suppose some combination equals zero. Dot both sides with one member vj: every cross term vi · vj with i ≠ j vanishes, leaving cj ‖vj‖² = 0. Since vj is non-zero, ‖vj‖² > 0, so cj must be 0. This works for every j, so all coefficients are zero and the set is independent.

What’s next

Orthogonal sets that are also made of unit vectors are the best possible coordinate systems. That is the topic of the next lesson.

Next lesson

M4-T2 — Orthogonal and Orthonormal Bases

Find coordinates in an orthonormal basis with dot products alone, and explain why such bases are convenient.

Nothing below is required to finish this lesson.