Vectors and matrices in 3D

Two scaled column vectors laid head to tail inside a shaded parallelogram, ending at the vector Av above the input v.Drag to turn

A vector is an ordered list of numbers, often read as a magnitude and direction. A matrix is a rectangular array of numbers arranged in rows and columns, used to store data and to describe linear transformations.

What vectors and matrices are

A vector is an ordered list of numbers called components. In the plane, the vector (3, 4) can be drawn as an arrow from the origin to the point with x-coordinate 3 and y-coordinate 4. Its length is the square root of 3 squared plus 4 squared, which is the square root of 25, so 5.

A matrix is a rectangular grid of numbers. A matrix with 2 rows and 3 columns is called a 2 by 3 matrix, and the row count is always stated first. A vector can be seen as a matrix with a single column or a single row.

Adding, scaling and multiplying

Vectors of the same size are added component by component. Multiplying a vector by a number, called a scalar, multiplies each component by that number. Matrices of the same size follow the same two rules.

Matrix multiplication works differently. The product AB is defined only when the number of columns of A equals the number of rows of B. Each entry of AB is found by taking a row of A and a column of B, multiplying matching entries, and adding the results. This row-by-column sum is called a dot product.

Worked example: a matrix acting on a vector

Let A be the 2 by 2 matrix with rows (1, 2) and (3, 4), and let v be the column vector (5, 6). The first entry of Av is 1 times 5 plus 2 times 6, which is 5 + 12 = 17. The second entry is 3 times 5 plus 4 times 6, which is 15 + 24 = 39.

So Av is the vector (17, 39). The matrix has turned one vector into another. This is why matrices describe transformations such as rotations, stretches and reflections of the plane.

Common misconceptions

Matrix multiplication is usually not commutative. For most pairs of matrices, AB and BA differ, and sometimes only one of them exists. Order matters.

Another error is multiplying matrices entry by entry. That operation exists, but it is not the standard matrix product. A third error is treating a vector as only a point. A vector describes a displacement, and the same vector can be placed at any starting point.

Where they show up

Vectors and matrices are used to write systems of linear equations compactly, as Ax = b, where A holds the coefficients. They appear in physics for forces and velocities, in computer graphics for transforming shapes, and in statistics and data science for tables of data.

Courses in linear algebra build on these ideas to study determinants, inverses and eigenvalues.

Key terms

Vector
An ordered list of numbers, often drawn as an arrow with length and direction.
Matrix
A rectangular array of numbers arranged in rows and columns.
Scalar
A single number used to scale a vector or matrix.
Component
One of the numbers in a vector.
Dot product
The sum of the products of matching entries of two lists of equal length.
Dimension of a matrix
The number of rows by the number of columns, such as 2 by 3.

Common questions

Why must the inner sizes match when multiplying matrices?

Each entry is a row of A paired with a column of B, entry by entry. That pairing needs the row length of A, which is its column count, to equal the column length of B, which is its row count.

Can two matrices of different sizes be added?

No. Addition is defined only for matrices with the same number of rows and the same number of columns, because entries are added in matching positions.

Is a vector the same as a matrix?

A vector can be treated as a matrix with one column or one row. In many texts the two are kept as separate ideas, because vectors also carry a geometric meaning.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.