Skip to content
You Start with one site
Amounts in Start with one site
Mathematics · Concept

Vectors and matrices

One idea Beginner 5 min read
Found this useful?

The instruction "go 3 steps east and 4 steps north" is two numbers that belong together. A vector is such a list of numbers, drawn as an arrow with a length and a direction. A matrix is a table of numbers that turns one vector into another, and it is how a machine stretches, turns and combines quantities.

A vectorNumbers that belong together: 2 along x and 1 along y.An arrow
A matrixA table with one row for each number of the output.A machine for arrows
Matrix times vectorEach row makes one number of the new arrow.Row by row

See it

Predict first

A matrix has the rows 2, 0 and 0, 3. It turns the vector (2, 1) into (4, 3). Now the top right entry changes from 0 to 1. What happens to the output?

See it: a matrix acts on one arrow

Input vector x
Output vector y = A x
Turned counterclockwise by

The dark arrow is the input and never moves. The gold arrow is what the matrix makes of it. The slider changes one of the four entries. With 0 there, the matrix only stretches: 2 times along x and 3 times along y.

The idea

A vector holds quantities that have no meaning apart: the two parts of a force, the three readings of a tilt sensor, the temperatures of four rooms. Its length is found as for the long side of a right angle triangle: the vector (3, 4) has length √(9 + 16) = 5.

A matrix A turns an input vector x into an output vector y, written y = A x. Each row of the matrix makes one number of the output: multiply each entry of the row by the matching number of x, then add.

y1 = a x1 + b x2
y2 = c x1 + d x2

a and b are the first row of the matrix, c and d the second row, x1 and x2 the numbers of the input vector

Depending on its entries, a matrix stretches an arrow, turns it, flips it or flattens it. A rotation matrix is the kind that only turns. One limit: a matrix keeps straight lines straight and leaves the zero vector at zero, so it cannot shift or bend.

One worked number

The question

The matrix A has the rows 2, 0 and 0, 3. The input vector is x = (2, 1). What is the output y = A x, and how long is it?

Show the worked solution, 3 steps
  1. Use the first row

    y1 = 2 × 2 + 0 × 1 = 4.

  2. Use the second row

    y2 = 0 × 2 + 3 × 1 = 3. The output is y = (4, 3).

  3. Find the length

    √(42 + 32) = √25 = 5. The input had length √5 = 2.24, so the arrow is longer and it also points in a new direction. The figure opens on this case.

The mistake to avoid

A matrix does not multiply a vector entry by entry. There is no rule that pairs one entry of the table with one number of the vector. Every number of the output is a whole row times the whole vector. That is why one entry outside the diagonal makes the two inputs mix.

A second trap: the order of two matrices matters. B A means that A acts first and B second, and A B is in general a different result.

Check yourself

Question 1

A matrix has the rows 1, 2 and 3, 4. What does it make of the vector (1, 1)?

Question 2

A matrix has the rows 1, 0 and 0, 0. It acts on the vector (5, 2). What is the output, and can you find the input again from the output alone?

Question 3

Matrix S stretches x by 2 (rows 2, 0 and 0, 1). Matrix T turns an arrow by 90° counterclockwise (rows 0, −1 and 1, 0). Start with the arrow (1, 0). Is "stretch, then turn" the same as "turn, then stretch"?

Where you meet it

  • A vibration or tilt sensor on a machineEach reading is a vector of three numbers, one for each axis of the sensor.
  • A robot armEach joint is one matrix, and the position of the tool is the product of all of them.
  • A weighing platform on four load cellsA calibration matrix combines the four readings into one weight and the place where the load sits.
  • A model fitted to dataEach layer of the model is a matrix times a vector, repeated thousands of times for one prediction.
Key points
  • A vector is a list of numbers that belong together, drawn as an arrow with a length and a direction.
  • A matrix turns one vector into another: y = A x.
  • Each row of the matrix, times the whole vector, makes one number of the output.
  • The order of two matrices matters. B A means A first.
Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.