The Dot Product Measures Alignment
Type a word into a search box and the engine doesn't compare texts letter by letter. It turns each text into a vector and asks how much the two vectors point the same way. The tool that boils that "how much the same way" down to a single number is the dot product: a·b = |a||b|cos(theta), the product of the two lengths times the cosine of the angle between them. Strip the lengths away and only cos(theta) remains, and that is cosine similarity. Same direction means similar, a right angle means unrelated, opposite means contrary. Search, recommendations, and word embeddings all run on this one line.
Keep the green arrow a fixed and work the blue arrow b with two handles. One slider turns b's angle, the other stretches b's length. Watch the a·b value on screen respond to both handles: lengthen b and the value scales up bodily (the length effect), rotate b and it bends positive when they aim the same way, zero at a right angle, negative when opposed (the alignment effect). The color shifts green, faint, or red with the sign. The foot of b dropped onto a (its projection) slides along too. Feel with your hands that one dot product carries two things at once: length and alignment.
There's another way to see the dot product. Lay a along the +x axis with length 2 and rotate only b's angle with the slider. The gold segment drawn on the axis is b's shadow cast straight down onto a — its projection. Then a·b is exactly |a| times that projection length. Tilt b toward a and the shadow grows, so the dot product is large; raise b upright and the shadow shrinks, so the dot product drops. At a right angle the shadow is zero, so the dot product is zero. The dot product is, in the end, "how far one vector reaches along the other," measured as a length and multiplied by |a|.
Pull out just the sign of the dot product and the rule is dead simple. Put a on the +x axis and sweep b's angle theta from 0 to 360 degrees with the slider. The plane shades into two regions. The half-plane on a's side (theta within 90 degrees) is greenish, and there the dot product is positive. At exactly 90 and 270 degrees, the right angles, it is zero. The opposing half-plane (between 90 and 270 degrees) is reddish, and there the dot product is negative. As you turn b, the on-screen word flips between positive, zero, and negative with the value alongside. One sign decides at a glance whether the vectors are on the same side, unrelated, or opposed.
Now strip the lengths off entirely: cos(theta) = a·b / (|a||b|). This value always lands between -1 and +1. Fix a and change b's angle and length with the two sliders. There's a decisive moment: stretch or shrink only b's length and cos(theta) doesn't budge — the needle on the gauge drawn from -1 to +1 below stays put. Turn the angle instead and the needle slides right across. Cosine similarity ignores size and looks only at direction. That's why a search engine and an embedding compare two texts by the direction they point, no matter whether the texts are long or short.
Finally, catch the exact moment the dot product hits zero yourself. a is fixed; drag the blue arrow b with your hand and roam it over the plane. The a·b value floats live on screen. As b passes the spot where it makes a right angle with a, the value crosses zero, the arrow glows, and the word "orthogonal" appears. A dot product of zero means the two directions are perfectly perpendicular, that is, mutually unrelated and independent. This property is what makes coordinate axes clean: because the x and y axes are orthogonal, moving along one axis doesn't disturb the other's value. Every clean basis comes from this "dot product zero."