Steply

Dot product of (1, 2, -3, 4) and (2, 0, 1, -1)

Step by step, with the reason for every step · Dot product and length · Linear Algebra

Step by step

The question

Question: find the dot product of (1, 2, −3, 4) and (2, 0, 1, −1).

u = [1; 2; −3; 4], v = [2; 0; 1; −1]

The dot product u dot v: multiply matching entries, top with top and so on.

Then add them all.

The answer is one number.

u • v: matching entries multiplied, then added

1 Multiply matching entries

1 × 2 + 2 × 0 + (−3) × 1 + 4 × (−1).

u • v = 1 × 2 + 2 × 0 + (−3) × 1 + 4 × (−1)

We work out each times.

u • v = 2 + 0 − 3 − 4

2 Add them

Then we add: u • v = −5.

u • v = −5

Careful!

The dot product is one number, not a vector.

The products are added together.

Careful: one number, not a vector

3 Check

Let's check the other way round: v dot u.

The same products, so the same number.

v • u = 2 × 1 + 0 × 2 + 1 × (−3) + (−1) × 4
= 2 + 0 − 3 − 4 = −5

We get −5 again.

So the answer is right!

Let's look back.

First: multiply matching entries.

Then: add them.

Last: check.

Answer
Careful: one number, not a vector

Your turn

Try this one yourself, then check:

Dot product of [2; 1; −2; 2] and [1; 0; 1; −1]
Show the answer
u • v = −2

More from Dot product and length

The whole lesson: Dot product and length →