# Linear AlgebraDot Products

Consider a shop inventory which lists unit prices and quantities for each of the products they carry. For example, if the store has 32 small storage boxes at $4.99 each, 18 medium-sized boxes at $7.99 each, and 14 large boxes at $9.99 each, then the inventory's price vector and quantity vector are

The total value of the boxes in stock is

This operation—multiplying two vectors' entries in pairs and summing—arises often in applications of linear algebra and is also foundational in the theory of linear algebra.

**Definition**

The **dot product** of two vectors in

**Example**

If

One of the most

The dot product also has two fundamental connections to geometry. The first is the identity

for all vectors

**Exercise**

Show that

*Solution.* Using linearity of the dot product, we get

as required.

The second connection between geometry and the dot product pertains to *angle*. If

It follows that **orthogonal**.

**Exercise**

In natural language processing, one basic way to compare a finite number of text documents is to use *vectorized word counts.* Suppose the documents have a combined total of

One way to measure similarity between two documents is to take the dot product of the associated unit vectors: If two documents

By the

The vectorized word count similarity between the sentences

"The rain in Spain falls mainly in the plain"

"The plain lane in Spain is mainly a pain"

is

*Solution.* Listing the words in the order *the, in, rain, Spain, falls, mainly, plain, lane, pain, is, a*, the two vectorized word counts are

**Exercise**

Let

*Solution.* Suppose, for the sake of contradiction, that the vectors are linearly

Then

Since

The same reasoning tells us that none of the vectors in the list can be equal to a linear combination of the others. Therefore the vectors must be linearly

The following exercise illustrates another way of calculating matrix products. We will call it the **matrix product dot formula**:

**Exercise**

Let

*Solution.* By the

Calculating all eight such dot products, we find that

## Block multiplication

A **block matrix** is a matrix defined using smaller matrices which are called **blocks**. For example, suppose that

Then the block matrix

The advantage of writing a matrix in block form is that we can formally carry out the matrix multiplication dot formula, treating the blocks as matrix entries, and we get the correct result (in block form). For example,

if **block matrix product formula**.

**Exercise**

Verify the matrix product block formula above with

*Solution.* We have

while

So the block matrix product formula checks out.

**Exercise**

Show that if

*Solution.* This follows directly from the block matrix product formula by writing