---
title: Orthogonality
heading: Perpendicular subspaces, and why power balances
eyebrow: A7 · Lesson 24 · Orthogonality
xp: 40
---

::: hook
Add up the power absorbed by every branch of any circuit, counting sources as negative, and you get exactly zero. Energy is conserved, so that's no surprise. What's surprising is that it holds for **any** branch voltages obeying KVL with **any** branch currents obeying KCL, even ones from two different circuits with the same wiring. This is Tellegen's theorem, and it isn't physics at all: it says two subspaces of the incidence matrix are perpendicular. Perpendicular subspaces are everywhere in linear algebra, and they're the key to least squares and to signal processing.
:::

::: play
- The matrix here is the single row $\begin{bmatrix}a & b\end{bmatrix}$. Its row space is the solid line along $(a, b)$; its null space is the dashed line, every $\mathbf{x}$ with $ax + by = 0$.
- The fixed vector $\mathbf{x} = (2, 1)$ splits into a piece in each: $\mathbf{x} = \mathbf{x}_r + \mathbf{x}_n$.
- Turn the row. The two lines always meet at a right angle, and the readout of $\mathbf{x}_r \cdot \mathbf{x}_n$ stays at zero.
:::
:::

```sim plot
view: complex
range: 3.5
slider: th = 0..180 step 1 = 20 °
curve: u*(1∠th) | over: u = -4..4 | label: row space
curve: u*(1∠(th + 90)) | over: u = -4..4 | dashed | color: ch2 | label: null space
arrow: 2 + j | label: x
arrow: (2*cos(th°) + sin(th°))*(1∠th) | color: ch3 | label: x_r
arrow: (-2*sin(th°) + cos(th°))*(1∠(th + 90)) | from: (2*cos(th°) + sin(th°))*(1∠th) | dashed | color: ch2 | label: x_n
readout: x_r · x_n = (2*cos(th°) + sin(th°))*(-2*sin(th°) + cos(th°))*(cos(th°)*(-sin(th°)) + sin(th°)*cos(th°)) | digits: 3
readout: |x_r|² + |x_n|² = (2*cos(th°) + sin(th°))^2 + (-2*sin(th°) + cos(th°))^2 | digits: 3
```

::: predict
## For any matrix $A$, every vector in the null space is perpendicular to every row of $A$. Why?

- [x] $A\mathbf{x} = \mathbf{0}$ says each row dotted with $\mathbf{x}$ is zero
- [ ] Because the null space is always a line
- [ ] Only for symmetric matrices
- [ ] Because rows are always independent

::: reveal
Entry $i$ of $A\mathbf{x}$ is row $i$ dotted with $\mathbf{x}$. If $A\mathbf{x} = \mathbf{0}$, every one of those dot products is zero, so $\mathbf{x}$ is perpendicular to every row, and so to every combination of rows: the whole row space.
:::
:::

::: nameit
## Orthogonal vectors and subspaces

Vectors are **orthogonal** when $\mathbf{x}\cdot\mathbf{y} = \mathbf{x}^T\mathbf{y} = 0$. Then Pythagoras holds: $|\mathbf{x} + \mathbf{y}|^2 = |\mathbf{x}|^2 + |\mathbf{y}|^2$.

Two subspaces are orthogonal when every vector in one is orthogonal to every vector in the other.

## The fundamental theorem

For any $m \times n$ matrix $A$:

- the row space $C(A^T)$ and the null space $N(A)$ are orthogonal in $\mathbb{R}^n$, with dimensions $r$ and $n - r$ adding to $n$;
- the column space $C(A)$ and the left null space $N(A^T)$ are orthogonal in $\mathbb{R}^m$, with dimensions $r$ and $m - r$.

Each pair are **orthogonal complements**: together they account for every direction, so every vector splits uniquely into a piece in each.

## Orthonormal bases

Vectors $\mathbf{q}_1, \ldots, \mathbf{q}_n$ are **orthonormal** if they're mutually perpendicular unit vectors. Put them in the columns of $Q$ and $Q^TQ = I$. Coordinates become dot products, with no system to solve:

$$\mathbf{x} = (\mathbf{q}_1\cdot\mathbf{x})\,\mathbf{q}_1 + \cdots + (\mathbf{q}_n\cdot\mathbf{x})\,\mathbf{q}_n$$

A square $Q$ is an **orthogonal matrix**: $Q^{-1} = Q^T$, and it preserves lengths and angles (rotations and reflections). The Fourier basis of A10 is orthonormal, which is why Fourier coefficients are just dot products.

## Tellegen's theorem

Branch voltages that obey KVL lie in $C(A)$, the column space of the incidence matrix. Branch currents that obey KCL lie in $N(A^T)$. Those are orthogonal complements, so

$$\mathbf{v}^T\mathbf{i} = \sum_k v_ki_k = 0$$

The total power absorbed by all branches, sources included, is zero.
:::

::: example
## Check Tellegen's theorem on the circuit from lesson 19 (10 V source; 1 kΩ, 2 kΩ, 1 kΩ, 2 kΩ).

::: solution
1. **Solve the circuit.** Solving gives $v_a = 5.455$ V and $v_b = 3.636$ V, with resistor currents 4.545, 2.727, 1.818 and 1.818 mA.
2. **Power into the resistors.**
   $$\begin{aligned} &20.66 + 14.88 + 3.31 + 6.61 \\ &= 45.45\ \text{mW} \end{aligned}$$
3. **Power into the source.** It has 10 V across it and 4.545 mA flowing out of its positive end, so it absorbs $-45.45$ mW.
4. **Add them.** The total is zero.

**Answer:** the resistors absorb 45.45 mW and the source $-45.45$ mW, so the total is zero, as Tellegen's theorem says.
:::
:::

::: example
## Find the coordinates of $\mathbf{x} = (3, 1)$ in the orthonormal basis $\mathbf{q}_1 = \frac{1}{\sqrt 2}(1, 1)$, $\mathbf{q}_2 = \frac{1}{\sqrt 2}(1, -1)$.

::: solution
1. **Dot with $\mathbf{q}_1$.**
   $$\begin{aligned} \mathbf{q}_1\cdot\mathbf{x} &= \frac{4}{\sqrt 2} \\ &= 2.828 \end{aligned}$$
2. **Dot with $\mathbf{q}_2$.**
   $$\begin{aligned} \mathbf{q}_2\cdot\mathbf{x} &= \frac{2}{\sqrt 2} \\ &= 1.414 \end{aligned}$$
   No equations to solve.
3. **Check with Pythagoras.**
   $$\begin{aligned} 2.828^2 + 1.414^2 &= 8 + 2 \\ &= 10 \\ &= |\mathbf{x}|^2 \end{aligned}$$

**Answer:** the coordinates are 2.828 along $\mathbf{q}_1$ and 1.414 along $\mathbf{q}_2$.
:::
:::

::: example
## Find the orthogonal complement of the line through $(1, 2, 2)$ in $\mathbb{R}^3$.

::: solution
1. **The perpendicular vectors.** The complement is every vector perpendicular to $(1, 2, 2)$: the plane
   $$x + 2y + 2z = 0$$
2. **Dimension and basis.** It has dimension $3 - 1 = 2$, and two independent vectors in it make a basis, for example $(2, -1, 0)$ and $(2, 0, -1)$.
3. **In matrix terms.** The line is the row space of $\begin{bmatrix}1 & 2 & 2\end{bmatrix}$ and the plane is its null space, as the fundamental theorem says.

**Answer:** the plane $x + 2y + 2z = 0$, with basis $(2, -1, 0)$ and $(2, 0, -1)$.
:::
:::

::: check
given: p = 2 | 3; q = 4 | -5
answer: -p/q

## For which $k$ is $(1, k)$ perpendicular to $(\given{p}, \given{q})$?

::: right
Right. $p + kq = 0$ gives $k = -\frac{p}{q}$ = {answer}.
:::

::: misses
- [q/p] That makes them parallel. Perpendicular needs a zero dot product.
- [p/q] Check the sign.
- [any] Not yet. Set the dot product to zero.
:::
:::

::: check
given: a = 2 | 3; b = 1 | 4
answer: -a/b

## A vector in the null space of $\begin{bmatrix}\given{a} & \given{b}\end{bmatrix}$ has first component 1. What is its second component?

::: right
Right. It must be perpendicular to the row: $a + bk = 0$, so $k$ = {answer}.
:::

::: misses
- [b/a] Perpendicular to $(a, b)$ is along $(b, -a)$ or $(-b, a)$; scale so the first component is 1.
- [any] Not yet. Solve $\given{a} \cdot 1 + \given{b}k = 0$.
:::
:::

::: check
given: p1 = 20 | 35; p2 = 10 | 4; p3 = 5 | 12
answer: -(p1 + p2 + p3)
unit: mW

## In a circuit with one source, the three resistors absorb {p1} mW, {p2} mW and {p3} mW. What power does the source absorb?

::: right
Right. Tellegen: the total over all branches is zero, so the source absorbs {answer}, meaning it delivers that much.
:::

::: misses
- [p1 + p2 + p3] Absorbed power for a source that delivers energy is negative.
- [any] Not yet. All the branch powers add to zero.
:::
:::

::: check
given: n = 4 | 7; d = 1 | 3
answer: n - d

## A subspace of $\mathbb{R}^{\given{n}}$ has dimension {d}. What is the dimension of its orthogonal complement?

::: right
Right. The two dimensions add to {n}: {answer}.
:::

::: misses
- [d] The complement takes the remaining directions.
- [any] Not yet. Dimensions of complements add to $n$.
:::
:::

::: check
given: x1 = 3 | 5 | -2; x2 = 1 | 4
answer: (x1 + x2)/sqrt(2)
tolerance: 0.5%

## What is the coordinate of $(\given{x1}, \given{x2})$ along $\mathbf{q}_1 = \frac{1}{\sqrt 2}(1, 1)$?

::: right
Right. $\mathbf{q}_1\cdot\mathbf{x} = \frac{x_1 + x_2}{\sqrt 2}$ = {answer}.
:::

::: misses
- [x1 + x2] Divide by $\sqrt 2$: $\mathbf{q}_1$ is a unit vector.
- [(x1 - x2)/sqrt(2)] That's the coordinate along $\mathbf{q}_2$.
- [any] Not yet. Dot with $\mathbf{q}_1$.
:::
:::

::: check
kind: choice

## $Q$ is a square matrix with orthonormal columns. What is $Q^{-1}$?

- [x] $Q^T$
- [ ] $Q$
- [ ] $-Q$
- [ ] It might not exist

::: right
Right. $Q^TQ = I$ says exactly that $Q^T$ undoes $Q$.
:::

::: misses
- [2] Only for special $Q$, such as a reflection.
- [4] Orthonormal columns are independent, so $Q$ is always invertible.
- [any] Compute $Q^TQ$.
:::
:::

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

## $\mathbf{v} = (1, \given{a}, \given{b})$ and $\mathbf{w} = (\given{b}, 1, c)$ are perpendicular.

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

### What is $c$?

::: misses
- [(a + b)/b] Check the sign: $b + a + bc = 0$.
- [any] Set $\mathbf{v}\cdot\mathbf{w} = 0$.
:::
:::

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

### What is $|\mathbf{w}|^2$?

::: misses
- [any] Square and add the entries.
:::
:::
:::

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

## Write $(x, y)$ in the orthonormal basis $\mathbf{q}_1 = \frac{1}{\sqrt2}(1, 1)$, $\mathbf{q}_2 = \frac{1}{\sqrt2}(1, -1)$.

::: step
answer: (x + y)/sqrt(2)

### What is the coordinate along $\mathbf{q}_1$?
:::

::: step
answer: (x - y)/sqrt(2)

### And along $\mathbf{q}_2$?
:::

::: right
Right. With an orthonormal basis, each coordinate is a dot product, with no system to solve.
:::
:::

::: explain
## Explain why Tellegen's theorem holds for any KVL-obeying voltages and any KCL-obeying currents, even from two different circuits with the same wiring.

::: model
Branch voltages that satisfy KVL are differences of node voltages, so they're $A\mathbf{x}$ for some $\mathbf{x}$: they lie in the column space of the incidence matrix. Branch currents that satisfy KCL have $A^T\mathbf{i} = \mathbf{0}$: they lie in the left null space. Then $\mathbf{v}^T\mathbf{i} = (A\mathbf{x})^T\mathbf{i} = \mathbf{x}^T(A^T\mathbf{i}) = 0$. Only the wiring, through $A$, enters the argument, not the components, so the voltages and currents can come from different circuits.
:::
:::

::: practice

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

## For which $k$ is $(\given{a}, \given{b})$ perpendicular to $(\given{c}, k)$?

::: misses
- [any] Solve $ac + bk = 0$.
:::
:::

::: check
given: x1 = 2 | 6; x2 = 3 | -1
answer: (x1 - x2)/sqrt(2)
tolerance: 0.5%

## What is the coordinate of $(\given{x1}, \given{x2})$ along $\mathbf{q}_2 = \frac{1}{\sqrt 2}(1, -1)$?

::: misses
- [(x1 + x2)/sqrt(2)] That's along $\mathbf{q}_1$.
- [any] Dot with $\mathbf{q}_2$.
:::
:::

::: check
given: m = 5 | 7; r = 2 | 3
answer: m - r

## An {m} × 4 matrix has rank {r}. What is the dimension of the orthogonal complement of its column space?

::: misses
- [4 - r] The column space lives in $\mathbb{R}^{\given{m}}$.
- [any] The left null space: $m - r$.
:::
:::
:::
