# What is the use of the Dot Product of two vectors?

Suppose you have two vectors a and b that you want to take the dot product of, now this is done quite simply by taking each corresponding coordinate of each vector, multiplying them and then adding the result together. At the end of performing our operation we are left with a constant number.

My question therefore is what can we do with this number,why do we calculate it so to speak? I mean it seems almost useless to me compared with the cross product of two vectors (where you end up with an actual vector).

-
You can use it to find the angle between any two vectors. $\mathbf{a}\cdot\mathbf{b}=|\mathbf{a}||\mathbf{b}|\cos\theta$ where $\theta$ is the angle between the two vectors. This is a better approach than using the cross product as the cross product can only be defined in a few dimensions (normally only 3 dimensions). Obviously this is just one simple use of the dot product which is a special case of a more general phenomenon known as an inner product en.wikipedia.org/wiki/Inner_product_space . –  Daniel Rust Jun 8 '13 at 15:35
You should take a look at how it is derived as it can be very enlightening. Take a look at Lang's Linear Algebra (2E) pg.19-20. –  12F8031 Jun 8 '13 at 20:18
I always found that the dot product is a good way to measure how "parallel" two vectors are –  Dan Jun 9 '13 at 7:15

Re: "[the dot product] seems almost useless to me compared with the cross product of two vectors ".

Please see the Wikipedia entry for Dot Product to learn more about the significance of the dot-product, and for graphic displays which help visualize what the dot product signifies (particularly the geometric interpretation). Also, you'll learn more there about how it's used. E.g., Scroll down to "Physics" (in the linked entry) to read some of its uses:

Mechanical work is the dot product of force and displacement vectors.
Magnetic flux is the dot product of the magnetic field and the area vectors.


You've shared the algebraic definition of the dot product: how to compute it as the sum of the product of corresponding entries in two vectors: essentially, computing $\;\mathbf A \cdot \mathbf B = {\mathbf A}{\mathbf B}^T.\;$ But the dot product also has an equivalent geometric definition:

In Euclidean space, a Euclidean vector is a geometrical object that possesses both a magnitude and a direction. A vector can be pictured as an arrow. Its magnitude is its length, and its direction is the direction the arrow points. The magnitude of a vector A is denoted by $\|\mathbf{A}\|.$ The dot product of two Euclidean vectors A and B is defined by

$$\mathbf A\cdot\mathbf B = \|\mathbf A\|\,\|\mathbf B\|\cos\theta,\quad\text{where \theta is the angle between A and B.} \tag{1}$$

With $(1)$, e.g., we see that we can compute (determine) the angle between two vectors, given their coordinates: $$\cos \theta = \frac{\mathbf A\cdot\mathbf B}{\|\mathbf A\|\,\|\mathbf B\|}$$

-
I am not stating what the dot product signifies, in fact that is the essence of this question, I did not know that the dot product has an equivalent geometric definition, or that it could be used to calculate the angle between two vectors that is extremely useful. –  Jonn_Underwood Jun 8 '13 at 15:45
I didn't intend to criticize. I'm sorry if that's how the post comes across! Indeed, I upvoted the question because it's a fine question, and you put thought into writing it. –  amWhy Jun 8 '13 at 15:47
The dot product is also the product $\bf A B^T$ of vector A with the transpose of vector B. –  amWhy Jun 8 '13 at 15:49
@amWhy: Thank you, I had an upvote mind - trigger finger! :-) Fixed! –  Amzoti Jun 9 '13 at 1:37
@amWhy thank you for your suburb answer , and also thank you for adding that formula at the bottom for finding the cosine of theta this alone is extremely useful to me due to my pursuit of physics! –  Jonn_Underwood Jun 9 '13 at 21:24
show 1 more comment

The original motivation is a geometric one: The dot product can be used for computing the angle $\alpha$ between two vectors $a$ and $b$:

$a\cdot b=|a|\cdot|b|\cdot \cos(\alpha)$.

Note the sign of this expression depends only on the angle's cosine, therefore the dot product is

• $<0$ if the angle is obtuse,
• $>0$ if the angle is acute,
• $=0$ if the $a$ and $b$ are orthogonal.

Another important special case appears when $a=b$: The root of the scalar product of a vector with itself is the length of a vector:

$a\cdot a=|a|\cdot|a|\cdot1=|a|^2$.

There's another interesting application of the dot product, in combination with the cross product: If you have three vectors $a$, $b$ and $c$, they define a parallelepiped, and you can compute its (signed) volume $V$ as follows using the so-called scalar triple product:

$V=(a\times b)\cdot c$

(Note that this is a generalization of $|a\times b|$ being the area of the parallelogram defined by $a$ and $b$.)

-
There's nothing special about 2d/3d here; this means of finding the angle between vectors applies to an arbitrary number of dimensions. –  Muphrid Jun 8 '13 at 15:50
@Muphrid: Of course you can define something like an "angle" in arbitrary dimensions. I've changed "geometrical" to "visual", I think that makes more sense. –  zero-divisor Jun 9 '13 at 6:12
Perhaps. But two vectors define only a plane, so even in a 4d space or higher, the geometry basically isn't changing: you have two vectors in some common plane, and the dot product tells us how alike they are. I think you're making it out to be more complicated than it really is. –  Muphrid Jun 9 '13 at 6:17
@Muprid: Good point. I've deleted the sentence now. –  zero-divisor Jun 9 '13 at 6:19

The dot product is an essential ingredient in matrix product. The product of the two matrices $A$ and $B$ (of compatible sizes, that is, the number of columns of $A$ equals the number of rows of $B$) is a matrix whose $(i, j)$ component is the dot product of the $i$-th row of $A$ and the $j$-th column of $B$.

Among the many applications, consider this simple one.

You have students $s_{1}, \dots, s_{n}$ taking courses $c_{1}, \dots, c_{m}$. Consider the matrix $A$ which has $0$ everywhere, except that the $(i,j)$ coefficient is $1$ if the student $s_{j}$ takes the course $c_{i}$. Now note that the dot product of the $i_{1}$-th row of $A$ with the $i_{2}$-th row gives the number of students that take both $c_{i_{1}}$ and $c_{i_{2}}$. In other words, the matrix $A A^{t}$ has in its $(i, j)$ position the number of students taking both $c_{i}$ and $c_{j}$.

This matrix is of course useful in building a course timetable.

-

Before addressing your question, i want to say that this is a very good question and you are right to expect that the dot product has use/significance.

First, it is important that you think about vectors separate from their coordinates. While it is true that we often represent vectors as a series of coordinates along well-defined axes, this is merely for computational reasons. A vector as an idea "exists" in a space without any predefined coordinate system. I say this because there are two definitions of the dot product, one is coordinate free (i.e. $\mathbf a\cdot\mathbf b = \|\mathbf a\|\,\|\mathbf b\|\cos\theta$) and the other is based on coordinates (i.e. $\mathbf a\cdot\mathbf b = \sum_i{a_i b_i}$). Of these two, it is best to think of the dot product in terms of the former as it does not depend on a coordinate system. (It is relatively easy to show that the latter may be derived from the former, but in that derivation is an implicit assumption that the coordinate system being used to represent the dot product is orthogonal.)

Second, given the coordinate-free definition, the fundamental idea of the dot product is that of projection. By this it gives a single number which indicates the component of a vector in the direction of another vector. Your observation of the dissimilarity between the dot and cross product is correct, however, the dot product is used to produce a vector as well, it just does it component-by-component. Let's suppose that we have a vector $\mathbf v$ represented by its components in a given coordinate system. Let's further suppose that we have an orthonormal basis defined in that same coordinate system as the set of column vectors $\{\mathbf u_1, \mathbf u_2, \ldots, \mathbf u_n\}$. Finally, suppose that we want to represent $\mathbf v$ in this basis as $\mathbf w$. The question is how do we do that? We use the dot product of course! So the first component of $\mathbf w$ would then be $w_1 = \mathbf u_1\cdot \mathbf v$, and the second component would be $w_2 = \mathbf u_2\cdot \mathbf v$ and so on. (Note that because $\|\mathbf u_i\| = 1$, we have $\mathbf u_1\cdot \mathbf v= \|\mathbf v\|\cos\theta_i$.) If we then think of the vector $\mathbf w$ defined as such we have

$$\mathbf w = \left[ \begin{array}{c} w_1 \\ w_2 \\ \vdots \\ w_n \end{array} \right] = \left[ \begin{array}{c} \mathbf u_1\cdot \mathbf v \\ \mathbf u_2\cdot \mathbf v \\ \vdots \\ \mathbf u_n\cdot \mathbf v \end{array} \right] = \left[ \begin{array}{c} \mathbf u_1^T \mathbf v \\ \mathbf u_2^T \mathbf v \\ \vdots \\ \mathbf u_n^T \mathbf v \end{array} \right] = \left[ \begin{array}{c} \mathbf u_1^T \\ \mathbf u_2^T \\ \vdots \\ \mathbf u_n^T \end{array} \right]\mathbf v = \left[ \begin{array}{cccc} \mathbf u_1 & \mathbf u_2 & \cdots &\mathbf u_n \end{array} \right]^T\mathbf v$$

Finally, we conclude that the dot product plays a key role in the transformation of a vector from one basis to another and that the dot product is hidden in the definition of matrix multiplication in that one view of a matrix-vector product is that each element in the product represents a dot product between a row of the left and a column of the right.

I hope this helps.

-

The geometric idea of the dot product has been touched upon, but there is a vast generalization of this product in geometric algebra, the algebra of not only oriented lines (vectors) but planes, volumes, and more (called blades).

In geometric algebra, we have a generalized dot product of a vector $a$ and another blade $B$ denoted $a \cdot B$. This product has a simple geometric interpretation as the part of $B$ orthogonal to the projection of $a$, with magnitude $|a||B|| \cos \theta|$, where $\theta$ is the angle $a$ forms with its projection in $B$.

(Note: as a point of fact, $a \cdot B$ is orthogonal to $a$ also, not just its projection into $B$, but thinking about this leads to some difficulties, while thinking about what's perpendicular to the projection does not.)

If $B$ is a 2-blade (also called a bivector), then you should be able to imagine this directly: if $a$ lies entirely in $B$, then $a \cdot B$ is just the vector perpendicular to $a$ in $B$. If $a$ does not lie entirely in $B$, then it can be decomposed into a tangential part and a normal part. We throw away the normal part, and the previous logic applies for the tangential part.

If $B$ is a 3-blade (a trivector), then in 3d space $a$ must lie in $B$ (for there is no 3d volume that a vector does not help span), and the product $a \cdot B$ is the "Hodge dual", or the plane perpendicular to $a$.

In this light, the dot product of vectors may actually be the most non-intuitive part of this reasoning. When you take the dot product, there's only a scalar left--there's no vector or other higher dimensional object left to be orthogonal to $a$. Again, this is why I emphasize that $a \cdot B$ is the part of $B$ orthogonal to the projection of $a$ onto $B$. When $B$ is a vector, it's clear there is no other vector or anything else that can be orthogonal to the projection of $a$, for $B$ and that projection are parallel, so the result is necessarily just a scalar.

-