How to find the dot product and length of a vector

A dot product takes two vectors and gives us a single number. We find it by multiplying the components in matching positions and adding the products. Let’s use that calculation to find a dot product, then the length of a vector.

Multiply matching components and add

For two vectors with the same number of components, use u·v=u1v1+u2v2+⋯+unvn. For example, let u=(3,4) and v=(-1,2).

u·v=3(-1)+4(2)=-3+8=5

Dot a vector with itself to find its squared length

If both vectors are u, each product becomes a square. That gives u·u=‖u‖2. Taking the nonnegative square root gives the length.

(3,4)·(3,4)=32+42=25‖(3,4)‖=25=5

Use the same process in more dimensions

For w=(2,-3,4,0), square and add all four components.

w·w=22+(-3)2+42+02=29‖w‖=29

The order of a dot product can be reversed, so u·v=v·u. It also distributes across sums of vectors.

Example: Find dot products in two and three dimensions

For a=(2,1) and b=(6,-2), multiply the two pairs of matching components.

a·b=2(6)+1(-2)=10

The same process works with a third component. If c=(2,-6,1) and d=(0,2,-3), we get

c·d=2(0)+(-6)(2)+1(-3)=-15

Use a zero dot product to recognize perpendicular vectors

Two nonzero vectors are perpendicular exactly when their dot product is zero. For example, (2,1)·(1,-2)=2-2=0, so those directions form a right angle. The zero vector also has dot product zero with every vector, but it has no direction and does not define an angle.