# Lecture 6: Matrices

A matrix is an array of elements that follow certain rules:

We use square brackets to enclose the array.

A matrix has $n$ rows and $m$ columns, and is said to be of order $n \times m$.

Always mention the rows first. Thus, the above example $A$ is $2 \times 3$

## Examples

is $3 \times 3$

is $1 \times 3$

is $4 \times 1$

is $4 \times 4$

A matrix is square if the # of rows == # of columns.

Some common square matrices:

• zero matrix is all 0s
• identity matrix is all 0s except along the main diagonal (top left to bottom right) is 1s

In computer graphics, we most commonly use square $2 \times 2$, $3 \times 3$, and $4 \times 4$ matrices.

## Operations

Two matrices are equal if

• they have the same # of rows and columns
• their corresponding elements in each position are equal

If $A = B$, then $x = 2$ and $y = 3$.