Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 37 · Vectors and Matrices

Determinants, Inverses and Transformations

Compute 2x2 determinants and inverses, solve linear systems with matrices, and see how matrices rotate, scale and reflect the plane.

Dividing by a number undoes multiplying by it. Matrices have a similar idea: the inverse of A undoes what A does. Whether it exists depends on a single number called the determinant. This lesson covers both for 2 × 2 matrices, and then shows what matrices do to the plane.

The determinant of a 2 × 2 matrix

For A = [a b; c d]:

Text
det A = ad − bc

Example: det [3 1; 2 4] = 3·4 − 1·2 = 10.

Geometrically, |det A| is the factor by which A scales areas. The unit square becomes a parallelogram of area |det A|. A negative determinant means the plane is also flipped (mirror image). If det A = 0, the plane is squashed onto a line, and information is lost: A has no inverse.

The inverse

If det A ≠ 0, then

Text
A⁻¹ = (1 / (ad − bc)) · [ d  −b ]
                        [ −c  a ]

Swap the diagonal entries, negate the other two, and divide by the determinant. It satisfies A A⁻¹ = A⁻¹ A = I.

Example: A = [3 1; 2 4], det = 10:

Text
A⁻¹ = (1/10) [ 4 −1]  =  [ 0.4 −0.1]
             [−2  3]     [−0.2  0.3]

Check the first entry of A A⁻¹: 3(0.4) + 1(−0.2) = 1.0. Good.

Python 2x2 determinant and inverse

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Solving a system with the inverse

Write the system 3x + y = 7, 2x + 4y = 8 as Ax = b with A = [3 1; 2 4] and b = [7; 8]. Multiply both sides by A⁻¹ on the left:

Text
x = A⁻¹ b = [0.4·7 − 0.1·8 ; −0.2·7 + 0.3·8] = [2.0 ; 1.0]

So x = 2, y = 1. Check: 3(2) + 1 = 7 and 2(2) + 4(1) = 8.

Order matters: the inverse goes on the left of b, because matrix multiplication is not commutative. If det A = 0 the system has either no solution or infinitely many (the lines are parallel or the same).

Python Solve systems and test singular cases

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Matrices as transformations

Multiplying a column vector by a 2 × 2 matrix moves points. The columns of the matrix are where the unit vectors i = ⟨1, 0⟩ and j = ⟨0, 1⟩ land.

Transformation Matrix
Rotation by θ counterclockwise [cos θ −sin θ; sin θ cos θ]
Scale by k [k 0; 0 k]
Stretch x by s [s 0; 0 1]
Reflect in the x-axis [1 0; 0 −1]
Reflect in the line y = x [0 1; 1 0]
Horizontal shear [1 k; 0 1]

Rotation matrices have determinant cos²θ + sin²θ = 1, so they preserve area. The inverse of a rotation by θ is a rotation by −θ.

Doing two transformations in a row is a matrix product, applied right to left: BA means "A first, then B".

Example: rotate ⟨1, 0⟩ by 90°. [0 −1; 1 0]·[1; 0] = [0; 1], so it lands on ⟨0, 1⟩.

Python Transform a triangle

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the determinant of [2 5; 1 4]?

    2·4 - 5·1 = 3.
  2. 2. Which matrix has no inverse?

    Its determinant is 1·4 - 2·2 = 0.
  3. 3. If det A = -3, what does A do to areas?

    The area scale factor is |det A| = 3; the negative sign means a reflection.
  4. 4. In the product BA applied to a vector, which transformation happens first?

    BAx = B(Ax), so A acts first.

Summary

  • det [a b; c d] = ad − bc; its absolute value is the area scale factor.
  • The inverse exists only if the determinant is not zero: A⁻¹ = (1/det) [d −b; −c a].
  • Solve Ax = b with x = A⁻¹b.
  • Columns of a matrix show where the unit vectors go; rotations, reflections, scalings and shears are all matrices.
  • Composition of transformations is matrix multiplication, applied right to left.

Next: Parametric Equations