3.6.7 · D23D Geometry

Visual walkthrough — Angle between two lines

1,752 words8 min readBack to topic

We build in order. No symbol appears in a picture before you know what it means.


Step 1 — A line is just a direction

WHAT. A straight line in 3D goes on forever both ways. Slide your finger along it: your position keeps changing, but the way you're pointing never does. That fixed "way of pointing" is all we care about, and we store it as an arrow — a direction vector, written .

WHY. The angle where two lines cross depends only on how they tilt relative to each other, not on where they sit. So we throw away position and keep the arrow. (See Direction cosines and direction ratios for where these arrows come from.)

PICTURE. Two lines drifting anywhere in space, each carrying its own arrow. The arrows are what we'll compare.


Step 2 — Slide both arrows to one shared corner

WHAT. Pick up both direction arrows and place their tails at the same point. Now they form a corner — a wedge — with an opening angle we'll call (the Greek letter "theta", just a name for the angle).

WHY. An angle needs a shared vertex. Since position is irrelevant (Step 1), we're allowed to move the arrows freely. Once they share a tail, "the angle between the lines" becomes literally "the angle inside this wedge."

PICTURE. The burnt-orange arrow and the teal arrow , tails together, with marked in the wedge between them.

At this point is a picture — an opening we can see. Steps 3–5 turn it into a number we can compute.


Step 3 — The one tool that converts arrows into an angle: the dot product

WHY this tool and not another? We have two arrows and we want the angle between them. We need an operation that eats two vectors and spits out something that knows about the angle. Length alone can't do it (length ignores direction). The dot product is precisely the operation built to feel the angle between two arrows — that's its whole job. (Full story in Dot product of vectors.)

WHAT. The dot product has two faces that are secretly equal:

Reading it left to right: the single number equals (first length) × (second length) × (cosine of the wedge angle).

WHY appears. measures how much of one arrow lies along the other — the "shadow overlap." When the arrows point the same way, the shadow is full (). When they're perpendicular, one casts no shadow on the other (). Cosine is the exact dial that reads "aligned-ness," which is why it, and not sine, sits here.

PICTURE. The teal arrow's shadow (projection) dropped onto the orange arrow. The length of that shadow is — you can literally see the cosine shrinking the arrow.


Step 4 — Rearrange to hunt for the angle

WHAT. We want , so we isolate the only piece that contains it, . Divide both sides by the two lengths:

WHY divide by the lengths? The raw dot product is contaminated by how long we happened to draw the arrows. A direction ratio and describe the same line but have different lengths, so their raw dot products differ. Dividing by both lengths cancels the length units and leaves a pure number between and — the honest cosine. This division is called normalizing.

PICTURE. The same two arrows, then both squashed to length (unit arrows). The wedge is unchanged — dividing by length never bends the angle, it only rescales the arrows.


Step 5 — A line points both ways: kill the sign

WHAT. Here is the twist unique to lines. A line has no arrowhead — walking along it "forwards" or "backwards" traces the same line. So and (the flipped arrow) describe the same line.

WHY this breaks Step 4. Flip to : the dot product flips sign, so flips sign, so the same pair of lines gives us two answers — an angle and its partner . Two intersecting lines really do carve out two angles (an acute one and an obtuse one). We must pick one to have a well-defined answer.

THE FIX. Agree once and for all to report the acute angle (). Acute cosines are non-negative, so we force the sign positive with a modulus (the vertical bars mean "make it non-negative"):

The bars sit on the numerator only — the lengths on the bottom are already positive.

PICTURE. Flip one arrow and watch the obtuse angle appear; the modulus reflects it back to the acute twin.


Step 6 — Write it in coordinates

WHAT. Replace the abstract dot and lengths with components. For and :

Every symbol here was defined above: the top is the dot (multiply matching parts, add), each square root is a length (Pythagoras in 3D).

WHY. This is the computable form — plug in numbers, get .

PICTURE. A worked strip: arrows and turned into .


Step 7 — The two extreme cases (where the formula "snaps")

WHAT. Push to its two limits and read what the formula demands.

Perpendicular (). Then , so the whole fraction is . With non-zero lengths on the bottom, only the top can be zero: The dot product vanishing is the perpendicular test.

Parallel (). The arrows point the same way, so one is a scaled copy of the other. Every matching pair of components sits in the same ratio:

WHY put these in the walkthrough. They are the boundary cases the reader will hit constantly, and both drop straight out of the boxed formula — nothing new to memorize.

PICTURE. Left: two perpendicular arrows, dot product zero. Right: two parallel arrows, ratios equal.


The one-picture summary

Everything above, compressed: two lines → their arrows → shared corner → dot product feeds the cosine → divide by lengths → modulus forces acute. Follow the arrows.

Recall Feynman: the whole walk in plain words

Two lines are like two laser beams. A line doesn't care where it is, only which way it aims, so we replace each line by a little arrow saying "this way." To find the corner angle, we drag both arrows to the same spot so they make a wedge. Now we need a machine that turns two arrows into an angle — that's the dot product: multiply matching parts, add them up. But this raw number secretly hides the arrows' lengths, so we divide by both lengths to wash the lengths out, leaving a pure "how aligned are they?" number, the cosine. One last catch: a line has no front or back, so flipping an arrow gives the same line but a different-looking angle. We just promise to always report the small (acute) angle by slapping absolute-value bars on top. Push the arrows to a right angle and the top hits zero (perpendicular test); line them up and the components fall in equal ratios (parallel test). That's the entire recipe — dot on top, two lengths on the bottom, keep it positive.


Connections