No history yet

Matrix Basics

What's a Matrix?

At its heart, a matrix is just a rectangular grid of numbers, arranged in rows and columns. Think of a simple spreadsheet, a tic-tac-toe board, or even the grid of pixels that makes up the screen you're reading this on. These are all examples of matrices in action.

This grid structure allows us to organize information in a powerful way. We describe the size, or dimension, of a matrix by its number of rows and columns. A matrix with 3 rows and 4 columns is called a "3 by 4" matrix, written as 3×43 \times 4.

Lesson image

Matrices are typically denoted by a capital letter, like AA, while the individual numbers inside are called elements or entries.

Reading Matrix Notation

To pinpoint a specific element in a matrix, we use a handy subscript notation. An element is written as a lowercase letter with two numbers, like aija_{ij}. The first number, ii, tells you the row, and the second number, jj, tells you the column.

A=(a11a12a13a21a22a23)A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{pmatrix}

Let's look at a matrix with actual numbers:

B=(520917)B = \begin{pmatrix} 5 & -2 & 0 \\ 9 & 1 & 7 \end{pmatrix}

In matrix BB above, the element b11b_{11} is 5. The element b23b_{23} is 7. Can you find the element b21b_{21}? It's 9.

Common Matrix Types

Matrices come in a few common shapes and sizes. When the number of rows and columns are different, it's called a rectangular matrix. The matrix BB we just saw is a rectangular matrix.

Square Matrix

noun

A matrix that has the same number of rows as it has columns.

A square matrix has an equal number of rows and columns, like a 3×33 \times 3 or a 5×55 \times 5 matrix.

C=(123456789)C = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}

Two other special types are row matrices and column matrices. A row matrix has only one row, and a column matrix has only one column. You might also hear these called row vectors and column vectors.

TypeDescriptionExample
Row MatrixA matrix with a single row.(4103)\begin{pmatrix} 4 & -1 & 0 & 3 \end{pmatrix}
Column MatrixA matrix with a single column.(528)\begin{pmatrix} 5 \\ 2 \\ 8 \end{pmatrix}

Basic Operations

We can perform arithmetic with matrices, but there are some rules. Let's start with the two simplest operations: addition and scalar multiplication.

To add two matrices, they must have the exact same dimensions. You simply add the corresponding elements together. If you have matrix AA and matrix BB, the element in the first row and first column of their sum (A+BA+B) is just a11+b11a_{11} + b_{11}.

(2853)+(1046)=(2+18+05+(4)3+6)=(3819)\begin{pmatrix} 2 & 8 \\ 5 & 3 \end{pmatrix} + \begin{pmatrix} 1 & 0 \\ -4 & 6 \end{pmatrix} = \begin{pmatrix} 2+1 & 8+0 \\ 5+(-4) & 3+6 \end{pmatrix} = \begin{pmatrix} 3 & 8 \\ 1 & 9 \end{pmatrix}

Scalar multiplication is even simpler. A scalar is just a regular number (not a matrix). To multiply a matrix by a scalar, you multiply every single element in the matrix by that number.

3×(1250)=(3×13×23×53×0)=(36150)3 \times \begin{pmatrix} 1 & 2 \\ -5 & 0 \end{pmatrix} = \begin{pmatrix} 3 \times 1 & 3 \times 2 \\ 3 \times -5 & 3 \times 0 \end{pmatrix} = \begin{pmatrix} 3 & 6 \\ -15 & 0 \end{pmatrix}

These basic ideas form the foundation for everything else we'll do with matrices.