Linear AlgebraDot and Cross Products1 of 5
Dot and Cross Products · 1

The Dot Product

The dot product measures how much two arrows point in the same direction.

1

What the dot product measures

Given two vectors in coordinates, like [3,1]\first{[3, 1]} and [2,4]\second{[2, 4]}, we can calculate their dot product in seconds by multiplying matching coordinates and adding them up. To see what that number actually means in space, we look at the shadow one arrow casts onto the other.

What the dot product measures
signed shadowlength\htmlClass{lc-pink}{\begin{gathered}\text{signed shadow}\\[-5pt]\text{length}\end{gathered}}
bottom arrowlength\htmlClass{lc-green}{\begin{aligned}&\text{bottom arrow}\\[-5pt]&\text{length}\end{aligned}}

Shining a light at a 90∘90^\circ angle onto the bottom arrow picks out the exact piece of the top arrow that goes along the bottom arrow's line. Multiplying that shadow by the bottom arrow's length gives the dot product:

Dot product\displaystyle \text{Dot product} =(signed shadow length)×(bottom arrow length)\displaystyle = (\second{\text{signed shadow length}}) \times (\first{\text{bottom arrow length}})

As the pulling arrow turns around the starting point of the track, the shadow (and the dot product with it) stays positive while the arrows point mostly the same way, shrinks to zero right at 90∘90^\circ, and turns negative once the pull tilts past 90∘90^\circ.

Turn the pulling arrow to see how its shadow along the track, times the track's length, shrinks to zero at 90° and turns negative past 90°.
2

Why either arrow can cast the shadow

In the shadow formula, we chose one arrow to cast the shadow and the other to catch it. When one arrow is short and the other is long, shining the light onto the second arrow gives a completely different shadow, yet the final dot product comes out to the exact same number either way.

light onto the short arrow
light onto the long arrow
Why either arrow can cast the shadow
dot product=(shadow length)×(bottom arrow length)\begin{aligned} \text{dot product} &= (\second{\text{shadow length}}) \\[-2pt] &\times (\first{\text{bottom arrow length}}) \end{aligned}

Start with two arrows of length 11, where the picture is symmetric and the two shadows are equal. If we stretch one arrow to 33 times its length, its shadow triples when it is the arrow casting the shadow, and its own length triples when it is the arrow catching the shadow. Either way, the product triples. The same happens when we stretch either arrow by any amount, and any two arrows can be made by stretching two arrows of length 11, so it never matters which arrow casts the shadow.

3

Why multiplying coordinates measures the shadow

Measuring a slanted shadow directly on a grid seems to need rulers, square roots, or trigonometry. We can find the shadow dot product of [3,1]\first{[3, 1]} and [2,4]\second{[2, 4]} without any of that by breaking [2,4]\second{[2, 4]} into its horizontal step of 2\second{2} and vertical step of 4\second{4}.

Why multiplying coordinates measures the shadow
x\htmlClass{lc-mute}{x}
y\htmlClass{lc-mute}{y}
[31]\first{\begin{bmatrix} 3 \\ 1 \end{bmatrix}}
[24]\second{\begin{bmatrix} 2 \\ 4 \end{bmatrix}}
?\htmlClass{lc-pink}{?}
Text solution
Find the shadow on the horizontal stepBecause either arrow can cast the shadow, shine [3,1]\first{[3, 1]} onto the x-axis to get a shadow of length 3\first{3}, and multiply by the horizontal step of 2\second{2} from [2,4]\second{[2, 4]}:
(x-shadow of [3,1])×(x-step of [2,4])\displaystyle (\first{\text{x-shadow of } [3, 1]}) \times (\second{\text{x-step of } [2, 4]}) =3×2\displaystyle = \first{3} \times \second{2} =6\displaystyle = 6
Find the shadow on the vertical stepShine [3,1]\first{[3, 1]} onto the y-axis to get a shadow of length 1\first{1}, and multiply by the vertical step of 4\second{4} from [2,4]\second{[2, 4]}:
(y-shadow of [3,1])×(y-step of [2,4])\displaystyle (\first{\text{y-shadow of } [3, 1]}) \times (\second{\text{y-step of } [2, 4]}) =1×4\displaystyle = \first{1} \times \second{4} =4\displaystyle = 4
Add the two piecesBecause the horizontal and vertical steps of [2,4]\second{[2, 4]} go from the same start to the same tip as the diagonal arrow, their two shadow products add up to the full dot product:
[3,1]⋅[2,4]\displaystyle \first{[3, 1]} \cdot \second{[2, 4]} =(3×2)+(1×4)\displaystyle = (\first{3} \times \second{2}) + (\first{1} \times \second{4}) =6+4\displaystyle = 6 + 4 =10\displaystyle = 10

So the shadow dot product of [3,1]\first{[3, 1]} and [2,4]\second{[2, 4]} is 1010, found straight from the coordinates without measuring a single angle.

Because the horizontal and vertical steps go from the same start to the same tip as the diagonal arrow, their shadows on the other arrow's line add up to the full arrow's shadow.

A vector's horizontal and vertical steps start and end where the vector does, so their shadows always add up to the full vector's shadow.
4

Dot products without coordinates

Sometimes we have no grid or coordinates at all, and only know the dot products of two vectors u\first{u} and v\second{v} with themselves and each other: u⋅u=6\first{u} \cdot \first{u} = 6, v⋅v=4\second{v} \cdot \second{v} = 4, and u⋅v=−2\first{u} \cdot \second{v} = -2. We can still find the dot product of combinations like (u+2v)⋅(3u−v)(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) because the dot product follows the same rules as ordinary multiplication for expanding brackets.

Dot products without coordinates
u⋅u=6v⋅v=4u⋅v=−2\displaystyle \begin{aligned} \first{u} \cdot \first{u} &= 6 \\ \second{v} \cdot \second{v} &= 4 \\ \first{u} \cdot \second{v} &= -2 \end{aligned}
(u+2v)⋅(3u−v)\displaystyle (\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) =  ?\displaystyle = \;?

Because either arrow can cast the shadow, tip-to-tail steps add their shadows, and stretching an arrow scales its shadow by the same number, three algebra rules always hold:

u⋅v=v⋅u(Order doesn’t matter)u⋅(v+w)=u⋅v+u⋅w(Splits over a sum)(cu)⋅v=c(u⋅v)(Numbers pull out front)\displaystyle \begin{aligned} \first{u} \cdot \second{v} &= \second{v} \cdot \first{u} \\ &\quad \text{(Order doesn't matter)} \\[6pt] \first{u} \cdot (\second{v} + \third{w}) &= \first{u} \cdot \second{v} + \first{u} \cdot \third{w} \\ &\quad \text{(Splits over a sum)} \\[6pt] (c\first{u}) \cdot \second{v} &= c(\first{u} \cdot \second{v}) \\ &\quad \text{(Numbers pull out front)} \end{aligned}
Text solution
Multiply out the brackets and pull numbers out frontMultiply each piece in (u+2v)(\first{u} + 2\second{v}) with each piece in (3u−v)(3\first{u} - \second{v}):
(u+2v)⋅(3u−v)=3(u⋅u)−(u⋅v)+6(v⋅u)−2(v⋅v)\displaystyle \begin{aligned} &(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) \\ &\quad = 3(\first{u} \cdot \first{u}) - (\first{u} \cdot \second{v}) \\ &\qquad + 6(\second{v} \cdot \first{u}) - 2(\second{v} \cdot \second{v}) \end{aligned}
Rewrite v⋅u\second{v} \cdot \first{u} as u⋅v\first{u} \cdot \second{v} and combine the middle termsSince order doesn't matter, v⋅u\second{v} \cdot \first{u} is the same as u⋅v\first{u} \cdot \second{v}:
=3(u⋅u)−(u⋅v)+6(u⋅v)−2(v⋅v)=3(u⋅u)+5(u⋅v)−2(v⋅v)\displaystyle \begin{aligned} &= 3(\first{u} \cdot \first{u}) - (\first{u} \cdot \second{v}) \\ &\quad + 6(\first{u} \cdot \second{v}) - 2(\second{v} \cdot \second{v}) \\ &= 3(\first{u} \cdot \first{u}) + 5(\first{u} \cdot \second{v}) - 2(\second{v} \cdot \second{v}) \end{aligned}
Plug in the given valuesPut in u⋅u=6\first{u} \cdot \first{u} = 6, u⋅v=−2\first{u} \cdot \second{v} = -2, and v⋅v=4\second{v} \cdot \second{v} = 4:
=3(6)+5(−2)−2(4)\displaystyle = 3(6) + 5(-2) - 2(4) =18−10−8\displaystyle = 18 - 10 - 8 =0\displaystyle = 0

So (u+2v)⋅(3u−v)=0(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) = 0, worked out without any coordinates.

5

Spotting right angles and opposite directions

In the problem above, (u+2v)⋅(3u−v)(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) came out to 00. Because multiplying coordinates and measuring shadows give the exact same number, we can use quick coordinate math to check whether two arrows in 2D or 3D meet at a 90∘90^\circ right angle or point mostly opposite ways.

Spotting right angles and opposite directions
[−42]⋅[12]=  ?\displaystyle \first{\begin{bmatrix} -4 \\ 2 \end{bmatrix}} \cdot \second{\begin{bmatrix} 1 \\ 2 \end{bmatrix}} = \;?
perpendicular?\displaystyle \text{perpendicular?}
Text solution
Check for a dot product of 00 to spot a right angleFor the 3D vectors [2,5,−3]\first{[2, 5, -3]} and [4,−1,1]\second{[4, -1, 1]}, multiply matching coordinates and add:
[2,5,−3]⋅[4,−1,1]=(2×4)+(5×−1)+(−3×1)=8−5−3=0\displaystyle \begin{aligned} &\first{[2, 5, -3]} \cdot \second{[4, -1, 1]} \\ &\quad = (\first{2} \times \second{4}) + (\first{5} \times \second{-1}) \\ &\qquad + (\first{-3} \times \second{1}) \\ &\quad = 8 - 5 - 3 = 0 \end{aligned}
Because neither arrow has length 00, a dot product of 00 means the shadow has length 00, so [2,5,−3]\first{[2, 5, -3]} and [4,−1,1]\second{[4, -1, 1]} are perpendicular at 90∘90^\circ (just as [−4,2]⋅[1,2]=−4+4=0\first{[-4, 2]} \cdot \second{[1, 2]} = -4 + 4 = 0 and (u+2v)⋅(3u−v)=0(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) = 0 showed those pairs are perpendicular).
Check for a negative sign to spot opposite directionsFor [1,−4,2]\first{[1, -4, 2]} and [−3,2,1]\second{[-3, 2, 1]}, multiply matching coordinates and add:
[1,−4,2]⋅[−3,2,1]=(1×−3)+(−4×2)+(2×1)=−3−8+2=−9\displaystyle \begin{aligned} &\first{[1, -4, 2]} \cdot \second{[-3, 2, 1]} \\ &\quad = (\first{1} \times \second{-3}) + (\first{-4} \times \second{2}) \\ &\qquad + (\first{2} \times \second{1}) \\ &\quad = -3 - 8 + 2 = -9 \end{aligned}

Because the result is negative (just like [2,3]⋅[−5,1]=−10+3=−7\first{[2, 3]} \cdot \second{[-5, 1]} = -10 + 3 = -7), the shadow points backward, meaning the two 3D arrows are tilted more than 90∘90^\circ apart and point mostly opposite ways.

6

Unit vectors, shadow length, and the angle between vectors

The full dot product multiplies the shadow of b\second{b} by the length of the receiving arrow a\first{a}. When we want the actual length of the shadow itself along a rail or wall, we need to divide out that receiving arrow's length, and when we want the exact angle θ\theta between two vectors, we divide out both arrows' lengths.

Unit vectors, shadow length, and the angle between vectors
[43]\second{\begin{bmatrix} 4 \\ 3 \end{bmatrix}}
?\htmlClass{lc-pink}{?}

If the receiving direction arrow a\first{a} has length 1\first{1}, multiplying by its length changes nothing, so the dot product gives the shadow length directly:

b⋅a⏟unit vector (length 1)\displaystyle \second{b} \cdot \underbrace{\first{a}}_{\first{\text{unit vector (length } 1\text{)}}} =(Shadow of b)×1\displaystyle = (\second{\text{Shadow of } b}) \times \first{1} =Shadow of b\displaystyle = \second{\text{Shadow of } b}

So whenever a rail's direction is given by a unit vector of length 1\first{1}, dotting a motion arrow with that unit vector gives the signed shadow length along the rail right away.

When the rail arrow has length 1, the dot product is just the shadow's length along the rail, positive or negative.

When both arrows have length 11, the right triangle gives cos⁡θ\cos\theta for the shadow length. Stretching the arrows to any lengths multiplies that shadow by (Length of b)(\second{\text{Length of } b}) and then multiplies the dot product by (Length of a)(\first{\text{Length of } a}):

Length of b\htmlClass{lc-pink}{\text{Length of } b}
Length of a\htmlClass{lc-green}{\text{Length of } a}
(Length of b)×cos⁡θ\htmlClass{lc-pink}{(\text{Length of } b)} \times \cos\theta
θ\theta
a⋅b\displaystyle \first{a} \cdot \second{b} =(Length of a)×(Length of b)×cos⁡θ⏟Shadow of b\displaystyle = (\first{\text{Length of } a}) \times \underbrace{(\second{\text{Length of } b}) \times \cos\theta}_{\second{\text{Shadow of } b}}

Dividing the dot product by both lengths leaves cos⁡θ\cos\theta:

cos⁡θ\displaystyle \cos\theta =a⋅b(Length of a)×(Length of b)\displaystyle = \frac{\first{a} \cdot \second{b}}{(\first{\text{Length of } a}) \times (\second{\text{Length of } b})}

If a question only asks whether two arrows are perpendicular or point mostly the same or opposite ways, don't spend time computing lengths or cos⁡θ\cos\theta. Arrow lengths are always positive, so the sign of a⋅b\first{a} \cdot \second{b} already answers the question.

7

Measuring how well lists of numbers line up

Because multiplying matching numbers and adding works on any two lists of numbers, we can use the dot product to measure how well two profiles match, such as a viewer's taste vector [4,−3,5]\first{[4, -3, 5]} and a movie's vector [5,−2,2]\second{[5, -2, 2]} across [Action,Comedy,Sci-Fi][\text{Action}, \text{Comedy}, \text{Sci-Fi}], even when there are no arrows in space.

Measuring how well lists of numbers line up
5\htmlClass{lc-mute}{5}
0\htmlClass{lc-mute}{0}
−5\htmlClass{lc-mute}{-5}
Action\text{Action}
Comedy\text{Comedy}
Sci-Fi\text{Sci-Fi}
4\htmlClass{lc-green}{4}
5\htmlClass{lc-pink}{5}
−3\htmlClass{lc-green}{-3}
−2\htmlClass{lc-pink}{-2}
5\htmlClass{lc-green}{5}
2\htmlClass{lc-pink}{2}
[4−35]taste⋅[5−22]movie=  ?\overset{\textstyle\first{\text{taste}}}{\first{\begin{bmatrix} 4 \\ -3 \\ 5 \end{bmatrix}}} \cdot \overset{\textstyle\second{\text{movie}}}{\second{\begin{bmatrix} 5 \\ -2 \\ 2 \end{bmatrix}}} = \;?
Text solution
Multiply matching scoresMultiply the viewer's rating by the movie's rating in each genre. Notice that the viewer dislikes comedy and the movie avoids it, so both Comedy numbers are negative, and two negative numbers multiply to a positive:
Action: 4×5=20,Comedy: (−3)×(−2)=+6,Sci-Fi: 5×2=10\displaystyle \begin{aligned} & \text{Action: } & \first{4} \times \second{5} &= 20, \\ & \text{Comedy: } & (\first{-3}) \times (\second{-2}) &= +6, \\ & \text{Sci-Fi: } & \first{5} \times \second{2} &= 10 \end{aligned}
Add the products for the total scoreAdd the three genre scores together:
[4,−3,5]⋅[5,−2,2]\displaystyle \first{[4, -3, 5]} \cdot \second{[5, -2, 2]} =20+6+10\displaystyle = 20 + 6 + 10 =36\displaystyle = 36

So the dot product is 3636: a high positive score showing that the movie and the viewer's tastes line up strongly.

Key concepts

Every dot product problem connects the fast coordinate sum to the shadow picture:

Coordinate sum\displaystyle \text{Coordinate sum} =(Shadow of b)⏟Length of b×cos⁡θ×(Length of a)\displaystyle = \underbrace{(\second{\text{Shadow of } b})}_{\second{\text{Length of } b} \times \cos\theta} \times (\first{\text{Length of } a})
When you have coordinates or lists of numbers

multiply matching numbers and add, like [3,1]⋅[2,4]=(3×2)+(1×4)=10\first{[3, 1]} \cdot \second{[2, 4]} = (\first{3} \times \second{2}) + (\first{1} \times \second{4}) = 10. Two negatives multiply to a positive and raise the score just like two positives.

When you only need to know how the directions compare (<90∘< 90^\circ, 90∘90^\circ, or >90∘> 90^\circ)

stop right after finding a⋅b\first{a} \cdot \second{b} and check its sign: [−4,2]⋅[1,2]=0\first{[-4, 2]} \cdot \second{[1, 2]} = 0 means perpendicular (90∘90^\circ), positive means mostly the same way (<90∘< 90^\circ), and [2,3]⋅[−5,1]=−7\first{[2, 3]} \cdot \second{[-5, 1]} = -7 means mostly opposite ways (>90∘> 90^\circ). Do not calculate lengths or cos⁡θ\cos\theta when only the sign is needed.

When you want the shadow length or the exact angle θ\theta

check the receiving arrow's length first. If the direction is already a unit vector of length 1\first{1}, the dot product is the shadow length directly (b⋅a=Shadow of b\second{b} \cdot \first{a} = \second{\text{Shadow of } b}). If the arrows have other lengths, divide by the receiving length for the shadow, or divide by both lengths for the angle:

cos⁡θ\displaystyle \cos\theta =a⋅b(Length of a)×(Length of b)\displaystyle = \frac{\first{a} \cdot \second{b}}{(\first{\text{Length of } a}) \times (\second{\text{Length of } b})}

When no coordinates are given

multiply out brackets like ordinary algebra, pull numbers out front, and rewrite v⋅u\second{v} \cdot \first{u} as u⋅v\first{u} \cdot \second{v}, as in (u+2v)⋅(3u−v)(\first{u} + 2\second{v}) \cdot (3\first{u} - \second{v}) =3(u⋅u)+5(u⋅v)−2(v⋅v){}= 3(\first{u} \cdot \first{u}) + 5(\first{u} \cdot \second{v}) - 2(\second{v} \cdot \second{v}).

8

Practice

1

Find the dot product of [4,−3]\first{[4, -3]} and [−2,1]\second{[-2, 1]}, and state whether the two arrows point mostly the same way, are perpendicular, or point mostly opposite ways.

Multiply the first coordinates together, multiply the second coordinates together, add them, and look at the sign of the total.

Multiply matching coordinates and add:
[4,−3]⋅[−2,1]\displaystyle \first{[4, -3]} \cdot \second{[-2, 1]} =(4×−2)+(−3×1)\displaystyle = (\first{4} \times \second{-2}) + (\first{-3} \times \second{1}) =−8+(−3)\displaystyle = -8 + (-3) =−11\displaystyle = -11
Watch the negative sign on (−3)×1=−3(\first{-3}) \times \second{1} = -3 (dropping that minus sign gives −8+3=−5-8 + 3 = -5, and multiplying the wrong pairs 4×1+(−3)×(−2)\first{4} \times \second{1} + (\first{-3}) \times (\second{-2}) gives +10+10, which gets the direction backward). Because the dot product is negative, the shadow points backward and the arrows point mostly opposite ways.
2

A viewer's taste vector across [Action,Comedy,Sci-Fi][\text{Action}, \text{Comedy}, \text{Sci-Fi}] is [3,−4,2]\first{[3, -4, 2]}. Movie A has ratings [2,−3,1]\second{[2, -3, 1]} and Movie B has ratings [5,2,3]\third{[5, 2, 3]}. Find the dot product for each movie and state which movie lines up better with the viewer's taste.

Take the dot product of [3,−4,2]\first{[3, -4, 2]} with each movie's vector separately, paying close attention to what happens when both the viewer and the movie give Comedy a negative score.

For Movie A:
[3,−4,2]⋅[2,−3,1]=(3×2)+(−4×−3)+(2×1)=6+12+2=20\displaystyle \begin{aligned} &\first{[3, -4, 2]} \cdot \second{[2, -3, 1]} \\ &\quad = (\first{3} \times \second{2}) + (\first{-4} \times \second{-3}) \\ &\qquad + (\first{2} \times \second{1}) \\ &\quad = 6 + 12 + 2 = 20 \end{aligned}
In the Comedy spot, the viewer dislikes comedy and Movie A avoids it, so both numbers are negative, and two negatives multiply to a positive: (−4)×(−3)=+12(\first{-4}) \times (\second{-3}) = +12 (keeping the minus sign to write −12-12 gives 6−12+2=−46 - 12 + 2 = -4 and picks Movie B by mistake). For Movie B:
[3,−4,2]⋅[5,2,3]=(3×5)+(−4×2)+(2×3)=15−8+6=13\displaystyle \begin{aligned} &\first{[3, -4, 2]} \cdot \third{[5, 2, 3]} \\ &\quad = (\first{3} \times \third{5}) + (\first{-4} \times \third{2}) \\ &\qquad + (\first{2} \times \third{3}) \\ &\quad = 15 - 8 + 6 = 13 \end{aligned}
Movie A gives 2020 and Movie B gives 1313, so Movie A lines up better.
3

Arrow a\first{a} has length 44 and arrow b\second{b} has length 1010. When light shines at 90∘90^\circ to a\first{a}, arrow b\second{b} casts a shadow of length 55 pointing along a\first{a}. What is a⋅b\first{a} \cdot \second{b}, and how long is the shadow of a\first{a} when light shines at 90∘90^\circ to b\second{b}?

Use (shadow of b on a)×(Length of a)(\second{\text{shadow of } b \text{ on } a}) \times (\first{\text{Length of } a}) to find a⋅b\first{a} \cdot \second{b} first, then use the fact that shining light the other way must give the exact same dot product.

Multiply the shadow of b\second{b} (5\second{5}) by the receiving arrow a\first{a}'s length (4\first{4}), not by b\second{b}'s own length 10\second{10}, which would give 5050:
a⋅b\displaystyle \first{a} \cdot \second{b} =5×4\displaystyle = \second{5} \times \first{4} =20\displaystyle = 20
When light shines at 90∘90^\circ to b\second{b}, the dot product is still 2020, and now b\second{b} (length 10\second{10}) is the receiving arrow (don't assume the two shadows have the same length 55):
(Shadow of a on b)×10\displaystyle (\first{\text{Shadow of } a \text{ on } b}) \times \second{10} =20\displaystyle = 20
So a⋅b=20\first{a} \cdot \second{b} = 20, and the shadow of a\first{a} on b\second{b} has length 22.
4

Find the value of k\second{k} that makes the 3D vectors [3,−2,4]\first{[3, -2, 4]} and [2,k,−1]\second{[2, k, -1]} perpendicular.

What number must the dot product equal when two non-zero vectors meet at 90∘90^\circ?

Set the coordinate dot product equal to 00, keeping the negative sign on −2\first{-2} in (−2)×k=−2k(\first{-2}) \times \second{k} = -2\second{k} (writing +2k+2\second{k} gives 2+2k=02 + 2\second{k} = 0 and the wrong sign k=−1\second{k} = -1):
(3×2)+(−2×k)+(4×−1)=6−2k−4=2−2k=0\displaystyle \begin{aligned} &(\first{3} \times \second{2}) + (\first{-2} \times \second{k}) \\ &\qquad + (\first{4} \times \second{-1}) \\ &\quad = 6 - 2\second{k} - 4 \\ &\quad = 2 - 2\second{k} = 0 \end{aligned}
k\displaystyle \second{k} =1\displaystyle = 1
5

A game character moves along the vector [5,10]\second{[5, 10]} beside a slanted rail whose direction is given by the unit vector [0.8,0.6]\first{[0.8, 0.6]} of length 1\first{1}. What is the length of the shadow of the character's motion along the rail?

Check the length of the receiving rail vector before deciding whether you need to divide by any length at the end.

Because the receiving rail vector [0.8,0.6]\first{[0.8, 0.6]} is a unit vector of length 1\first{1}, the dot product gives the shadow length directly. Don't divide by the character's motion length 52+102=125\second{\sqrt{5^2 + 10^2}} = \second{\sqrt{125}} (which gives 10125\tfrac{10}{\second{\sqrt{125}}}):
[5,10]⋅[0.8,0.6]\displaystyle \second{[5, 10]} \cdot \first{[0.8, 0.6]} =(5×0.8)+(10×0.6)\displaystyle = (\second{5} \times \first{0.8}) + (\second{10} \times \first{0.6}) =4+6\displaystyle = 4 + 6 =10\displaystyle = 10
6

Vector a=[1,2,2]\first{a} = \first{[1, 2, 2]} has length 3\first{3}, and vector b=[4,0,−3]\second{b} = \second{[4, 0, -3]} has length 5\second{5}. Find cos⁡θ\cos\theta for the angle θ\theta between them.

Find a⋅b\first{a} \cdot \second{b} from the coordinates first, then divide by the lengths of both arrows.

First calculate a⋅b\first{a} \cdot \second{b}, remembering that 2×0=0\first{2} \times \second{0} = 0, not 22 (writing 22 makes the top 4+2−6=04 + 2 - 6 = 0 and gives cos⁡θ=0\cos\theta = 0):
a⋅b=(1×4)+(2×0)+(2×−3)=4+0−6=−2\displaystyle \begin{aligned} \first{a} \cdot \second{b} &= (\first{1} \times \second{4}) + (\first{2} \times \second{0}) + (\first{2} \times \second{-3}) \\ &= 4 + 0 - 6 = -2 \end{aligned}
Now divide by the product of the two lengths, 3×5=15\first{3} \times \second{5} = 15 (stopping at the dot product −2-2 forgets to divide out the arrow lengths):
cos⁡θ\displaystyle \cos\theta =−23×5\displaystyle = \frac{-2}{\first{3} \times \second{5}} =−215\displaystyle = -\frac{2}{15}
7

For two vectors u\first{u} and v\second{v} with no coordinates given, u⋅u=5\first{u} \cdot \first{u} = 5, v⋅v=3\second{v} \cdot \second{v} = 3, and u⋅v=−2\first{u} \cdot \second{v} = -2. Find (2u−v)⋅(u+3v)(2\first{u} - \second{v}) \cdot (\first{u} + 3\second{v}).

Multiply out the two brackets term by term just like ordinary algebra, and combine the u⋅v\first{u} \cdot \second{v} and v⋅u\second{v} \cdot \first{u} pieces before plugging in the numbers.

Multiply out the brackets and rewrite v⋅u\second{v} \cdot \first{u} as u⋅v\first{u} \cdot \second{v}, keeping the minus sign on −v⋅u=−(u⋅v)-\second{v} \cdot \first{u} = -(\first{u} \cdot \second{v}) (adding it as +1(u⋅v)+1(\first{u} \cdot \second{v}) gives 7(u⋅v)7(\first{u} \cdot \second{v}) and −13-13):
(2u−v)⋅(u+3v)=2(u⋅u)+6(u⋅v)−(u⋅v)−3(v⋅v)=2(u⋅u)+5(u⋅v)−3(v⋅v)\displaystyle \begin{aligned} &(2\first{u} - \second{v}) \cdot (\first{u} + 3\second{v}) \\ &\quad = 2(\first{u} \cdot \first{u}) + 6(\first{u} \cdot \second{v}) \\ &\qquad - (\first{u} \cdot \second{v}) - 3(\second{v} \cdot \second{v}) \\ &\quad = 2(\first{u} \cdot \first{u}) + 5(\first{u} \cdot \second{v}) - 3(\second{v} \cdot \second{v}) \end{aligned}
Plug in u⋅u=5\first{u} \cdot \first{u} = 5, u⋅v=−2\first{u} \cdot \second{v} = -2, and v⋅v=3\second{v} \cdot \second{v} = 3, watching the negative sign on 5(−2)=−105(-2) = -10 (writing +10+10 gives 1111):
=2(5)+5(−2)−3(3)\displaystyle = 2(5) + 5(-2) - 3(3) =10−10−9\displaystyle = 10 - 10 - 9 =−9\displaystyle = -9