---
title: Signal space and M-ary detection
heading: Signals as vectors, orthonormal bases and Gram–Schmidt, constellations, minimum-distance detection, the union bound, and from symbol errors to bit errors
eyebrow: S8 · Lesson 15 · Signal space and M-ary detection
xp: 50
---

::: hook
Once there are more than two possible signals, the binary picture of "two numbers and a threshold" needs a generalization, and the right one is geometry. Any set of finite-energy signals can be written as points in a space with a handful of dimensions, where energy is squared length and the receiver's job is to find the nearest point to what it received. Every modulation scheme, from QPSK to 1024-QAM, becomes a picture of dots, and its error rate can be read off from the distances between them.
:::

::: play
- A QPSK constellation received in Gaussian noise: each transmitted point becomes a cloud, and the decision regions (quadrants) assign each received point to the nearest symbol.
- Lowering Eb/N0 spreads the clouds until they cross the boundaries: errors.
- A phase offset rotates the clouds toward the boundaries, which is why carrier recovery matters (lesson 22).
:::
:::

```sim plot
view: constellation
scheme: qpsk
slider: EbN0 = 0..14 = 8 dB step 0.5
slider: theta = -45..45 = 0 ° step 5
ebn0: EbN0
phase: theta°
symbols: 600
regions: on
```

::: predict
## QPSK sends two bits per symbol. Compared with BPSK at the same Eb/N0, is its bit error rate better, worse or the same?

- [ ] Worse, because the points are closer together
- [ ] Better, because there are more points
- [x] The same: QPSK is two BPSK signals in quadrature
- [ ] It depends on the symbol rate

::: reveal
The same. QPSK puts one bit on the cosine carrier and one on the sine carrier, two independent BPSK channels sharing the bandwidth. Each symbol has energy $E_s = 2E_b$, its points sit $\sqrt{2E_s} = 2\sqrt{E_b}$ apart, and with Gray coding $P_b = Q(\sqrt{2E_b/N_0})$, exactly BPSK's. QPSK doubles the bit rate in the same bandwidth for free.
:::
:::

::: nameit
## Signal space

Signals $s_1(t), \dots, s_M(t)$ are combinations of N ≤ M orthonormal basis functions $\phi_j(t)$: $s_i = \sum_js_{ij}\phi_j$, where $s_{ij} = \int s_i\phi_j\,dt$. **Gram–Schmidt** builds the basis one signal at a time, subtracting the projections onto earlier basis functions and normalizing what's left.

- Energy is squared length: $E_i = \|\mathbf{s}_i\|^2$.
- Correlation: $\rho = \frac{\langle s_i, s_k\rangle}{\sqrt{E_iE_k}}$.
- Distance: $d_{ik}^2 = E_i + E_k - 2\rho\sqrt{E_iE_k}$.

## Detection

A bank of N correlators projects the received signal onto the basis, giving $\mathbf{r} = \mathbf{s}_i + \mathbf{n}$ with independent Gaussian components of variance $N_0/2$. With equal priors the **maximum-likelihood** decision is the **nearest point**; the boundaries between points form the decision regions.

## Error probability

- Pairwise: $P(\mathbf{s}_i \to \mathbf{s}_k) = Q\left(\frac{d_{ik}}{\sqrt{2N_0}}\right)$.
- **Union bound**: $P_s \le \sum_{k\ne i}Q\left(\frac{d_{ik}}{\sqrt{2N_0}}\right)$; for M orthogonal signals, $(M - 1)Q(\sqrt{E_s/N_0})$.
- **Nearest-neighbor approximation**: $P_s \approx K\,Q\left(\frac{d_\text{min}}{\sqrt{2N_0}}\right)$ with K the average number of nearest neighbors.

## Symbols and bits

$E_s = E_b\log_2M$. With **Gray coding**, neighbors differ in one bit, so $P_b \approx P_s/\log_2M$.
:::

::: example
## Apply Gram–Schmidt to $s_1$, a rectangle of height A on [0, T], and $s_2$, height A on [0, T/2]. How far apart are they?

::: solution
1. **Energies and inner product.**
   $$\begin{aligned} E_1 &= A^2T \\ E_2 &= A^2T/2 \\ \langle s_1, s_2\rangle &= A^2T/2 \end{aligned}$$
2. **Correlation.**
   $$\begin{aligned} \rho &= \frac{A^2T/2}{A^2T/\sqrt2} \\ &= 0.707 \end{aligned}$$
3. **Distance.**
   $$\begin{aligned} d^2 &= A^2T(1 + 0.5 \\ &\quad - 2 \times 0.707 \times 0.707) \\ &= 0.5A^2T \end{aligned}$$
4. **Basis.** $\phi_1 = s_1/\sqrt{E_1}$, and $\phi_2$ is the part of $s_2$ orthogonal to it, ±$1/\sqrt{T}$ on the two halves.

**Answer:** ρ = 0.707, and the signals' squared distance is $d^2 = 0.5A^2T$.
:::
:::

::: example
## Four orthogonal signals at $E_s/N_0$ = 10 dB. What does the union bound give?

::: solution
1. **Union bound.**
   $$\begin{aligned} P_s &\le 3Q(\sqrt{10}) \\ &= 3Q(3.16) \\ &= 2.3 \times 10^{-3} \end{aligned}$$
2. **Per bit.** Each symbol carries 2 bits, so
   $$\begin{aligned} E_b/N_0 &= 10 - 3 \\ &= 7\ \text{dB} \end{aligned}$$
3. **Larger M.** Orthogonal signaling gets better per bit as M grows, at the cost of bandwidth that grows with M (lesson 20).

**Answer:** $P_s \le 2.3 \times 10^{-3}$, at an $E_b/N_0$ of 7 dB.
:::
:::

::: example
## 8-PSK runs at Es/N0 = 15 dB. Estimate its symbol and bit error probabilities with the nearest-neighbor approximation.

::: solution
1. **Nearest neighbors.** Neighbors on the circle are $d_\text{min} = 2\sqrt{E_s}\sin(\pi/8)$ apart, and each point has two of them.
2. **Symbol errors.**
   $$\begin{aligned} P_s &\approx 2Q\left(\sqrt{2E_s/N_0}\sin\frac{\pi}{8}\right) \\ &= 2Q(3.04) \\ &= 2.3 \times 10^{-3} \end{aligned}$$
3. **Bit errors.** With Gray coding,
   $$\begin{aligned} P_b &\approx P_s/3 \\ &= 7.8 \times 10^{-4} \end{aligned}$$

**Answer:** $P_s \approx 2.3 \times 10^{-3}$ and $P_b \approx 7.8 \times 10^{-4}$.
:::
:::

::: check
given: E = 3 | 8 | 12; M = 4 | 16 | 64
answer: E + 10*log(log(M)/log(2))
unit: dB
tolerance: 0.05

## An M = {M} scheme runs at Eb/N0 = {E} dB. What's its Es/N0?

::: right
Right. $E_s = E_b\log_2M$: {answer} dB.
:::

::: misses
- [E + 10*log(M)] Each symbol carries log₂M bits, not M.
- [any] Not yet. $E_s/N_0 = (E_b/N_0)\log_2M$.
:::
:::

::: check
given: a = 2 | 4 | 9; b = 1 | 2.25; r = 0.3 | 0.5 | -0.6
answer: sqrt(a + b - 2*r*sqrt(a*b))
tolerance: 0.5%

## Two signals have energies {a} and {b} and correlation coefficient {r}. How far apart are they in signal space?

::: right
Right. $\sqrt{E_1 + E_2 - 2\rho\sqrt{E_1E_2}}$ = {answer}.
:::

::: misses
- [sqrt(a + b)] That's for ρ = 0 only.
- [a + b - 2*r*sqrt(a*b)] That's the squared distance.
- [any] Not yet. Expand $\|\mathbf{s}_1 - \mathbf{s}_2\|^2$.
:::
:::

::: check
given: K = 2 | 3 | 4; d = 10 | 14 | 18
answer: K*Q(sqrt(10^(d/10)/2))
tolerance: 1%

## A constellation's nearest neighbors are $d_\text{min}$ apart with $d_\text{min}^2/N_0$ = {d} dB, and each point has {K} of them on average. What's the approximate symbol error probability?

::: right
Right. $K\,Q(d_\text{min}/\sqrt{2N_0})$ = {answer}.
:::

::: misses
- [Q(sqrt(10^(d/10)/2))] Multiply by the number of nearest neighbors.
- [K*Q(sqrt(10^(d/10)))] The argument is $d/\sqrt{2N_0}$: halve $d^2/N_0$ inside the root.
- [any] Not yet. $P_s \approx KQ(d_\text{min}/\sqrt{2N_0})$.
:::
:::

::: check
given: M = 4 | 8 | 16; E = 6 | 10
answer: (M - 1)*Q(sqrt(10^(E/10)))
tolerance: 1%

## M = {M} orthogonal signals at Es/N0 = {E} dB. What's the union bound on the symbol error probability?

::: right
Right. $(M - 1)Q(\sqrt{E_s/N_0})$ = {answer}.
:::

::: misses
- [Q(sqrt(10^(E/10)))] Sum over all M − 1 competing signals.
- [any] Not yet. Each competitor is $\sqrt{2E_s}$ away.
:::
:::

::: check
given: P = 0.001 | 0.0001 | 0.00001; M = 4 | 16 | 256
answer: P/(log(M)/log(2))
tolerance: 0.5%

## A Gray-coded M = {M} scheme has symbol error probability {P}. Roughly what's its bit error probability?

::: right
Right. $P_s/\log_2M$ = {answer}.
:::

::: misses
- [P/M] Divide by bits per symbol, log₂M.
- [any] Not yet. A symbol error usually flips one of log₂M bits.
:::
:::

::: check
given: E = 4 | 9 | 16
answer: 2*sqrt(E)
tolerance: 0.5%

## QPSK runs with bit energy $E_b$ = {E} (in units where $\sqrt{E}$ is a distance). How far apart are adjacent constellation points?

::: right
Right. $\sqrt{2E_s} = 2\sqrt{E_b}$ = {answer}.
:::

::: misses
- [sqrt(2*E)] Adjacent QPSK points are $\sqrt{2E_s}$ apart, with $E_s = 2E_b$.
- [any] Not yet. Points at radius $\sqrt{E_s}$, 90° apart.
:::
:::

::: check
kind: parts
given: a = 1 | 4; b = 2 | 3; r = -0.5 | 0 | 0.5; N = 0.1 | 0.5

## Two signals have energies {a} and {b} and correlation coefficient {r}; the noise density is $N_0$ = {N}.

::: part
answer: sqrt(a + b - 2*r*sqrt(a*b))
tolerance: 0.5%

### How far apart are they in signal space?

::: misses
- [any] $d^2 = E_1 + E_2 - 2\rho\sqrt{E_1E_2}$.
:::
:::

::: part
answer: Q(sqrt(a + b - 2*r*sqrt(a*b))/sqrt(2*N))
tolerance: 1%

### What is the probability of mistaking one for the other?

::: misses
- [any] $Q(d/\sqrt{2N_0})$.
:::
:::
:::

::: check
kind: derivation
vars: E = 1..1000, M = 4..64, n = 0.1..10

## M-PSK has symbol energy E in noise density n.

::: step
answer: 2*sqrt(E)*sin(pi/M)

### How far apart are neighbors?
:::

::: step
answer: 2*Q(2*sqrt(E)*sin(pi/M)/sqrt(2*n))

### What is the nearest-neighbor symbol error estimate?
:::

::: step
answer: 2*Q(2*sqrt(E)*sin(pi/M)/sqrt(2*n))/(log(M)/log(2))

### And the bit error estimate with Gray coding?
:::

::: right
Right. Doubling M nearly halves $\sin(\pi/M)$, costing about 6 dB for each extra bit at large M.
:::
:::

::: explain
## Why is maximum-likelihood detection in white Gaussian noise the same as choosing the nearest constellation point?

::: model
After the correlators, the received vector is the transmitted point plus noise whose components are independent Gaussian variables with equal variance. The probability density of that noise depends only on its length, falling off as $e^{-\|\mathbf{n}\|^2/N_0}$, so it's the same in every direction. The likelihood of having sent a particular point is therefore a decreasing function of the distance from the received vector to that point. Choosing the most likely point means choosing the one with the smallest distance. The decision regions are bounded by the perpendicular bisectors between neighboring points, which is why error rates depend on the distances between points and nothing else.
:::
:::

::: practice

::: check
given: E = 5 | 10; M = 8 | 32
answer: E + 10*log(log(M)/log(2))
unit: dB
tolerance: 0.05

## Es/N0 for Eb/N0 {E} dB, M = {M}?

::: misses
- [any] $+10\log\log_2M$.
:::
:::

::: check
given: a = 2 | 5; b = 1 | 3; r = 0.3 | -0.4
answer: sqrt(a + b - 2*r*sqrt(a*b))
tolerance: 0.5%

## Distance: energies {a} and {b}, ρ = {r}?

::: misses
- [any] $\sqrt{E_1 + E_2 - 2\rho\sqrt{E_1E_2}}$.
:::
:::

::: check
given: M = 8 | 32; E = 8 | 12
answer: (M - 1)*Q(sqrt(10^(E/10)))
tolerance: 1%

## Union bound: {M} orthogonal signals at Es/N0 {E} dB?

::: misses
- [any] $(M - 1)Q(\sqrt{E_s/N_0})$.
:::
:::
:::
