JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

The Dot Product: Angles and Projections

The dot product is a tiny machine that eats two vectors and spits out a single number — and that number quietly knows the angle between them. From it you get perpendicularity for free, the length of a vector, and the shadow one vector casts on another.

From Adding Arrows to Multiplying Them

In the previous guide you learned to treat a vector as an arrow with a direction and a length, and to add two of them tip-to-tail. Adding arrows feels natural. But can you multiply two arrows? Not in the way you multiply numbers — there is no single 'product arrow' that behaves the way you would hope. Instead there are two genuinely useful products, each capturing a different geometric fact. The first, and the gentler of the two, is the dot product, written u . v. It takes two vectors and returns not a vector but a plain number — a scalar.

Why would turning two arrows into a number be useful? Because the right number can encode an angle. The whole point of the dot product is that it bundles together the two lengths and the angle between the arrows into one tidy quantity, and from that one quantity you can read back the angle, decide whether the arrows are perpendicular, or measure how much one arrow points along another. That is a lot of geometry packed into a single multiply-and-add.

Two Faces of One Formula

The dot product has two definitions that look completely different yet always agree. The component definition says: multiply the matching coordinates and add the results. For u = (u_1, u_2, u_3) and v = (v_1, v_2, v_3), the dot product is u . v = u_1*v_1 + u_2*v_2 + u_3*v_3 — one multiply per axis, then a single sum. It is fast, it is mechanical, and it needs nothing but the components you already have.

The geometric definition says something that sounds entirely unrelated: u . v = |u| * |v| * cos theta, where |u| and |v| are the two lengths and theta is the angle between the arrows. This version wears its meaning on its sleeve — it is built from lengths and an angle, the raw stuff of geometry. The quiet miracle is that these two formulas, the coordinate grind and the length-times-cosine, give the same number every single time. That equality is a real theorem (it follows from the law of cosines), not an accident, and it is the bridge that lets you compute an angle from coordinates.

Two definitions of the dot product (always equal):

  Components:  u . v = u_1*v_1 + u_2*v_2 + u_3*v_3
  Geometric:  u . v = |u| * |v| * cos theta

Example: u = (3, 0, 0),  v = (0, 4, 0)
  Components:  3*0 + 0*4 + 0*0 = 0
  So cos theta = 0, theta = 90 degrees -- the arrows are perpendicular.
The two definitions side by side, with a quick check: along-the-x and along-the-y arrows have dot product 0, confirming the right angle between them.

Reading the Angle Out

Set the two definitions equal and solve for the angle, and you get the single most useful consequence: cos theta = (u . v) / (|u| * |v|). Compute the dot product the cheap way from components, divide by the product of the two lengths, and the result is the cosine of the angle between the arrows. Take the inverse cosine and you have theta itself. This is how a computer 'sees' angles — not with a protractor, but with a multiply, an add, and a division.

  1. Compute the dot product from components: u . v = u_1*v_1 + u_2*v_2 + u_3*v_3.
  2. Compute the two lengths: |u| = sqrt(u_1^2 + u_2^2 + u_3^2), and the same for |v|.
  3. Divide: cos theta = (u . v) / (|u| * |v|). This number always lies between -1 and 1.
  4. Take the inverse cosine to get theta. A positive dot product means an acute angle, zero means a right angle, negative means an obtuse angle.

The sign of the dot product alone, before you ever divide, already tells a story. Because the lengths |u| and |v| are always positive, the sign of u . v matches the sign of cos theta. So a positive dot product means the angle is less than 90 degrees — the arrows broadly agree in direction. A negative dot product means an obtuse angle — they broadly oppose. And a dot product of exactly zero means cos theta = 0, that is, theta = 90 degrees. Perpendicularity becomes a single arithmetic test: u and v are perpendicular exactly when u . v = 0.

A Vector Dotted with Itself: Length Reappears

Here is a small but beautiful special case. What is u . u — a vector dotted with itself? Through the geometric definition, the angle a vector makes with itself is 0 degrees, and cos 0 = 1, so u . u = |u| * |u| * 1 = |u|^2. Through the component definition the same quantity is u_1^2 + u_2^2 + u_3^2. Setting them equal gives |u| = sqrt(u_1^2 + u_2^2 + u_3^2) — the length formula in space, which is nothing but the Pythagorean theorem used twice, once for the floor and once for the height.

So length is not a separate idea bolted on beside the dot product — it lives inside it. The norm |u| is just the square root of u dotted with itself. This is why a unit vector (a vector of length exactly 1) satisfies the clean relation u . u = 1: its length squared is 1. Once you see length as a dot product in disguise, formulas that looked unrelated start to feel like members of one family.

Projection: The Shadow One Arrow Casts on Another

The dot product's other great gift is the projection. Picture vector v lying along the ground and the sun directly overhead casting the shadow of another vector u onto v's line. That shadow — how much of u points along v — is the projection of u onto v. It answers a question that comes up everywhere: of all of u, what part of it runs in the v-direction? The dot product computes exactly this overlap.

The length of that shadow, the scalar projection, is (u . v) / |v|. You can read it straight off the geometric definition: u . v = |u| * |v| * cos theta, and |u| * cos theta is exactly the adjacent side of the right triangle — the length of u's shadow. Dividing the dot product by |v| peels away the extra factor of |v| and leaves that shadow length. If you want the projection as a full vector rather than just its length, multiply that scalar by the unit vector in the v-direction, v / |v|, giving (u . v / |v|^2) * v.

Watch the sign, and be honest about what it means. If theta is obtuse, cos theta is negative, so the scalar projection is negative — the shadow points the opposite way along v's line. That is not a mistake to hide; it is the projection faithfully reporting that u leans away from v. This is the engine behind splitting any vector into a part along a chosen direction and a part perpendicular to it — a decomposition you will lean on constantly when you reach planes, forces, and later the direction cosines that record how a vector tilts against each axis.

Honest Habits and One Forward Look

A few honest cautions keep the dot product trustworthy. First, it is commutative: u . v = v . u, since multiplying components and swapping which vector is which changes nothing. Second, it distributes over addition, u . (v + w) = u . v + u . w, which is what lets you expand expressions freely. But third — and this trips people — there is no associativity to speak of, because (u . v) . w makes no sense at all: u . v is already a number, and you cannot dot a number with a vector. Always remember the dot product eats two vectors and leaves the world of vectors behind.

It is also worth being clear about what the dot product cannot do. It tells you the angle between two arrows but never which way you would turn to get from one to the other — it cannot distinguish +theta from -theta, since cos theta = cos(-theta). It hands you area and orientation only indirectly, if at all. For the turning direction, the signed area of the parallelogram two vectors span, and a vector perpendicular to both, you need a different tool entirely.

That tool is the cross product, the subject of the next guide. Where the dot product collapses two arrows into a single number tied to the angle, the cross product builds from two arrows a brand-new arrow tied to area and direction. Holding both in mind — one giving a scalar, one giving a vector — is the key to all the three-dimensional geometry ahead: lines, planes, volumes, and the way they all fit together in space.