---
title: Determinants, and what a singular matrix means for a circuit
heading: One number that says whether a system can be solved
eyebrow: A7 · Lesson 30 · Determinants
xp: 40
---

::: hook
Before you start eliminating, it would be good to know whether a system has a unique answer at all. One number tells you: the determinant. It also has a picture. It's how much the matrix scales areas, and when it's zero, the matrix squashes the plane flat and can't be undone.

::: play
- The parallelogram is the image of the unit square (dashed), with sides given by the matrix's columns. The strip shows the determinant.
- Compare the determinant with the parallelogram's area as you change the entries. When is the determinant negative?
- Make the determinant exactly zero. What shape does the square become?
:::
:::

```sim plot
view: complex
range: 4
slider: a = -2..3 step 0.25 = 2
slider: b = -2..3 step 0.25 = 0.5
slider: c = -2..3 step 0.25 = 0.5
slider: d = -2..3 step 0.25 = 1.5
curve: step(1 - u)*u + step(u - 1)*step(2 - u)*(1 + j*(u - 1)) + step(u - 2)*step(3 - u)*((3 - u) + j) + step(u - 3)*j*(4 - u) | over: u = 0.0001..3.9999 | dashed | color: ch4
arrow: a + j*c | label: col 1
arrow: b + j*d | color: ch2 | label: col 2
arrow: b + j*d | from: a + j*c | dashed | color: ch2
arrow: a + j*c | from: b + j*d | dashed
readout: det = a*d - b*c
readout: area = abs(a*d - b*c)
```

::: predict
## A matrix doubles every length in the plane: $\begin{bmatrix} 2 & 0 \\ 0 & 2 \end{bmatrix}$. What is its determinant?

- [ ] 2
- [x] 4
- [ ] 0
- [ ] 8

::: reveal
4. Doubling lengths in both directions multiplies every area by $2 \times 2 = 4$, and the determinant is that area factor: $2 \cdot 2 - 0 \cdot 0 = 4$. In three dimensions, doubling every length would multiply volumes by 8, and the 3 × 3 determinant would be 8.
:::
:::

::: nameit
## The determinant is the area factor

For a 2 × 2 matrix,

$$\det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad - bc$$

is the signed area of the parallelogram its columns make: the factor by which it scales every area. Negative means the map flips the plane over, like a mirror.

**Bigger matrices.** The 3 × 3 determinant scales volumes. It can be computed by expanding along a row,

$$\det\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} = a(ei - fh) - b(di - fg) + c(dh - eg)$$

but in practice it's the **product of the pivots** from elimination (with a sign change for each row swap). A triangular matrix's determinant is simply the product of its diagonal.

**Determinant zero means singular.** If $\det A = 0$, $A$ squashes space into a lower dimension: different inputs land on the same output, so $A\mathbf{x} = \mathbf{b}$ has either no solution or infinitely many, and $A$ has no inverse. If $\det A \ne 0$, every $\mathbf{b}$ has exactly one solution.

**The 2 × 2 inverse** shows the determinant dividing everything:

$$\begin{bmatrix} a & b \\ c & d \end{bmatrix}^{-1} = \frac{1}{ad - bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}$$

**Useful rules:** $\det(AB) = \det A \cdot \det B$ (scale, then scale again), and $\det A^{-1} = 1/\det A$.

**In circuits.** A floating circuit, with no ground, gives a conductance matrix whose rows each add to zero: every current leaving one node arrives at another. Then $G$ times the all-ones vector is zero, so $G$ squashes that direction flat, and $\det G = 0$. Picking a ground node removes one row and column and makes the determinant nonzero.
:::

::: example
## What area does $\begin{bmatrix}3 & 1\\2 & 4\end{bmatrix}$ give the unit square?

::: solution
1. **Determinant.**
   $$\begin{aligned} \det &= 3 \times 4 - 1 \times 2 \\ &= 10 \end{aligned}$$
2. **Read it as area.** The unit square becomes a parallelogram of area 10, with sides along the columns $(3, 2)$ and $(1, 4)$.

**Answer:** an area of 10.
:::
:::

::: example
## What does $\det\begin{bmatrix}2 & 4\\1 & 2\end{bmatrix} = 0$ mean?

::: solution
1. **Look at the columns.** The columns $(2, 1)$ and $(4, 2)$ are parallel.
2. **What the matrix does.** It squashes the plane onto a line, so it has no inverse.
3. **In a circuit.** For a circuit's nodal matrix this signals an equation that isn't independent of the others, such as a missing ground.

**Answer:** the matrix flattens the plane onto a line and has no inverse; in a nodal matrix, it points to a dependent equation such as a missing ground.
:::
:::

::: example
## Find the area of the triangle with corners $(0, 0)$, $(4, 1)$ and $(1, 3)$.

::: solution
1. **The parallelogram on the two edges.** The edges from the origin, $(4, 1)$ and $(1, 3)$, span a parallelogram of area
   $$\begin{aligned} \left|\det\begin{bmatrix}4 & 1\\1 & 3\end{bmatrix}\right| &= |12 - 1| \\ &= 11 \end{aligned}$$
2. **Halve it.** The triangle is half of it: 5.5.
3. **The sign.** The sign of the determinant, positive here, says $(1, 3)$ is counterclockwise from $(4, 1)$. Graphics and layout tools use that sign to tell which side of an edge a point is on.

**Answer:** the triangle's area is 5.5.
:::
:::

::: check
given: a = 1..6 int; b = 2 | 4 | 6; c = 1..6 int; d = 1 | 3 | 5
answer: a*d - b*c
tolerance: 0.001

## What is $\det\begin{bmatrix} \given{a} & \given{b} \\ \given{c} & \given{d} \end{bmatrix}$?

::: right
Right. $\given{a}\cdot\given{d} - \given{b}\cdot\given{c}$ = {answer}.
:::

::: misses
- [a*d + b*c] It's the difference of the two products: $ad - bc$.
- [a*b - c*d] Multiply diagonally: top-left with bottom-right, minus top-right with bottom-left.
- [any] Not yet. Use $ad - bc$.
:::
:::

::: check
given: p = 2..9 int; q = -5..5 int; r = 2..9 int; s = -5..5 int; t = 2..9 int
answer: p*r*t
tolerance: 0.001

## What is the determinant of $\begin{bmatrix} \given{p} & \given{q} & \given{s} \\ 0 & \given{r} & 7 \\ 0 & 0 & \given{t} \end{bmatrix}$?

::: right
Right. It's triangular, so the determinant is the product of the diagonal: {answer}.
:::

::: misses
- [p + r + t] Multiply the diagonal entries; don't add them.
- [any] Not yet. For a triangular matrix, multiply the diagonal.
:::
:::

::: check
given: a = 2 | 4; b = 1; c = 1 | 2; d = 3 | 5
answer: d/(a*d - b*c)
tolerance: 0.5%

## What is the top-left entry of the inverse of $\begin{bmatrix} \given{a} & \given{b} \\ \given{c} & \given{d} \end{bmatrix}$?

::: right
Right. Swap the diagonal, negate the off-diagonal, divide by the determinant: $\given{d}/(\given{a}\given{d} - \given{b}\given{c})$.
:::

::: misses
- [1/a] Inverting a matrix isn't inverting each entry.
- [a/(a*d - b*c)] The diagonal entries swap places in the inverse.
- [d] Divide by the determinant.
- [any] Not yet. Use the 2 × 2 inverse formula.
:::
:::

::: check
kind: choice

## A circuit's conductance matrix has every row adding to zero. What does that tell you?

- [ ] The circuit is short-circuited
- [x] No node is grounded, so the matrix is singular and the voltages are only defined relative to each other
- [ ] All the node voltages are zero
- [ ] It's an error in the matrix

::: right
Right. Rows summing to zero means $G$ sends the all-ones vector to zero: raising every node's voltage by the same amount changes no current, so the absolute level is undetermined.
:::

::: misses
- [1] A short would show up as a huge conductance, not a zero row sum.
- [3] The voltages could be anything, as long as their differences are right.
- [4] It's exactly what a floating circuit's matrix looks like.
:::
:::

::: check
kind: parts
given: a = 2 | 3 | 5; b = 1 | 4

## The matrix $A = \begin{bmatrix}\given{a} & 1\\1 & \given{b}\end{bmatrix}$.

::: part
answer: (a*b - 1)/2
tolerance: 0.5%

### What is the area of the triangle with corners $(0, 0)$, $(\given{a}, 1)$ and $(1, \given{b})$?

::: misses
- [a*b - 1] That's the parallelogram; the triangle is half.
- [any] Half of $|\det A|$.
:::
:::

::: part
answer: 4*(a*b - 1)
tolerance: 0.5%

### What is $\det(2A)$?

::: misses
- [2*(a*b - 1)] Doubling a 2 × 2 matrix doubles both rows: the determinant grows by 4.
- [any] $\det(cA) = c^n\det A$.
:::
:::
:::

::: check
kind: derivation
vars: x = 0.5..3, y = 0.5..3

## Work with $A = \begin{bmatrix}x & 1\\1 & y\end{bmatrix}$.

::: step
answer: x*y - 1

### What is $\det A$?
:::

::: step
answer: (x*y - 1)^2

### What is $\det(A^2)$?
:::

::: right
Right. $\det(AB) = \det A\det B$, so squaring a matrix squares its determinant.
:::
:::

::: explain
## Why does a zero determinant mean a system $A\mathbf{x} = \mathbf{b}$ can't have exactly one solution?

::: model
The determinant is the factor by which A scales areas or volumes. If it's zero, A squashes space flat into a line or plane, so different input vectors land on the same output. Then an output on that line is reached by many inputs, giving infinitely many solutions, and an output off it is reached by none. Either way there's no unique solution, and A can't be inverted.
:::
:::

::: practice

::: check
given: a = -9..9 int; b = -9 | -6 | -3 | 3 | 6 | 9; c = -8 | -4 | 4 | 8; d = -9..9 int
answer: a*d - b*c
tolerance: 0.001

## Find $\det\begin{bmatrix} \given{a} & \given{b} \\ \given{c} & \given{d} \end{bmatrix}$.

::: misses
- [a*d + b*c] It's $ad - bc$.
- [any] $ad - bc$.
:::
:::

::: check
given: k = 2..6 int
answer: k^3
tolerance: 0.001

## A 3 × 3 matrix scales every length by {k}. What is its determinant?

::: misses
- [k] Volumes scale by the factor in all three directions.
- [3*k] Multiply, don't add: $k \times k \times k$.
- [any] Volumes scale by $k^3$.
:::
:::

::: check
given: a = 3 | 5 | 7 | 9; b = 2..9 int; c = 2 | 4 | 6; d = 1 | 3 | 5; let D = a*d - b*c
answer: D*2
tolerance: 0.001

## $\det A = \given{D}$ and $\det B = 2$. What is $\det(AB)$?

::: misses
- [D + 2] Determinants multiply.
- [any] $\det(AB) = \det A \cdot \det B$.
:::
:::
:::
