Loading lesson…
Courses›Dot Product and Magnitude

Dot Product and Magnitude

DetailedOverviewQuizFlashcard

Dot Product and Magnitude

Length, the Dot Product, and the Angle

Scenario

Suppose you score a week of work against a rubric.

The week is three counts: ten hours of reading, twenty of practice, thirty of review. Write that as [10,20,30][10, 20, 30]. The rubric says how much each hour is worth: reading is worth two, practice three, review six. Write that as [2,3,6][2, 3, 6]. How much credit does that week earn, as a single number?

That is the question this lesson answers. Multiply matching slots, then add. First slots: 10×2=2010 \times 2 = 20. Second: 20×3=6020 \times 3 = 60. Third: 30×6=18030 \times 6 = 180. Add them, slowly: 20+60=8020 + 60 = 80, and 80+180=26080 + 180 = \mathbf{260}. The week earns 260260.

A few answers look almost right and are wrong, the way a spam score of 1.71.7 looks like a probability until you remember probabilities live in [0,1][0, 1]:

  • 240240 — the first product 2020 was dropped, so only 60+18060 + 180 was kept.
  • 8080 — the third product 180180 was dropped, so the walk stopped at 20+6020 + 60.
  • 6060 — someone added the rubric and ignored the week.
  • 11 — someone looked at the two arrows, decided they “look aligned,” and wrote cosine 11 without dividing.

Keep every product. The number is 260260.

Instead of starting from “what is a dot product?”, we ask:

  • How do two lists become one number?
  • What happens if we miss one product?
  • How long is each arrow?
  • What angle do they make?
  • When is there no product at all?

Those two lists are still a vector from Lesson 1: a list of numbers, and an arrow from the origin. Today the two lists become one number. From that number you get the length of an arrow. From the product and the two lengths you get the cosine of the angle between them. Three quantities, one piece of arithmetic.

The clip walks those numbers in the same order: [10,20,30]⋅[2,3,6][10, 20, 30]\cdot[2, 3, 6] as two lists, then as two arrows; length 77; the computed cosine; a right angle; then two lists of different lengths.

$[10, 20, 30]\cdot[2, 3, 6]$ as two arrows, then length $7$, then the angle, then why different-length lists have no product.

Two lists, one number

Take those two lists of the same length:

[10,20,30][10, 20, 30] and [2,3,6][2, 3, 6].

Each slot of the first list has a partner in the second. Multiply the partners. Then add those products. That sum is the only number the two lists share.

First slots: 10×2=2010 \times 2 = 20.

Second slots: 20×3=6020 \times 3 = 60.

Third slots: 30×6=18030 \times 6 = 180.

Add them, slowly: 20+60=8020 + 60 = 80, and 80+180=26080 + 180 = \mathbf{260}.

Miss the 2020 and you quote 240240. Miss the 180180 and you quote 8080. The three products have to be there. 260 is not a guess from a picture. It is those three multiplications, added.

The same act has three writings. They are names, not three different operations:

aTb,a⋅b,⟨a,b⟩.a^{\mathsf T}b,\qquad a\cdot b,\qquad \langle a,b\rangle.

All three equal 260260 for this pair.

Order does not matter. [2,3,6]⋅[10,20,30][2, 3, 6]\cdot[10, 20, 30] is 2×10+3×20+6×302\times 10 + 3\times 20 + 6\times 30, which is 20+60+18020 + 60 + 180 again. Commutative: a⋅b=b⋅aa\cdot b = b\cdot a.

The slots also split across a sum. Distributive: a⋅(b+c)=a⋅b+a⋅ca\cdot(b+c) = a\cdot b + a\cdot c. Pair first, then add — or add first, then pair. Same number.

A second check, same rule

Five slots this time, still matching:

[1,2,3,4,5][1, 2, 3, 4, 5] and [6,7,8,9,10][6, 7, 8, 9, 10].

1×6=61\times 6 = 6. 2×7=142\times 7 = 14. 3×8=243\times 8 = 24. 4×9=364\times 9 = 36. 5×10=505\times 10 = 50.

6+14=206 + 14 = 20. 20+24=4420 + 24 = 44. 44+36=8044 + 36 = 80. 80+50=13080 + 50 = \mathbf{130}.

Same rule as 260260. Longer lists, still one number. If someone quotes 5555, they added the slots of one list and ignored the other. If they quote 260260, they brought the wrong pair.

Length is the self-dot

The same list is an arrow. Put the tail at the origin. Put the tip at the point whose coordinates are the list. Magnitude is the distance from that tail to that head — the geometric length of the walk.

How do the slots give that length? Walk the axes one at a time. For [2,3][2, 3] that is two east and three north. The straight-line distance back to the origin is the hypotenuse:

22+32=4+9=13.\sqrt{2^2 + 3^2} = \sqrt{4 + 9} = \sqrt{13}.

Pythagoras on the slots is the arrow length. A third slot is one more right-triangle leg, not a new idea. In general:

∥x∥=∑i=1nxi2.\|x\| = \sqrt{\sum_{i=1}^{n} x_i^2}.

That sum of squares is the vector dotted with itself. Length is x⋅x\sqrt{x\cdot x}.

This pair, first the short arrow. [2,3,6][2, 3, 6]:

22+32+62=4+9+36=492^2 + 3^2 + 6^2 = 4 + 9 + 36 = 49, and 49=7\sqrt{49} = \mathbf{7}.

∥b∥=7\|b\| = 7 is a computed tip, not a caption we liked. The arrow that starts at the origin and ends at (2,3,6)(2, 3, 6) is seven units long.

The long arrow, [10,20,30][10, 20, 30]:

102+202+302=100+400+900=140010^2 + 20^2 + 30^2 = 100 + 400 + 900 = 1400, so

∥a∥=1400.\|a\| = \sqrt{1400}.

That is the same number as a⋅a\sqrt{a\cdot a}. You do not measure the drawing with a ruler. You add the squared slots and take the square root.

The angle those two arrows make

Two arrows from the origin make an angle θ\theta. The product you already have and the two lengths you just computed are enough:

a⋅b=∥a∥ ∥b∥cos⁡θ,a\cdot b = \|a\|\,\|b\|\cos\theta,

so

cos⁡θ=a⋅b∥a∥ ∥b∥=260∥a∥⋅7.\cos\theta = \frac{a\cdot b}{\|a\|\,\|b\|} = \frac{260}{\|a\|\cdot 7}.

Do that division. ∥a∥=1400\|a\| = \sqrt{1400}. Then 260260 divided by 1400×7\sqrt{1400}\times 7 is the cosine. It is a little less than 11 — the arrows share a direction, but they are not the same ray. Writing 11 because the picture “looks aligned,” or writing 0.90.9 because that looks neat, skips the division. The arithmetic is 260260 over both lengths. Nothing else.

Three landmarks, so the formula has somewhere to sit:

Right angle. If the arrows meet at 90∘90^\circ, then cos⁡θ=0\cos\theta = 0, so a⋅b=0a\cdot b = 0. The slots still multiply and add — the sum just happens to be zero. [1,0][1, 0] and [0,1][0, 1]: 1×0+0×1=01\times 0 + 0\times 1 = 0. Perpendicular means the product vanished, not that someone drew a little square.

Same direction. If one arrow is a positive stretch of the other, θ=0\theta = 0 and cos⁡θ=1\cos\theta = 1. The product equals the product of the lengths.

Opposite. If one arrow is a negative stretch of the other, θ=180∘\theta = 180^\circ and cos⁡θ=−1\cos\theta = -1.

This pair sits near "same direction," not on it. 260/(∥a∥⋅7)260 / (\|a\|\cdot 7) is close to 11 and is not 11. That is the whole point of keeping the 260260 and the 77 in the sentence.

When there is no product

Addition in Lesson 1 needed a partner for every slot. The dot product needs the same thing.

[10,20,30][10, 20, 30] has three numbers. [1,2,3,4][1, 2, 3, 4] has four. The first three slots could be multiplied, but the fourth slot of the second list has no partner. There is no honest single number, and no angle to take.

You do not drop the extra slot to force a product. You do not borrow a zero. [10,20,30]⋅[1,2,3,4][10, 20, 30]\cdot[1, 2, 3, 4] is undefined. Different-length lists have no dot product.

Figure

The still is two arrows from the origin — the same lists, drawn in the plane they share. The teal 260260 sits on that pair. The short tip is ∥b∥=7\|b\|=7. The long arrow keeps going; ∥a∥=1400\|a\|=\sqrt{1400}. Cosine is 260260 over both lengths.

[10, 20, 30] and [2, 3, 6] as arrows from the origin; the product is 260

Ten times two is twenty. Twenty times three is sixty. Thirty times six is one eighty. The ink arrow is bb with length 77, the ember arrow is aa, and teal is the product 260260.

A short sequence walks the same numbers one idea at a time: two lists as slots, the stack to 260260, the same pair as arrows from the origin, why ∥b∥=7\|b\|=7, the angle as 260260 over both lengths, a right-angle pair whose product is 00, then why three slots times four slots have no product. The SVG above stays the computed truth.

Lab

You just saw matching slots stack to 260260 and the short arrow measure 77. The teal number here is that same product, recomputed from the slots you set.

The six controls are the six slots. Try this: change 1010 to 1111 and the first product must leave 2020; the sum must leave 260260. If it does not, the lab is not multiplying.

Teal is the live product and the live cosine, both recomputed from the slots you set. Reset returns to 260260 with ∥b∥=7\|b\|=7. Flip the right-angle control: the product becomes 00 because the slots now cancel. Flip the length-mismatch control: a length-3 list and a length-4 list refuse to make a number.

Interactive lab loads with the lesson app.

The next lesson takes several arrows and asks which points you can reach by mixing them.