Dot Product (Vector): Definition, Formula, How to Find (w/ Diagrams & Examples)

••• Dana Chen | Sciencing

The product of two scalar quantities is a scalar, and the product of a scalar with a vector is a vector, but what about the product of two vectors? Is it a scalar, or another vector? The answer is, it could be either!

There are two ways to multiply vectors together. One is by taking their dot product, which yields a scalar, and the other is by taking their cross product, which yields another vector. Which product to use depends on the particular scenario and what quantity you are trying to find.

The ​dot product​ is sometimes referred to as the ​scalar product​ or ​inner product​. Geometrically, you can think of the dot product between two vectors as a way of multiplying the vector values that only counts the same-direction contributions.

  • Note: Dot products may be negative or positive, but that sign is not an indication of direction. Although in one dimension, vector direction is often indicated with sign, scalar quantities can also have signs associated with them that are not direction indicators. Debt is just one of many examples of this.

Definition of the Dot Product

The dot product of vectors ​a​ ​= (ax, ay)​ and ​b​ ​= (bx, by)​ in a standard Cartesian coordinate system is defined as follows:

\bold{a\cdot b} = a_xb_x + a_yb_y

When you take the dot product of a vector with itself, an interesting relationship emerges:

\bold{a\cdot a} = a_xa_x + a_ya_y = |\bold{a}|^2

Where |​a​| is the magnitude (length) of ​a​ by the Pythagorean theorem.

Another dot product formula can be derived using the law of cosines. This is done as follows:

Consider non zero vectors ​a​ and ​b​ together with their difference vector ​a - b​. Arrange the three vectors to form a triangle.

The law of cosines from trigonometry tells us that:

|\bold{a-b}|^2 = |\bold{a}|^2 + |\bold{b}|^2 - 2|\bold{a}||\bold{b}|\cos(\theta)

And using the definition of the dot product we get:

|\bold{a-b}|^2 = (\bold{a-b})\cdot (\bold{a-b}) = (a_x-b_X)^2 + (a_y-b_y)^2\\ = (a_x)^2 + (b_x)^2 - 2a_xb_x + (a_y)^2 + (b_y)^2 - 2a_yb_y\\ = |\bold{a}|^2 + |\bold{b}|^2 - 2\bold{a \cdot b}

Setting both expressions equal and then simplifying, we get:

\cancel{|\bold{a}|^2} + \cancel{|\bold{b}|^2} - 2\bold{a \cdot b} = \cancel{|\bold{a}|^2} + \cancel{|\bold{b}|^2} - 2|\bold{a}||\bold{b}|\cos(\theta)\\\text{ }\\\implies \boxed{\bold{a \cdot b} = |\bold{a}||\bold{b}|\cos(\theta)}

This formulation allows for our geometric intuition to come into play. The quantity |​a​|cos(θ) is the magnitude of the projection of vector ​a​ onto vector ​b​.

So we can think of the dot product as the projection of one vector onto the other, and then the product of their values. In other words, it can be seen as the product of one vector with the amount of the other vector in the same direction as itself.

Properties of the Dot Product

The following are several properties of the dot product that you might find useful:

\#\text{1. If } \theta = 0\text{, then } \bold{a \cdot b} = |\bold{a}||\bold{b}|

This is because cos(0) = 1.

\#\text{2. If } \theta = 180\text{, then }\bold{a \cdot b} = -|\bold{a}||\bold{b}|

This is because cos(180) = -1.

\#\text{3. If } \theta = 90\text{, then } \bold{a \cdot b} = 0

This is because cos(90) = 0.

  • Note: For 0 <

θ

< 90, the dot product will be positive, and for 90 <

θ

< 180, the dot product will be negative.

\#\text{4. } \bold{a\cdot b} = \bold{b\cdot a}

This follows from applying the commutative law to the dot product definition.

\#\text{5. } \bold{a\cdot (b+c)} = \bold{a\cdot b} + \bold{a\cdot c}

Proof:

\bold{a\cdot (b+c)} = \bold{a}\cdot(b_x + c_x, b_y + c_y) \\ =a_x(b_x + c_x) + a_y(b_y + c_y)\\ = a_xb_x + a_xc_x + a_yb_y + a_yc_y \\ = (a_xb_x + a_yb_y) + (a_xc_x + a_yc_y)\\ = \bold{a\cdot b} + \bold{a\cdot c}
\#\text{6. } c(\bold{a\cdot b}) = (c\bold{a})\cdot \bold{b}

Proof:

c(\bold{a\cdot b}) = c(a_xb_x + a_yb_y)\\ = ca_xb_x + ca_yb_y\\ = (ca_x)b_x + (ca_y)b_y\\ = (c\bold{a})\cdot \bold{b}

How to Find the Dot Product

Example 1:​ In physics, work done by a force ​F​ on an object as it undergoes displacement ​d​, is defined as:

W=\bold{F}\cdot \bold{d} = |\bold{F}||\bold{d}|\cos(\theta)

Where θ is the angle between the force vector and the displacement vector.

The amount of work done by a force is an indication of how much that force contributed to the displacement. If the force is in the same direction as the displacement (cos(θ) = 0), it makes its maximum contribution. If it is perpendicular to the displacement (cos(​Ѳ​) = 90), it makes no contribution at all. And if it is opposite the displacement, (cos(θ) = 180), it makes a negative contribution.

Suppose a child pushes a toy train across a track by applying a force of 5 N at an angle of 25 degrees with respect to the line of the track. How much work does the child do on the train when she moves it 0.5 m?

Solution:

F = 5 \text{ N}\\ d = 0.5\text{ m}\\ \theta = 25\degree\\

Using the dot product definition of work, and plugging in values we then get:

W = Fd\cos(\theta) = 5\times0.5\times\cos(25) = \boxed{2.27\text{ J}}

From this concrete example, it should be even clearer that applying a force perpendicular to the direction of displacement does no work. If the child pushed the train at a right angle to the track the train will not move either forward or backwards along the track. It is also intuitive that the work done by the child on the train will increase as the angle decreases and the force and displacement are closer to alignment.

Example 2:​ Power is another example of a physical quantity that can be calculated using a dot product. In physics, power equals work divided by time, but it can also be written as the dot product of force and velocity as shown:

P = \frac{W}{t} = \frac{\bold{F\cdot d}}{t} = \bold{F}\cdot \frac{\bold{d}}{t} = \bold{F\cdot v}

Where ​v​ is velocity.

Consider the previous example of the child playing with the train. If instead we are told the same force is applied causing the train to move at 2 m/s down the track, then the we can use the dot product to find the power:

P = \bold{F\cdot v} = Fv\cos(\theta) = 5\times2\times\cos(25) = 9.06\text{ Watts}

Example 3:​ Another example where dot products are used in physics is in the case of magnetic flux. Magnetic flux is the amount of magnetic field passing through a given area. It is found as the dot product of the magnetic field ​B​ with the area ​A​. (The direction of an area vector is ​normal​, or perpendicular, to the surface of the area.)

\Phi=\bold{B\cdot A}

Suppose a field of 0.02 Tesla passes through a wire loop of radius 10 cm, making an angle of 30 degrees with the normal. What is the flux?

\Phi=\bold{B\cdot A} = BA\cos(\theta) = 0.02\times(\pi\times0.1^2)\times\cos(30) = 0.000544\text{ Wb}

When this flux changes, either by changing the field value, changing the loop area or changing the angle by rotating the loop or field source, current will be induced in the loop, generating electricity!

Again note how the angle is relevant in an intuitive way. If the angle was 90 degrees, this would mean the field would lie along the same plane as the area and no field lines would pass through the loop, resulting in no flux. The amount of flux then increases the closer the angle between the field and the normal gets to 0. The dot product allows us to determine how much of the field is in the direction normal to the surface, and is hence contributing to the flux.

Vector Projection and the Dot Product

In earlier sections, it was mentioned that the dot product can be thought of as a way of projecting one vector onto another and then multiplying their magnitudes. As such, it shouldn't be surprising that a formula for vector projection can be derived from the dot product.

In order to project vector ​a​ onto vector ​b​, we take the dot product of ​a​ with a ​unit vector​ in the direction of ​b​, and then multiply this scalar result by the same unit vector.

A unit vector is a vector of length 1 that lies in a particular direction. The unit vector in direction of vector ​b​ is simply vector ​b​ divided by its magnitude:

\frac{\bold{b}}{|\bold{b}|}

So this projection is then:

\text{Projection of }\bold{a}\text{ onto }\bold{b} = \Big(\bold{a}\cdot\frac{\bold{b}}{|\bold{b}|}\Big)\frac{\bold{b}}{|\bold{b}|} = \Big(\bold{a}\cdot\frac{\bold{b}}{|\bold{b}|^2}\Big)\bold{b}

The Dot Product in Higher Dimension

Just as vectors exist in higher dimension, so too does the dot product. Imagine the example of the child pushing the train again. Suppose she pushes both downwards and at an angle to the side of the track. In a standard coordinate system, the force and displacement vectors would need to be represented as three-dimensional.

In ​n​ dimensions, the dot product is defined as follows:

\bold{a\cdot b} = \overset{n}{\underset{i=1}{\sum }}a_ib_i = a_1b_1 + a_2b_2 +...+ a_nb_n

All of the same dot product properties from before still apply, and the law of cosines once again gives the relationship:

\bold{a \cdot b} = |\bold{a}||\bold{b}|\cos(\theta)

Where the magnitude of each vector is found via the following, again consistent with the Pythagorean theorem:

|\bold{a}|=\sqrt{\bold{a\cdot a}}=\sqrt{(a_1)^2+(a_2)^2+...+(a_n)^2}

How to Find the Dot Product in Three Dimensions

Example 1:​ The dot product is particularly useful when needing to find the angle between two vectors. For example, suppose we want to determine the angle between ​a​ = (2, 3, 2) and ​b​ = (1, 4, 0). Even if you sketch those two vectors in 3-space, it can be very difficult to wrap your head around the geometry. But the mathematics is fairly straightforward, using the fact that:

\bold{a \cdot b}=|\bold{a}||\bold{b}|\cos(\theta)\\\implies \theta=\cos^{-1}\Big(\frac{\bold{a\cdot b}}{|\bold{a}||\bold{b}|}\Big)

Then computing the dot product of ​a​ and ​b​:

\bold{a\cdot b}=2\times1+3\times4+2\times0=14

And computing the magnitudes of each vector:

|\bold{a}|=\sqrt{2^2+3^2+2^2}=\sqrt{17}=4.12\\|\bold{b}|=\sqrt{1^2+4^2+0^2}=\sqrt{17}=4.12

And finally plugging everything in, we get:

\theta=\cos^{-1}\Big(\frac{\bold{a\cdot b}}{|\bold{a}||\bold{b}|}\Big)=\cos^{-1}\Big(\frac{14}{4.12\times 4.12}\Big)=\boxed{34.4\degree}

Example 2:​ A positive charge sits at the coordinate point (3, 5, 4) in three-dimensional space. At what point along the line pointing in the direction of vector ​a​ = (6, 9, 5) is the electric field the greatest?

Solution: From our knowledge of how electric field strength relates to distance, we know that the point on the line that is closest to the positive charge is the location where the field will be the strongest. From our knowledge of dot products, we might guess that using the projection formula makes sense here. That formula should give us a vector whose tip is exactly at the point we are looking for.

We need to compute:

\text{Projection of }(3, 5, 4)\text{ onto }\bold{a}=\Big((3,5,4)\cdot\frac{\bold{a}}{|\bold{a}|^2}\Big)\bold{a}

To do so, first, lets find |​a​|2:

|\bold{a}|^2=6^2+9^2+5^2=142

Then the dot product:

(3,5,4)\cdot (6,9,5)=3\times6+5\times9+4\times5=83

Dividing this by |​a​|2 gives 83/142 = 0.585. Then multiplying this scalar by ​a​ gives:

0.585\bold{a}=0.585 \times (6,9,5)=(3.51,5.27,2.93)

Hence the point along the line where the field is the strongest is (3.51, 5.27, 2.93).

Related Articles

Cross Product (Vector): Definition, Formula, Properties...
How to Multiply Vectors
How to Find a Plane With 3 Points
What is a Vector?
How to Find the Area of a Parallelogram With Vertices
How to Find the Magnitude When Force & Angle Is Given?
How to Add & Subtract Vectors (w/ Diagrams)
How to Multiply a Negative Variable With a Positive...
What Are 3 Similarities Between Magnets and Electricity?
How to Calculate Tension & Deflection in a Rod
How to Calculate Electric Potential Energy
How to Calculate the Total Magnitude of Displacement
How to Find a Vector That Is Perpendicular
What is Electromagnetic Force?
What Makes Magnets Repel?
How to Calculate Resultant Forces
What Is the Strength of Two Magnets Together?
How to Calculate a Point Load
Electric Field: Definition, Units, Formula, Lines,...