If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Matrices, intro

Learn about matrix notation, dimension, addition, and scalar multiplication. Optionally, learn the formula for matrix multiplication.
In addition to vectors, matrices are a fundamental way we can talk about higher-dimensional space. They will show up all over multivariable calculus, so let's get into it.

What is a matrix?

A matrix is an array of numbers that we surround with square brackets. The dimension of a matrix is how many rows and columns it has, which we write as rows×columns. For example, here is a 2×3 matrix (pronounced "two by three"). The convention is to use uppercase letters for a variable that is a matrix.
A=[325421]
When a matrix has the same number of rows as columns, we call it a square matrix. For example, the matrix A is non-square. We call the numbers in a matrix its elements, or its entries. To refer to an entry in a matrix, we specify its row then its column in a subscript. The convention is to use lowercase letters for matrix elements.
a2,1=4,a1,3=5
The transpose of a matrix is that matrix with its rows and columns switched. That is, the entry ai,j becomes aj,i. We write AT to refer to the transpose of A. The transpose also reverses the dimensions of a matrix, so for example AT is 3×2.
AT=[342251]
In general, the entries in a matrix don't have to be numbers. For example, some of the matrices we'll encounter in multivariable calculus have functions or even derivative operators as entries.
To learn more about what a matrix is, check out this video. For more on the transpose, check out this video. To get practice with matrix dimensions, try this exercise. To get practice with matrix elements, try this exercise.

Vectors as matrices

Because a vector is just a list of numbers, we can represent it as a matrix. This is why we can write vectors with matrix notation. We can always write a given vector as a row vector (1×n) or as a column vector (n×1). The only difference between row and column vectors is how they work in matrix multiplication.
v=[123]T=[123]
We use the transpose here because otherwise the row vector and column vector are not technically equal, because they have different dimensions.
To learn more about the transpose of vectors, check out this video.

Addition

We can add two matrices if they have equal dimensions. The way we add them is to add corresponding components. In symbols, this says that A+B=C means ai,j+bi,j=ci,j.
[1325]+[3042]=[1+33+02452]=[2323]
To get practice with matrix addition, check out this exercise.

Scalar multiplication

We can multiply any matrix by a scalar, which is a fancy word for a number. When we do scalar multiplication, we multiply the scalar into every entry of the matrix. In symbols, this says that xA=B means xai,j=bi,j.
2[2143]=[22212423]=[4286]
To get practice with scalar multiplication, check out this exercise.

Matrix multiplication (optional)

This section is optional because matrix multiplication is most useful when we need to talk about n-dimensional space, while in this course we focus on 2D and 3D. Nonetheless, learning this now provides a great foundation for extending into higher dimensions later.
Unlike with addition and scalar multiplication, we do not just multiply the corresponding entries of two matrices A and B to find their product. Instead, we calculate the dot product of a row vector of A with a column vector of B to find each entry. For example, to find c1,2 of C=AB, we take the dot product of row 1 of A with column 2 of B:
[3112][4420]=[?34+10??]
In general, to find entry ci,j of C=AB, we take the dot product of the ith row of A with the jth column of B. Here's the rest of the matrix multiplication above:
=[3112][4420]=[34+1234+10(1)4+2214+20]=[141204]
As a consequence of this definition, we can only multiply two matrices A and B if A has the same number of columns as B has rows. Otherwise we would have to take the dot product of two vectors with different lengths.
We can always multiply two square matrices of the same dimension, such as a 3×3 with a 3×3. Other valid combinations include, for example, a 2×5 with a 5×2, or a 3×1 with a 1×3.
The dimension of the product matrix will be the rows of A and the columns of B. Therefore, the product of a 1×4 matrix with a 4×1 matrix will be a 1×1 matrix, which is interchangeable with a number. On a sidenote, this leads to another way we can write the dot product:
[123][456]=(1,2,3)(4,5,6)=14+25+36=32
To learn more about matrix multiplication, check out this video. For practice, try this exercise.

What's next

Now that we know matrix fundamentals, it's a good time to step back and think about what matrices mean. Otherwise the formulas and concepts surrounding them can feel unmotivated. The next article presents a way to visualize matrices that will give intuition into how they work. Specifically, it sheds light on how to think about the formula for matrix multiplication, and it prepares us for the final article about determinants.

Want to join the conversation?