Matrix
Operations
Learn how to add matrices, multiply by scalars, and multiply matrices together: the building blocks of linear algebra.
What Is a Matrix?
A matrix is a rectangular array of numbers arranged in rows and columns. We describe its size as \( m \times n \), where \( m \) is the number of rows and \( n \) is the number of columns.
Why Do Matrices Matter?
Matrices are the language of data. They let us organize, transform, and solve complex systems in a compact form. Three core operations unlock nearly all of linear algebra.
Notation and Dimensions
We write a matrix with a capital letter and denote its size by rows × columns. The entry in row \( i \), column \( j \) of matrix \( A \) is written \( a_{ij} \).
Matrix Addition
To add two matrices, add their corresponding entries. Both matrices must have the same dimensions.
Scalar Multiplication
To multiply a matrix by a scalar (a single number), multiply every entry in the matrix by that scalar.
Matrix Multiplication
To multiply \( A \) (size \( m \times n \)) by \( B \) (size \( n \times p \)), the number of columns in \( A \) must equal the number of rows in \( B \). The result is an \( m \times p \) matrix.
Row-by-Column Dot Product
Each entry in the product matrix is computed by pairing a row of \( A \) with a column of \( B \), multiplying element-wise, then summing.
Addition vs. Multiplication: Order Matters
Matrix addition is commutative: \( A + B = B + A \). But matrix multiplication is NOT commutative: in general, \( AB \neq BA \).
| Addition | Multiplication | |
|---|---|---|
| Commutative? | ✓ Yes | ✕ No |
| Associative? | ✓ Yes | ✓ Yes |
| Distributive? | ✓ \( A(B + C) = AB + AC \) | |
| Size requirement | Same dimensions | Cols of \( A \) = Rows of \( B \) |
Step-by-Step Checklist
Example 1: Addition
Compute \( A + B \) where:
Example 2: Scalar Multiplication
Compute \( -2C \) where:
Example 3: Multiplication
Compute \( AB \) where:
Example 4: Non-Square Product
Compute \( PQ \) where \( P \) is \( 2 \times 3 \) and \( Q \) is \( 3 \times 1 \):
Result is \( 2 \times 1 \):
Common Mistakes
Summary of Operations
| Addition | Scalar Mult. | Matrix Mult. | |
|---|---|---|---|
| Rule | \( a_{ij} + b_{ij} \) | \( c \cdot a_{ij} \) | \( \sum a_{ik}b_{kj} \) |
| Size needed | Same \( m \times n \) | Any size | Inner dims match |
| Result size | \( m \times n \) | \( m \times n \) | \( m \times p \) |
| Commutative? | ✓ | ✓ | ✕ |
Question 1 of 5
If \( A \) is a \( 3 \times 2 \) matrix and \( B \) is a \( 3 \times 2 \) matrix, what is the size of \( A + B \)?
Question 2 of 5
Compute: \( 4 \begin{bmatrix} 2 & -1 \\ 3 & 0 \end{bmatrix} \). What is the entry in row 2, column 1?
Question 3 of 5
If \( A \) is \( 2 \times 3 \) and \( B \) is \( 3 \times 4 \), what is the size of \( AB \)?
Question 4 of 5
Compute the entry in row 1, column 1 of the product:
$$\begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 4 & -1 \\ 2 & 5 \end{bmatrix}$$
Question 5 of 5
Which of the following statements is always true?