Recitation 1 · Week 1· 31:43

Problem Sheet 1, worked through

The marked problems of Sheet 1, solved step by step on screen. Try them first; the rest of the sheet is for practice on your own, with full written solutions. Covers Lectures 1 to 4.

Play: Recitation 1
Recitation · 31:43 · Open on YouTube · Report a problem with this video
TranscriptThe full text of the recitation. Click any sentence to play the video from there.

Recitation 1

Welcome to the first recitation of Linear Algebra. This week we met vectors, how to add and scale them, linear combinations and span, and the dot product, with length and angle. Today we put all of it to work. Problem Sheet one covers lectures one to four. We will solve the thirteen problems marked with the play symbol: problems three to fifteen. The other seven are for practice on your own, with full solutions in the solutions booklet. Pause the video and try each problem first, then watch how we do it. First, a quick recap of the week. A vector is an arrow, and it is also an ordered list of numbers, its components. Two vectors are equal when every component matches.

We add vectors component by component, and we scale a vector by multiplying every component by the same number. With arrows, adding means placing them tip to tail, and scaling stretches, shrinks or flips the arrow. Putting the two operations together gives linear combinations, such as a v plus b w. The set of all linear combinations of some vectors is their span. The span of these two vectors is the whole plane. The dot product multiplies matching components and adds the results. It gives us length, through the norm, and angle, through the cosine formula. Two vectors are orthogonal when their dot product is zero.

Here is a strategy that works for almost every problem today. Translate the vector statement into components. Solve the ordinary equations you get. Then go back, and say what the answer means in the picture.

Problem 3: equal vectors

Problem three. We want all real numbers a and b such that the column (a plus b, a minus b) equals the column (five, one). Equality of vectors means equality of every component. So this one vector equation is really two ordinary equations. The first components give a plus b equals five. The second components give a minus b equals one. To solve them, add the two equations. The b's cancel, and we are left with two a equals six. So a equals three.

Putting a equals three back into the first equation gives three plus b equals five. So b equals two. Let's check. In the first coordinate, three plus two is five, which matches. In the second coordinate, three minus two is one, which matches too. So a equals three and b equals two, and it is the only solution.

Now the second part. The vectors get a third component, and now two a must equal four. Is there still a solution? The first two components give the same equations as before, so they still force a equals three, and b equals two. There is no freedom left. But then the third component is two times three, which is six, not four. The third equation fails, so no pair works at all.

You can see it in a picture. Each equation is a line in the plane of a and b. The first two lines meet at the point (three, two), but the third line misses that point. The lesson: three equations in two unknowns can contradict each other. When a system has a solution, and when it does not, is a question we answer completely in week three.

Problem 4: a hiker's walk

Problem four is about a hiker. The hiker records three legs of a walk as displacement vectors, in kilometres east and north: (three, one), then the vector (minus one, two), then the vector (two, minus four). Part a asks for the total displacement. A displacement only says how far to go and in which direction, so the total is simply the sum of the three vectors. We add component by component. First components: three, minus one, and two, which make four.

Second components: one, plus two, minus four, which make minus one. So the total displacement is (four, minus one): four kilometres east, and one kilometre south. Now the picture. We place the legs tip to tail: the first leg starts at the start, and each next leg starts where the last one ended. The arrow from the start to the final tip is the total, and it is exactly the vector we computed. Part b. Which single displacement brings the hiker straight back to the start? We need a vector that cancels the total, so that the sum is the zero vector. That is the negative of the total, (minus four, one).

Part c asks whether the order of the legs matters. Let's walk them in a different order, and watch where the hiker ends up. The path changes, but the end point does not. Why? Each component of the total is a sum of ordinary numbers: three, minus one and two, and one, two and minus four. Real addition is commutative and associative, so these sums do not depend on the order of their terms. So vector addition inherits the rules of ordinary addition, one component at a time. Problem seven turns this observation into a proof.

Problem 5: two pictures

Problem five. Find numbers x and y such that x times (two, one), plus y times (one, three), equals the vector (seven, eleven). Then describe the answer in the row picture and in the column picture. Both pictures come from lecture one. The row picture draws each equation as a line, and looks for the point where the lines meet. The column picture treats the columns as vectors, and combines them to reach the right hand side. Again we compare components. The first components give two x plus y equals seven. The second components give x plus three y equals eleven.

From the first equation, y equals seven minus two x. We substitute that into the second equation. That gives x plus twenty one minus six x equals eleven. So minus five x equals minus ten, and x equals two. Then y equals seven minus four, which is three. Let's check by substituting. Two times (two, one) is the vector (four, two). And three times (one, three) is the vector (three, nine).

In the first coordinate, four plus three is seven. In the second coordinate, two plus nine is eleven. That is exactly the target. Now the two pictures. In the row picture, each equation is a line in the plane. Here is two x plus y equals seven. And here is x plus three y equals eleven. The solution is the point where the lines meet, (two, three). It lies on both lines, so it satisfies both equations at once.

In the column picture, the columns are vectors: (two, one) in coral, (one, three) in blue, and the target (seven, eleven) in gold. Now the question is: how many copies of each column take us to the target? Two copies of the first column bring us to (four, two). Then three copies of the second column, tip to tail, land exactly on (seven, eleven). Same numbers, two different stories. The row picture intersects lines, and the column picture combines vectors. Keep both in mind: they will follow us all semester.

Problem 6: mixing colours

Problem six is about colours. A colour on a screen is a vector r, g, b: the amounts of red, green and blue light, each between zero and one. We have c one, equal to (one, zero point four, zero), which is orange, and c two, equal to (zero, zero point six, one), a sky blue. Part a asks for the even mix, one half c one, plus one half c two. Scaling and adding work component by component, as always. Red: one half of one, plus one half of zero, is zero point five. Green: one half of zero point four, plus one half of zero point six, is zero point five.

Blue: one half of zero, plus one half of one, is zero point five. So the even mix is (zero point five, zero point five, zero point five). All three entries are equal, so this colour is a medium grey. That may be a surprise. But orange and sky blue are roughly opposite colours, and an even mix of opposite colours of light cancels the tint, and leaves grey. Part b asks for which t between zero and one the mix, t c one plus one minus t c two, is a shade of grey. First we write the mix in components: (t, zero point six minus zero point two t, one minus t).

A grey needs all three entries equal. The first and the third entries are equal when t equals one minus t, that is, when t is one half. We must still check the middle entry. At t equal to one half it is zero point six minus zero point one, which is zero point five. It matches, so t equal to one half is the only grey mix. In the picture, as t slides from zero to one, the mix moves from sky blue to orange, and it passes through grey exactly once, right in the middle.

Problem 7: a first proof

Problem seven is our first proof. Using only the definitions of addition and equality in R n, prove that u plus v equals v plus u, for all vectors u and v in R n. The words "using only the definitions" matter. A picture of a parallelogram makes the statement believable, but it is not a proof, and it only shows the plane. We must argue from how addition is defined. We start by naming the components. Write u as the list u one, up to u n. And write v as the list v one, up to v n.

By the definition of addition, the i-th component of u plus v is u i plus v i. And the i-th component of v plus u is v i plus u i. Now we use a fact about ordinary numbers: addition of real numbers is commutative. So u i plus v i equals v i plus u i, for every index i from one to n. Finally, the definition of equality. Two vectors in R n are equal when all their components are equal, and we have just shown that they are. So u plus v equals v plus u, and the proof is complete.

Notice the shape of this proof. A statement about vectors became n statements about numbers, one for each component, and each of those was a known fact. Many proofs this semester follow exactly this pattern.

Problem 8: true or false

Problem eight is a true or false question. For each statement about vectors u, v and w in R n, we prove it if it is true, and we give a counterexample if it is false. Statement a: if two u equals two v, then u equals v. Let's translate into components. Two u equals two v means that two u i equals two v i, for every index i. Now we are back to ordinary numbers, and we may divide by two. So u i equals v i for every i, and by the definition of equality, u equals v. Statement a is true.

Statement b: if u plus w equals v plus w, then u equals v. In components, u i plus w i equals v i plus w i, for every i. Subtract w i from both sides, and we get u i equals v i, for every i. So u equals v, and statement b is true as well. Adding a vector can be cancelled, exactly like adding a number. Statement c: if u and v have the same first component, then u equals v. This time we should be suspicious. Equality needs every component to match, and here we only know about one of them.

A counterexample in R two: u equal to (one, zero), and v equal to (one, five). Both start with one, but their second components differ, so u is not equal to v. Statement c is false. In R n, pad both vectors with zeros, and the same example works. One small catch. In R one, a vector has only one component, so there statement c is actually true. A careful answer says: false whenever n is at least two. A counterexample has to be concrete. Two specific vectors that break the statement are a complete proof that it is false, and no general argument is needed.

Problem 9: dot product, length and angle

Problem nine is a warm-up on the dot product. We have u equal to (one, two, minus two), and v equal to (three, zero, four), two vectors in R three. Part a, the dot product. We multiply matching components and add. In the first coordinate, one times three is three. In the second coordinate, two times zero is zero. In the third coordinate, minus two times four is minus eight. Adding, three plus zero minus eight is minus five. So u dot v is minus five.

The lengths come from the dot product of each vector with itself. The norm of u is the square root of one plus four plus four, which is the square root of nine, so three. The norm of v is the square root of nine plus zero plus sixteen, which is five. Part b, the angle. The cosine of the angle is the dot product, divided by the product of the lengths. We substitute: minus five, over three times five. That is minus five fifteenths, which is minus one third. So the angle is the inverse cosine of minus one third, which is about one hundred and nine and a half degrees. A negative cosine always means an obtuse angle, more than ninety degrees. Two vectors in R three lie in a common plane, so we can draw the angle in that plane.

Part c asks for the unit vector in the direction of v. We normalize: we divide v by its length, five. Each entry is divided by five, which gives (three fifths, zero, four fifths). Let's check that its length is one. The squares of the entries are nine twenty fifths, zero, and sixteen twenty fifths. They add up to twenty five twenty fifths, which is one, and the square root of one is one. Part d. For which number t is the vector (one, t, two) orthogonal to u? Orthogonal means the dot product is zero. The dot product is one, plus two t, minus four, which is two t minus three.

Two t minus three is zero exactly when t equals three halves. So the vector (one, three halves, two) is orthogonal to u.

Problem 10: combinations and span

Problem ten. Let v be the vector (one, one), and let w be the vector (minus one, three). Part a asks us to draw v, w, v plus w, two v minus w, and minus v plus one half w. Here are v in coral, and w in blue. For each combination we first compute its components, and then we draw the arrow. First, v plus w. In the first coordinate, one plus minus one is zero. In the second coordinate, one plus three is four. So v plus w is (zero, four).

On the grid, we place w at the tip of v, tip to tail. The sum is the diagonal of the parallelogram, and it lands at (zero, four). Next, two v minus w. Two v is (two, two). In the first coordinate, two minus minus one is three. In the second coordinate, two minus three is minus one. So two v minus w is (three, minus one). Last, minus v plus one half w. Minus v is (minus one, minus one), and one half w is (minus one half, three halves). In the first coordinate, minus one minus one half is minus three halves. In the second coordinate, minus one plus three halves is one half.

So the last arrow ends at (minus three halves, one half). Here are all five arrows on one grid, and that is the drawing the problem asks for. Part b. Find x and y with x v plus y w equal to (minus three, five). Comparing components, x minus y equals minus three, and x plus three y equals five. Subtracting the first equation from the second removes x. Four y equals eight, so y equals two. Then x equals minus three plus two, which is minus one.

So minus v plus two w is (minus three, five). On the grid: go backwards along v once, then forwards along w twice, and we land on the target. Part c asks a bigger question: can we reach every vector b in the plane this way? We solve the same system, with b one and b two in place of the numbers. Subtracting again gives four y equals b two minus b one. So y is b two minus b one, over four. And x equals b one plus y, which is three b one plus b two, over four.

These formulas work for every b one and b two. So every vector in the plane is a combination of v and w. In other words, the span of v and w is all of R two. Watch the combinations sweep across the plane as x and y change. Every point is reached, and each one by exactly one pair x and y.

Part d. What if we replace w by (minus two, minus two)? That vector is minus two times v, so it lies along the same line as v. Every combination, x v plus y times (minus two, minus two), has components x minus two y, and x minus two y. The two components are always equal, so the span collapses to a single line through the origin. The target (minus three, five) has two different components, so it can no longer be reached. Two vectors in the plane span all of it exactly when neither is a multiple of the other. Making this precise is the idea of linear independence, which we study in lecture eleven.

Problem 11: sketching spans

Problem eleven is about spans. Part a asks us to sketch the span of four different sets in the plane. First, the set with the single vector (two, minus one). Its span is all the multiples t times (two, minus one). Stretching, shrinking and flipping one arrow sweeps out a line through the origin. Second, (two, minus one) together with (minus four, two). But the second vector is minus two times the first. It adds nothing new, so the span is the same line as before.

Third, (two, minus one) together with (one, one). These two are not parallel, so by theorem one point three point eight, they span the whole plane. Fourth, the set containing only the zero vector. Every multiple of zero is zero, so the span is just the origin, a single point. Part b moves to R three, with a equal to (one, zero, two), and b equal to (zero, one, minus one). A combination s a plus t b has components s, then t, then two s minus t.

Is c, equal to (two, three, one), in the span? The first two components force s equals two, and t equals three. Then the third component is two times two minus three, which is one. It matches, so c equals two a plus three b. What about d, equal to (one, one, two)? Now s and t must both be one, and the third component is two minus one, which is one, not two. So d is not in the span. In fact, a vector with components x, y and z is in the span exactly when z equals two x minus y. So the span of a and b is a plane through the origin, with that equation.

Finally, adding c to the set does not enlarge the span, because c is already in it. That is theorem one point three point eleven. The span of a, b and c is still the same plane.

Problem 12: a triangle

Problem twelve. The point A (one, zero), the point B (four, one), and the point C (zero, three) form a triangle. We draw it, find its sides and its angles, and find the point D that completes the square A B D C. Part a is the drawing. We plot the three points and join them. A sits on the x axis, B is out to the right, and C is up on the y axis. For lengths and angles, the right tools are the side vectors. The vector from A to B is B minus A.

In the first coordinate, four minus one is three. In the second coordinate, one minus zero is one. So the vector from A to B is (three, one). The vector from A to C is C minus A. In the first coordinate, zero minus one is minus one. In the second coordinate, three minus zero is three. So it is (minus one, three). In the same way, the vector from B to C is C minus B, which is (minus four, two).

Part b. The length of a vector is the square root of the sum of the squares of its components. For A B, that is the square root of nine plus one: the square root of ten. For A C, it is the square root of one plus nine, again the square root of ten. And for B C, the square root of sixteen plus four, which is the square root of twenty, or two root five. Part c, the angles. At the corner A, we take the dot product of the two sides that leave A.

In the first coordinate, three times minus one is minus three. In the second coordinate, one times three is three. Adding, minus three plus three is zero. The dot product is zero, so the two sides are orthogonal. The angle at A is a right angle, ninety degrees. At the corner B, the sides leaving B are B A, which is (minus three, minus one), and B C, which is (minus four, two). Their dot product is twelve minus two, which is ten.

The cosine of the angle is the dot product divided by the two lengths: ten, over root ten times root twenty. That simplifies to one over root two, so the angle at B is forty five degrees. The same calculation at C gives forty five degrees again. Ninety plus forty five plus forty five is one hundred and eighty, as it must be. It is a right isosceles triangle, and Pythagoras agrees: ten plus ten is twenty. Part d. To complete the square A B D C, the side from B to D must be a copy of the side from A to C. So D equals B plus (minus one, three).

In the first coordinate, four plus minus one is three. In the second coordinate, one plus three is four. So D is the point (three, four), and the square closes up.

Problem 13: the parallelogram law

Problem thirteen, our second proof. For vectors u and v in R n, prove the parallelogram law. The norm of u plus v, squared, plus the norm of u minus v, squared, equals twice the norm of u squared, plus twice the norm of v squared. The key tool is that the square of a norm is a dot product: the norm of x, squared, is x dot x. Then we can expand, using the rules of the dot product. Expanding u plus v, dotted with itself, gives u dot u, plus two u dot v, plus v dot v. The two middle terms combine because the dot product is symmetric.

In the same way, u minus v, dotted with itself, gives u dot u, minus two u dot v, plus v dot v. Now add the two lines. Plus two u dot v and minus two u dot v cancel, and what is left is two u dot u, plus two v dot v. That is exactly the right hand side. What does it mean? In the parallelogram with sides u and v, the two diagonals are u plus v, and u minus v. The law says that the squares of the two diagonals add up to the squares of all four sides.

Part b. Prove that u plus v and u minus v are orthogonal exactly when u and v have the same length. Take their dot product and expand. We get u dot u, minus u dot v, plus v dot u, minus v dot v. The middle terms cancel, which leaves the norm of u squared, minus the norm of v squared. Two vectors are perpendicular exactly when their dot product is zero. So we need this expression to be zero. That happens exactly when the two squared norms are equal. And since norms are never negative, that happens exactly when the norms themselves are equal.

In the picture, a parallelogram with equal sides is a rhombus. So the diagonals of a rhombus are perpendicular. Watch the angle between the diagonals as the two sides become equal. It reaches ninety degrees. Part c. True or false: if u is not zero, and u dot v equals u dot w, then v equals w.

It is tempting to cancel u. But we cannot divide by a vector, so let's look for a counterexample. Take u equal to (one, zero), v equal to (zero, one), and w equal to (zero, two). Then u dot v is zero, and u dot w is also zero. But v and w are different, so the statement is false. What is true is that u dot the difference, v minus w, is zero. The difference is orthogonal to u, but it need not be the zero vector. In fact, every vector ending on this vertical line has the same dot product with u.

Problem 14: comparing texts

Problem fourteen is an application. A search engine stores each text as a vector of word counts. Here the words are vector, matrix, goal and team, and three short texts give the vectors d one, d two and d three. The cosine similarity of two texts is the cosine of the angle between their vectors. Close to one means the vectors point almost the same way, so the texts use their words in similar proportions. First, the lengths. The norm of d one is the square root of sixteen plus four plus zero plus one, the square root of twenty one. The norm of d two is the square root of eight, and the norm of d three is the square root of fourteen.

Now the dot product of d one and d two, one coordinate at a time. Four times two is eight. Two times two is four. Zero times zero is zero, and one times zero is zero. The total is twelve. To get the cosine similarity, we divide by the two lengths: twelve, over root twenty one times root eight. That is about zero point nine three, very close to one. We do the same for the other two pairs. d one dot d three is zero plus two plus zero plus two, which is four. Dividing by root twenty one times root fourteen gives about zero point two three. And d two dot d three is zero plus two plus zero plus zero, which is two. Dividing by root eight times root fourteen gives about zero point one nine.

So texts one and two are by far the most alike. Both are mostly about vectors and matrices, while text three is about sport. Part b. A fourth text is text one copied out twice, so its vector is two d one. Doubling a vector doubles the dot product, and it doubles the length too. The two factors of two cancel, so the similarity does not change. That is exactly what we want. A longer text on the same topic should not count as a different topic. Only the direction of the vector matters, not its length.

Part c. Word counts are never negative, so every product in the dot product is at least zero, and the cosine is at least zero. Cauchy Schwarz says it is at most one. And it equals zero exactly when the two texts have no word in common.

Problem 15: two inequalities

Problem fifteen uses the two big inequalities from lecture four. Part a: apply Cauchy Schwarz to the vector x, with entries x one up to x n, and to the vector of all ones. This is the most demanding part of the sheet. It is worth pausing the video here, and going through each step slowly, more than once if needed. Cauchy Schwarz says that the absolute value of x dot one is at most the norm of x, times the norm of the vector of ones.

Here x dot one is just the sum, x one plus and so on up to x n. The norm of x is the square root of the sum of the squares. And the vector of ones has length root n. Both sides are at least zero, so we may square them. That gives: the square of the sum is at most n times the sum of the squares. Equality in Cauchy Schwarz happens exactly when one vector is a multiple of the other. Here that means x is a multiple of the vector of ones: all its entries are equal. In words, the square of the average is at most the average of the squares.

Part b. Suppose a plus b plus c equals one. Part a, with n equal to three, gives one squared, at most three times the sum of the squares. So a squared plus b squared plus c squared is at least one third. Equality needs a, b and c all equal, and since they add up to one, each of them is one third. Part c is the triangle inequality for distances. Write u minus w as u minus v, plus v minus w. The triangle inequality says that the norm of a sum is at most the sum of the norms.

Now take the norm of both sides of the first line. The norm of u minus w is the norm of u minus v, plus v minus w. Then apply the triangle inequality, the second line, with x equal to u minus v, and y equal to v minus w. The norm of that sum is at most the norm of u minus v, plus the norm of v minus w. So the distance from u to w is at most the distance from u to v, plus the distance from v to w. Going straight is never longer than making a detour through a third point.

Wrapping up

That's all thirteen problems. Let's collect the tools we used today. To solve a vector equation, compare components. To check an answer, substitute, and compute one coordinate at a time. To find lengths and angles, use dot products. And to prove an identity, expand, using the definitions and the rules. The two unmarked problems, one and two, are quick warm-ups on the same ideas. Part three, problems sixteen to twenty, is practice on your own. Every problem has a full solution in the solutions booklet, so try them before you look.

Next week we meet lines and planes in space, the cross product, fields, and our first systems of linear equations. See you in the lectures.

In this recitation

  1. Problem 3: equal vectors
  2. Problem 4: a hiker's walk
  3. Problem 5: two pictures
  4. Problem 6: mixing colours
  5. Problem 7: a first proof
  6. Problem 8: true or false
  7. Problem 9: dot product, length and angle
  8. Problem 10: combinations and span
  9. Problem 11: sketching spans
  10. Problem 12: a triangle
  11. Problem 13: the parallelogram law
  12. Problem 14: comparing texts
  13. Problem 15: the two inequalities
  14. Wrapping up

Materials

Found a mistake, or something not working on this page? Report it and we'll fix it. See what we've corrected.