Matrices and Linear Transformations

Matrices are compact rectangular arrays of numbers. They organize data, encode systems of equations, and describe transformations such as rotations and stretches. This lesson assumes comfort with algebra and coordinate geometry; the lessons on Algebra and Geometry are useful preparation.

Reading a Matrix

A matrix with m rows and n columns has size m × n. Its entry in row i, column j is written aij. For example,

A = [1   −2
3   4
] is a 2 × 2 matrix. The entry a21 is 3, not −2: read the row number first.

Two matrices are equal exactly when they have the same size and every corresponding entry is equal. A column matrix is a useful way to write a vector: v = [3
−1
].

Addition, Subtraction, and Scalar Multiplication

Add or subtract entry by entry, but only when the matrices have the same size. A scalar is an ordinary number; scalar multiplication multiplies every entry.

Worked example: combine matrices

Let A = [2   −1
0   3
] and B = [−4   5
2   1
]. Find 2AB.

2A = [ 4  −2 ]       2A − B = [ 4 − (−4)   −2 − 5 ]
     [ 0   6 ]                [ 0 − 2        6 − 1  ]

2A − B = [ 8  −7 ]
         [−2   5 ]

A 2 × 3 matrix and a 3 × 2 matrix cannot be added, even though both contain six entries: their corresponding positions do not match.

Matrix Multiplication Is a Rule for Combining Effects

For AB to be defined, the number of columns of A must equal the number of rows of B. If A is m × n and B is n × p, then AB is m × p. Each output entry is a row of A dotted with a column of B.

Worked example: row by column

Multiply A = [1   2
−1   3
] by B = [4   0
5   −2
].

AB = [ 1(4) + 2(5)       1(0) + 2(−2)  ]
     [−1(4) + 3(5)     −1(0) + 3(−2)  ]

AB = [14  −4]
     [11  −6]

Order matters. Here BA = [4   8
2   −6
], which is not AB. In general, ABBA.

Matrix-vector multiplication

When A multiplies a vector x, each row of A produces one weighted sum. This is why matrices naturally encode systems and transformations.

[ 2  1 ] [x]   [2x + y]
[−3  4 ] [y] = [−3x + 4y]

Systems of Equations in Matrix Form

The system 2x + y = 7 and −3x + 4y = 5 can be written Ax = b, where

A = [2   1
−3   4
], x = [x
y
], and b = [7
5
]. The coefficient matrix A records coefficients, while b holds the constants.

Worked example: solve with an inverse

For a square matrix with an inverse, multiply Ax = b on the left by A−1. Then x = A−1b.

A⁻¹ = 1/11 [ 4  −1 ]     because det(A) = 2(4) − 1(−3) = 11
            [ 3   2 ]

[x] = 1/11 [ 4  −1 ] [7] = 1/11 [23] = [23/11]
[y]        [ 3   2 ] [5]        [31]   [31/11]

Substitution checks both equations. For larger systems, row reduction is usually more efficient; this matrix form emphasizes the structure rather than repeating elimination methods.

Determinants and Inverses of 2 × 2 Matrices

For A = [a   b
c   d
], its determinant is det(A) = adbc. Geometrically, its absolute value is the factor by which a transformation scales area. A zero determinant means the matrix flattens the plane into a line or point, so it has no inverse.

When adbc ≠ 0,

A−1 = 1/(adbc) [d   −b
c   a
]. Notice the swap of the diagonal entries and the sign changes on the other two entries.

Worked example: find and verify an inverse

A = [3  1]             det(A) = 3(2) − 1(5) = 1
    [5  2]

A⁻¹ = [ 2  −1]        AA⁻¹ = [3  1][ 2  −1] = [1  0]
       [−5   3]                [5  2][−5   3]   [0  1]

The identity matrix I = [1   0
0   1
] leaves every compatible matrix or vector unchanged, just as multiplying a number by 1 does.

Transformation Matrices

A linear transformation maps vectors to vectors while preserving vector addition and scalar multiplication. In the coordinate plane, a 2 × 2 matrix sends each point vector [x
y
] to a new vector. The columns tell where the unit basis vectors go: the first column is the image of [1
0
], and the second is the image of [0
1
].

TransformationMatrixEffect
Scale by s in both directions[s   0
0   s
]
Distances from the origin scale by |s|. When s is negative, the scaling also includes a half-turn about the origin.
Reflect in the x-axis[1   0
0   −1
]
(x, y) becomes (x, −y).
Rotate counterclockwise by θ[cos θ   −sin θ
sin θ   cos θ
]
Preserves lengths and angles.

Worked example: a rotation

A 90° counterclockwise rotation has matrix R = [0   −1
1   0
], since cos 90° = 0 and sin 90° = 1. Apply it to (3, −2).

[x′]   [0  −1][ 3]   [2 ]
[y′] = [1   0][−2] = [3 ]

The point (3, −2) rotates to (2, 3).

Composition: Rightmost Happens First

Applying transformation A and then B gives B(Av) = (BA)v. Thus the product is read from right to left, like nested function notation.

Worked example: reflect, then rotate

Reflect first in the x-axis using F = [1   0
0   −1
], then rotate 90° counterclockwise using R above.

RF = [0  −1][1   0] = [0  1]
     [1   0][0  −1]   [1  0]

Applied to (2, 1):
RF[2; 1] = [1; 2]

Reversing the order gives FR[2
1
] = [−1
−2
], a different point. This is a concrete reason multiplication is not commutative.

Applications

  • Computer graphics: matrices rotate, scale, and combine coordinates of shapes; a chain of transformations becomes one product matrix.
  • Networks and data: a matrix can record weighted connections or measurements, with multiplication combining many weighted contributions at once.
  • Physics and engineering: systems of forces, circuits, and coupled quantities are commonly expressed as Ax = b.

Common Mistakes

  • Multiplying entry by entry: ordinary matrix multiplication uses row-by-column dot products. Entrywise multiplication is a different operation.
  • Ignoring dimensions: write sizes first. A 2 × 3 times 3 × 1 product works and gives 2 × 1; 3 × 1 times 2 × 3 does not work.
  • Dividing by a matrix: there is no general matrix division. To solve Ax = b, left-multiply by A−1 only when it exists.
  • Using an inverse when det(A) = 0: a zero determinant makes the inverse formula invalid.
  • Composing in reading order: in BAv, apply A to the vector before B.

Practice Set

  1. State the size of C = [2   0   −1
    4   3   5
    ] and identify c23.
  2. Let P = [1   −2
    3   0
    ] and Q = [4   1
    −1   2
    ]. Find P + Q and −2P.
  3. Multiply [2   1
    −1   3
    ] by [4
    −2
    ].
  4. Find AB for A = [1   2
    0   −1
    ] and B = [3   1
    4   2
    ].
  5. Find the determinant of [6   −2
    3   1
    ] and decide whether it is invertible.
  6. Find the inverse of [2   1
    1   1
    ].
  7. Use the inverse from question 6 to solve 2x + y = 8 and x + y = 5.
  8. What does the matrix [−1   0
    0   1
    ] do to the point (−4, 3)? Name the transformation.
  9. A transformation first scales every coordinate by 2, then reflects in the x-axis. Find its single matrix and its image of (1, −3).
  10. Explain why a matrix with determinant 0 cannot have an inverse, using the idea of area or flattening.

Answer Checks

  1. C has 2 rows and 3 columns, so its size is 2 × 3. c23 = 5.
  2. P + Q = [5   −1
    2   2
    ], and −2P = [−2   4
    −6   0
    ].
  3. The product is [6
    −10
    ], because 2(4) + 1(−2) = 6 and −1(4) + 3(−2) = −10.
  4. AB = [11   5
    −4   −2
    ].
  5. det = 6(1) − (−2)(3) = 12. It is invertible because the determinant is nonzero.
  6. The determinant is 2(1) − 1(1) = 1, so the inverse is [1   −1
    −1   2
    ].
  7. [x
    y
    ] = [1   −1
    −1   2
    ][8
    5
    ] = [3
    2
    ]. Thus x = 3 and y = 2.
  8. It sends (−4, 3) to (4, 3). It is a reflection in the y-axis.
  9. The scale matrix is [2   0
    0   2
    ] and the reflection matrix is [1   0
    0   −1
    ]. In the stated order their product is [2   0
    0   −2
    ]. It sends (1, −3) to (2, 6).
  10. Its area scale factor is |det| = 0, so every two-dimensional region is flattened to zero area. Distinct input vectors can then share an output, making reversal impossible.