---
title: Elimination, and what "no solution" means physically
heading: Solving by elimination, and when a circuit has no answer
eyebrow: A7 · Lesson 8 · Elimination
xp: 40
---

::: hook
Connect a 5 V battery and a 6 V battery directly in parallel, ideal ones with no internal resistance, and ask a circuit simulator for the voltage. It refuses: "singular matrix". The equations contradict each other, and no voltage can satisfy both. Elimination, the standard way to solve linear systems, discovers exactly that kind of contradiction on its way to the answer.

::: play
- The lines are $a_1x + y = c_1$ and $a_2x + y = c_2$. Where they cross is the solution.
- Make $a_1 = a_2$. What happens to the lines? Now also make $c_1 = c_2$.
- Watch the number in the strip as the lines turn parallel. It's the determinant of the system, the subject of the next lesson.
:::
:::

```sim plot
view: graph
x: x = -5..5
y: y = -5..5
slider: a1 = -2..2 step 0.25 = 1
slider: c1 = -3..3 step 0.5 = 2
slider: a2 = -2..2 step 0.25 = -0.5
slider: c2 = -3..3 step 0.5 = -1
plot: c1 - a1*x | label: first equation
plot: c2 - a2*x | color: ch2 | label: second equation
point: (c1 - c2)/(a1 - a2), c1 - a1*(c1 - c2)/(a1 - a2) | color: ch3 | label: solution
readout: determinant = a1 - a2
```

::: predict
## Elimination on $x + y = 3$ and $2x + 2y = 7$ subtracts twice the first equation from the second. What's left?

- [ ] $0 = 0$
- [x] $0 = 1$
- [ ] $x = 1$
- [ ] $y = 3.5$

::: reveal
$0 = 1$: a contradiction, so there is no solution. The second equation's left side is exactly twice the first's, but its right side isn't twice 3. The two lines are parallel and never meet. If the right side had been 6, elimination would leave $0 = 0$: the same line twice, and infinitely many solutions.
:::
:::

::: nameit
## Gaussian elimination

Write the system as an **augmented matrix**, the coefficients with the right-hand side alongside, and use the first equation to clear $x$ from those below it, then the second to clear $y$, and so on:

$$\left[\begin{array}{ccc|c} 2 & 1 & 1 & 5 \\ 4 & -6 & 0 & -2 \\ -2 & 7 & 2 & 9 \end{array}\right] \;\to\; \left[\begin{array}{ccc|c} 2 & 1 & 1 & 5 \\ 0 & -8 & -2 & -12 \\ 0 & 8 & 3 & 14 \end{array}\right] \;\to\; \left[\begin{array}{ccc|c} 2 & 1 & 1 & 5 \\ 0 & -8 & -2 & -12 \\ 0 & 0 & 1 & 2 \end{array}\right]$$

Each step subtracts a multiple of one row from another: here row 2 minus 2 × row 1, row 3 plus row 1, then row 3 plus row 2. The result is **upper triangular**, and **back substitution** finishes it from the bottom: $z = 2$, then $-8y - 4 = -12$ gives $y = 1$, then $2x + 1 + 2 = 5$ gives $x = 1$.

The diagonal numbers you divide by, here 2, −8 and 1, are the **pivots**. Things go wrong when a pivot is zero and can't be fixed by swapping rows:

- A row becomes $0 = $ (nonzero): **no solution**. The equations contradict each other.
- A row becomes $0 = 0$: **infinitely many solutions**. One equation added nothing new, so one unknown is free.

**In circuits** both have a physical meaning:

- **No solution:** two ideal voltage sources in parallel that disagree, or ideal current sources in series that disagree. Real sources have internal resistance, which removes the contradiction.
- **Infinitely many:** part of the circuit floats, with no connection to ground, so its voltages are known only relative to each other. Adding a ground reference fixes it.

Elimination takes about $\tfrac23n^3$ operations for $n$ equations, so a thousand-node circuit takes under a billion: well under a second on a laptop. Simulators also exploit the fact that most entries of $G$ are zero.
:::

::: example
## Solve $x + y + z = 6$, $2x + 3y + z = 11$, $x + 2y + 3z = 14$ by elimination.

::: solution
1. **Clear $x$ from row 2.** Row 2 minus 2 × row 1:
   $$y - z = -1$$
2. **Clear $x$ from row 3.** Row 3 minus row 1:
   $$y + 2z = 8$$
3. **Clear $y$.** Subtract those two:
   $$3z = 9$$
4. **Back-substitute.**
   $$\begin{aligned} z &= 3 \\ y &= -1 + 3 \\ &= 2 \\ x &= 6 - 2 - 3 \\ &= 1 \end{aligned}$$

**Answer:** $x = 1$, $y = 2$ and $z = 3$.
:::
:::

::: example
## What does elimination do to $x + y = 3$, $2x + 2y = 7$?

::: solution
1. **Eliminate.** Row 2 minus 2 × row 1 gives
   $$0 = 1$$
2. **Read it.** The equations contradict each other: the lines are parallel and never meet.

**Answer:** elimination ends in $0 = 1$, so there's no solution.
:::
:::

::: example
## Solve $2y = 4$, $3x + y = 5$ by elimination.

::: solution
1. **Spot the zero pivot.** Written in order, the first equation has no $x$ term: the first pivot would be 0, and you can't divide by it.
2. **Exchange the two rows.**
   $$3x + y = 5, \qquad 2y = 4$$
   Now the system is already triangular.
3. **Back-substitute.**
   $$\begin{aligned} y &= 2 \\ 3x &= 5 - 2 \\ x &= 1 \end{aligned}$$
4. **What a zero pivot means.** A zero in a pivot position only means the rows are in an unlucky order; the system is singular only if no exchange can fix it.

**Answer:** $x = 1$ and $y = 2$, after one row exchange.
:::
:::

::: check
given: a = 3 | 5; b = 1 | 2 | 4
answer: b/a
tolerance: 0.5%

## To clear $x$ from row 2 using row 1, you subtract $m$ times row 1 from row 2. With row 1 starting with {a} and row 2 starting with {b}, what is $m$?

::: right
Right. $m = \given{b}/\given{a}$ makes the first entry of row 2 become $\given{b} - m\cdot\given{a} = 0$.
:::

::: misses
- [a/b] That's upside down: the multiplier is the entry to clear divided by the pivot.
- [b - a] Elimination scales the row; it doesn't subtract the entries directly.
- [any] Not yet. Choose m so that $\given{b} - m \cdot \given{a} = 0$.
:::
:::

::: check
kind: parts
given: x = -3..3 int; y = -3..3 int; z = 1..4 int; p = 2..4 int; q = 1..3 int; r = 2..5 int; let c3 = r*z; let c2 = q*y + z; let c1 = p*x + y + z

## Back-substitute: $\given{p}x + y + z = \given{c1}$, $\;\given{q}y + z = \given{c2}$, $\;\given{r}z = \given{c3}$.

::: part
answer: z
tolerance: 0.001

### What is $z$?

::: misses
- [any] The last equation has only z: divide by {r}.
:::
:::

::: part
answer: y
tolerance: 0.001

### What is $y$?

::: misses
- [any] Put z into the middle equation and solve for y.
:::
:::

::: part
answer: x
tolerance: 0.001

### What is $x$?

::: misses
- [any] Put y and z into the first equation.
:::
:::

::: right
Right. Triangular systems solve from the bottom up, one unknown per line.
:::
:::

::: check
kind: choice

## A 5 V and a 6 V ideal voltage source are connected in parallel. What does the circuit's system of equations have?

- [ ] Exactly one solution
- [x] No solution
- [ ] Infinitely many solutions
- [ ] Two solutions

::: right
Right. One equation says the voltage is 5 V, another says 6 V. Elimination ends in a contradiction like $0 = 1$.
:::

::: misses
- [1] A unique solution needs the equations to agree. These contradict.
- [3] That's the floating-circuit case, where the equations repeat rather than contradict.
- [4] Linear systems have zero, one or infinitely many solutions, never exactly two.
:::
:::

::: check
kind: choice

## Elimination leaves a row reading $0\;0\;0 \mid 0$. What does that mean?

- [ ] No solution
- [x] One equation was redundant, so there are infinitely many solutions
- [ ] The solution is all zeros
- [ ] You made an arithmetic mistake

::: right
Right. The row says $0 = 0$, which is always true, so that equation added no information and one unknown is left free.
:::

::: misses
- [1] $0 = 0$ is true; a contradiction would be $0 = $ something nonzero.
- [3] Nothing forces the unknowns to be zero; one of them is free.
- [4] Redundant equations are common: a floating node gives one.
:::
:::

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

## Solve $x + y = \given{b}$, $x - y = \given{a}$ by elimination.

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

### What is $y$?

::: misses
- [(a - b)/2] Subtracting row 1 from row 2 leaves $-2y = a - b$.
- [any] Subtract row 1 from row 2, then divide by the pivot.
:::
:::

::: part
answer: (a + b)/2
tolerance: 0.5%

### What is $x$?

::: misses
- [any] Back-substitute: $x = b - y$.
:::
:::
:::

::: check
kind: derivation
vars: p = 1..5

## Solve $x + y = p$, $2x + 3y = 1$.

::: step
answer: 1 - 2*p

### Subtract 2 × row 1 from row 2. What is $y$?
:::

::: step
answer: 3*p - 1

### Back-substitute: what is $x$?
:::

::: right
Right. One elimination step and one back substitution: $y = 1 - 2p$ and $x = 3p - 1$.
:::
:::

::: explain
## Explain what a circuit simulator's "singular matrix" error usually means physically, giving one example.

::: model
It means the circuit's equations don't pin down a unique answer: either they contradict each other or they leave something undetermined. A common example is a part of the circuit with no path to ground, whose voltages are only defined relative to each other, so infinitely many sets of node voltages satisfy the equations. Another is two ideal voltage sources in parallel with different values, which no node voltage can satisfy.
:::
:::

::: practice

::: check
given: a = 2..6 int; b = 1..9 int; x = -4..4 int; y = -4..4 int; let c1 = a*x + y; let c2 = b*y
answer: y
tolerance: 0.001

## Solve for $y$: $\given{a}x + y = \given{c1}$, $\given{b}y = \given{c2}$.

::: misses
- [any] The second equation gives y directly: divide by {b}.
:::
:::

::: check
given: k = 2 | 4; c = 1..9 int; d = 1 | 3 | 5 | 7 | 9
answer: d - k*c
tolerance: 0.001

## The system $x + y = \given{c}$, $\given{k}x + \given{k}y = \given{d}$: subtracting {k} × the first from the second leaves $0 = $ what?

::: misses
- [k*c - d] Second minus {k} times the first: $\given{d} - \given{k}\cdot\given{c}$.
- [any] Subtract $\given{k}(x + y) = \given{k}\given{c}$ from both sides of the second equation.
:::
:::

::: check
kind: choice

## A system of 3 equations in 3 unknowns has pivots 2, −8 and 0 after elimination, with a $0 = 0$ last row. How many solutions?

- [ ] None
- [ ] Exactly one
- [x] Infinitely many
- [ ] Three

::: right
Right. A zero pivot with a consistent row leaves one unknown free.
:::

::: misses
- [1] The last row is consistent, $0 = 0$.
- [2] A zero pivot means one unknown isn't pinned down.
- [4] Linear systems never have exactly three solutions.
:::
:::
:::
