Dot Product Basics

Dot Product of Two Vectors

The dot product of two vectors A and B is a key operation in using vectors in geometry.

In the coordinate space of any dimension (we will be mostly interested in dimension 2 or 3):

Definition: If A = (a1, a2, ..., an) and B = (b1, b2, ..., bn), then the dot product A.B = a1b1 + a2 b2 + ... + an bn

Examples: Let A = (1, 2, -1), B = (3, 2, 1), C = (0, -5, 2). Note that if we set D = 2B - C, then D = (6, 9, 0).

A.B = 1*3 + 2*2 + (-1)*1 = 6

A.C = 1*0 + 2*(-5) + (-1)*2 = -12

A.D = 1*6 + 2*9 + (-1)*0 = 24

Notice that A.D = A.(2B - C) = 24 and also 2A.B - A.C = 2*6 - (-12) = 24. This is not a coincidence, but follows from the algebraic properties of the dot product..

Algebraic Properties of the Dot Product

These properties are extremely important, though they are a little boring to prove. It takes a second look to see that anything is going on at all, but look twice or 3 times.

(1) (Commutative Property) For any two vectors A and B, A.B = B.A.

(2) (Scalar Multiplication Property) For any two vectors A and B and any real number c, (cA).B = A.(cB) = c(A.B)

(3) (Distributive Property) For any 3 vectors A, B and C, A.(B+C) = A.B + A.C.

Let A, B, C, D be as above for the next 3 exercises.

Exercise 1: Compute B.A and compare with A.B. Can you see why these numbers are the same in this example and will always be the same for any choice of A and B?

Exercise 2: Let c = 10. Write down 10A and 10B. Then compute each of the 3 terms in property (2) above and see that they are in fact the same. Again look to see why this is true.

Exercise 3: Compute E = B+C. Check that A.E is really the sum of A.B and A.C.

Exercise 4. Show how you can combine (3) with (2) in several steps to show that for any vectors A, B, C and any real numbers h and k, A.(hB+kC) = A.hB + A.kC. Tell how this explains why for the special A, B, C, D above, A.D = A.(2B - C).

Exercise 5: Use the properties above to expand (aA + bC).(cC + dD) into a sum of four terms, starting with ac(A.C) + ...

Exercise 6: For a point A = (3, 4) in the plane, compute the square root of A.A. Tell why this number is the distance from A to O.

Geometric Properties of the Dot Product

Length and Distance Formula

For A = (a1, a2, ..., an), the dot product A.A is simply the sum of squares of each entry.

In the plane or 3-space, the Pythagorean theorem tells us that the distance from O to A, which we think of as the length of vector OA, (or just length of A), is the square root of this number.

Definition. For A in n-space, the length of A = square root of A.A. This length is written |A|. so |A|2 = A.A.

Likewise, the Pythagorean theorem also shows that the distance from A to B is the length of AB, which is the length of B-A.

Definition: For A and B in n-space, the distance from A to B is the length |B-A|.
Note: This equals |A-B| also.

Law of Cosines

Cosine Theorem: For A and B in the plane or in space, A.B = |A| |B| cos AOB

In the triangle AOB, if we let the length of side AB = c, then by definition of distance,

c2= |A - B|2

Proof: From the algebraic properties,

|A - B|2 = A.B - B.A - B.B = |A|2 + |B|2 - 2A.B.

But from geometry, since |A| = |OA| = side opposite B, etc., the Law of Cosines for triangle AOB says

c2= |A|2 + |B|2 - 2|A| |B| cos AOB.

Comparing these, all but one term is the same in each, so we see that A.B = |A| |B| cos AOB

Exercise: Compute the angle between (1, 1, 1) and (0, 0, 1).

Exercise: In the plane, let A = (1, 2), B = (3, 4), C = (-2, -1). Use the dot product to compute all the side lengths and all the angles of this triangle.

Exercise: In the plane, let A = (1, 2, 1), B = (3, 4, 1), C = (-2, -1, 3). Use the dot product to compute all the side lengths and all the angles of this triangle.

Orthogonal Vectors

The cosine of a right angle = 0, so a very important special case of the cosine theorem is this:

Orthogonal Vector Theorem: Two vectors A and B are orhthogonal if and only if their dot product is zero.


Mathworld: Dot Product

Dot product definitions and examples at Texas A&M


Back to Vector-Coordinate Index