Matrix Operations
Add, Subtract, Multiply
Master the rules for matrix addition, subtraction, and multiplication: when they're defined, how to compute them, and where things go wrong.
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 \): \( m \) rows and \( n \) columns.
Why Matrices Matter
Matrices are everywhere: computer graphics use them to rotate and scale images, data science stores datasets as matrices, and physics describes transformations with them.
The Dimension Rule
Before performing any operation, check that the dimensions are compatible. Different operations have different requirements.
Matrix Addition: The Rule
If \( A \) and \( B \) are both \( m \times n \) matrices, their sum \( A + B \) is the \( m \times n \) matrix where each entry is:
Matrix Subtraction: The Rule
Subtraction works the same way as addition: subtract corresponding entries. Both matrices must share the same dimensions.
Matrix Multiplication: The Rule
If \( A \) is \( m \times n \) and \( B \) is \( n \times p \), the product \( AB \) is an \( m \times p \) matrix. Each entry is a dot product:
Key Distinctions
| Add / Subtract | Multiply | |
|---|---|---|
| Dimension rule | Same \( m \times n \) | Inner dims match: \( n = n \) |
| Result size | \( m \times n \) | \( m \times p \) |
| Entry formula | \( a_{ij} \pm b_{ij} \) | \( \sum a_{ik}b_{kj} \) |
| Commutative? | Yes (Add), No (Sub) | No |
| Associative? | Yes (Add), No (Sub) | Yes |
Step-by-Step Approach
Example 1: Addition
Compute \( A + B \) where:
Example 2: Subtraction
Compute \( C - D \) where:
Example 3: Multiplication
Compute \( AB \) where:
Example 3: Full Computation
Example 4: Non-Square Multiply
Compute \( PQ \) where \( P \) is \( 2 \times 3 \) and \( Q \) is \( 3 \times 1 \):
Common Mistakes
Summary of Operations
| Property | Addition | Subtraction | Multiplication |
|---|---|---|---|
| Dimension Rule | Same \( m \times n \) | Same \( m \times n \) | \( m \times n, n \times p \) |
| Result Size | \( m \times n \) | \( m \times n \) | \( m \times p \) |
| Method | Entry + Entry | Entry - Entry | Dot Product |
| Commutative? | Yes | No | No |
| Associative? | Yes | No | Yes |
Question 1 of 5
If \( A \) is a \( 3 \times 4 \) matrix and \( B \) is a \( 3 \times 4 \) matrix, what are the dimensions of \( A + B \)?
Question 2 of 5
Compute: \( \begin{bmatrix} 5 & -2 \\ 1 & 3 \end{bmatrix} - \begin{bmatrix} 3 & 4 \\ -1 & 7 \end{bmatrix} \)
Question 3 of 5
If \( A \) is \( 2 \times 3 \) and \( B \) is \( 3 \times 5 \), what are the dimensions of \( AB \)?
Question 4 of 5
Compute entry \( (1,2) \) of the product: \( \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} \)
Question 5 of 5
Which statement about matrix multiplication is true?