Main content

### Course: Multivariable calculus > Unit 1

Lesson 2: Vectors and matrices# 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 $\text{rows}\times \text{columns}$ . For example, here is a $2\times 3$ matrix (pronounced "two by three"). The convention is to use uppercase letters for a variable that is a matrix.

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.

The transpose of a matrix is that matrix with its rows and columns switched. That is, the entry ${a}_{i,j}$ becomes ${a}_{j,i}$ . We write ${A}^{T}$ to refer to the transpose of $A$ . The transpose also reverses the dimensions of a matrix, so for example ${A}^{T}$ is $3\times 2$ .

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\times n$ ) or as a column vector ($n\times 1$ ). The only difference between row and column vectors is how they work in matrix multiplication.

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 ${a}_{i,j}+{b}_{i,j}={c}_{i,j}$ .

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 $x{a}_{i,j}={b}_{i,j}$ .

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 ${c}_{1,2}$ of $C=AB$ , we take the dot product of row $1$ of $A$ with column $2$ of $B$ :

In general, to find entry ${c}_{i,j}$ of $C=AB$ , we take the dot product of the $i$ th row of $A$ with the $j$ th column of $B$ . Here's the rest of the matrix multiplication above:

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\times 3$ with a $3\times 3$ . Other valid combinations include, for example, a $2\times 5$ with a $5\times 2$ , or a $3\times 1$ with a $1\times 3$ .

The dimension of the product matrix will be the rows of $A$ and the columns of $B$ . Therefore, the product of a $1\times 4$ matrix with a $4\times 1$ matrix will be a $1\times 1$ matrix, which is interchangeable with a number. On a sidenote, this leads to another way we can write the dot product:

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?

- The Addition example is erroneous, showing 5-2 = -3(9 votes)
- It is fixed now I think(4 votes)

- typo:

Scalar multiplication

We can multiply any matrix by a scalar, which a fancy word for a number.

correction:

Scalar multiplication

We can multiply any matrix by a scalar, which IS a fancy word for a number.(3 votes) - Wow, why the lack of questions on this thread? Only five other responses have been made, and those were just discussing typos.(1 vote)