---
title: The z-transform
heading: The Laplace transform's discrete-time partner
eyebrow: C9 · Lesson 36 · The z-transform
xp: 50
---

::: hook
The DTFT evaluates a sequence's spectrum on the unit circle. The **z-transform** frees z to be any complex number, and does for discrete time what the Laplace transform does for continuous time: it turns difference equations into algebra, convolution into multiplication, and a filter into a ratio of polynomials whose poles and zeros you can see. The unit circle takes over the role of the jω axis. A causal digital filter is stable exactly when its poles lie inside the circle, and the closer a pole sits to the circle, the longer the filter rings.
:::

::: play
- A resonator $H(z) = z^2/(z^2 - 2r\cos\theta\,z + r^2)$: its poles (crosses) sit at radius r and angles ±θ; the circle is the unit circle.
- r sets how long the filter rings: inside the circle it's stable, on it the ringing never ends, outside (shaded) it grows. θ sets the frequency it rings at.
- This is lesson 9's two-line recursion. Its impulse response is drawn below: compare how fast it dies with how close the poles are to the circle.
:::
:::

```sim plot
view: zplane
range: 1.4
slider: r = 0..1.15 = 0.9 step 0.01
slider: theta = 0..180 = 60 step 1 °
num: z^2
den: z^2 - 2*r*cos(theta°)*z + r^2
readout: pole radius = r | digits: 3
readout: samples per cycle of ringing = 360/theta | digits: 3
readout: samples for the ringing to halve = log(0.5)/log(r + 0.000001) | digits: 3
```

```sim plot
view: graph
x: n = 0..40
y: h = -2..2
slider: r = 0..1.1 = 0.9 step 0.01
slider: theta = 0.05..3.1 = 1.047 step 0.01
plot: r^n*sin((n + 1)*theta)/sin(theta) | stems | label: h[n]
```

::: predict
## $x[n] = (0.5)^n u[n]$ has $X(z) = 1/(1 - 0.5z^{-1})$. For which z does the sum defining X(z) converge?

- [ ] All z
- [x] |z| > 0.5
- [ ] |z| < 0.5
- [ ] Only |z| = 1

::: reveal
|z| > 0.5. The sum is $\sum (0.5z^{-1})^n$, a geometric series that converges when $\lvert 0.5z^{-1}\rvert < 1$. The left-sided sequence $-(0.5)^n u[-n-1]$ has the same formula with |z| < 0.5: as with Laplace, the ROC tells them apart.
:::
:::

::: nameit
## The transform

$$X(z) = \sum_{n=-\infty}^{\infty} x[n]\,z^{-n}$$

converges in a **region of convergence**, a ring $r_1 < \lvert z\rvert < r_2$ bounded by poles. On the unit circle, $z = e^{j\omega}$, it's the DTFT, if the ROC includes the circle.

| x[n] | X(z) | ROC |
|---|---|---|
| $\delta[n - k]$ | $z^{-k}$ | all z (except 0 for k > 0) |
| $a^n u[n]$ | $\dfrac{1}{1 - az^{-1}} = \dfrac{z}{z - a}$ | $\lvert z\rvert > \lvert a\rvert$ |
| $-a^n u[-n-1]$ | $\dfrac{1}{1 - az^{-1}}$ | $\lvert z\rvert < \lvert a\rvert$ |

## Properties

A delay by k multiplies by $z^{-k}$; convolution multiplies transforms. So the difference equation $y[n] = \sum a_k y[n-k] + \sum b_k x[n-k]$ gives

$$H(z) = \frac{Y(z)}{X(z)} = \frac{\sum_k b_k z^{-k}}{1 - \sum_k a_k z^{-k}}$$

a ratio of polynomials in $z^{-1}$. Multiplying top and bottom by the highest power of z gives polynomials in z, whose roots are the zeros and poles.

## Causality and stability

A causal system's ROC is outside its outermost pole, $\lvert z\rvert > \max\lvert p\rvert$. A stable one's ROC contains the unit circle. So a causal, stable filter has every pole strictly inside the unit circle. A pole at radius r gives a mode $r^n$, which halves every $\ln 0.5/\ln r$ samples.

$H(1)$ is the DC gain, and $H(-1)$ is the gain at ω = π.
:::

::: example
## Find the z-transform of x = [1, 2, 3] (n = 0 to 2) and its value at z = 1.

::: solution
1. **Transform.** It converges everywhere except z = 0:
   $$X(z) = 1 + 2z^{-1} + 3z^{-2}$$
2. **At z = 1.**
   $$\begin{aligned} X(1) &= 1 + 2 + 3 \\ &= 6 \end{aligned}$$
   the sum of the samples, which is the DTFT at ω = 0.

**Answer:** $X(z) = 1 + 2z^{-1} + 3z^{-2}$, and its value at z = 1 is 6.
:::
:::

::: example
## Find H(z) for $y[n] = 0.9\,y[n-1] - 0.81\,y[n-2] + x[n]$ and decide whether it's stable.

::: solution
1. **Transfer function.**
   $$\begin{aligned} H(z) &= \frac{1}{1 - 0.9z^{-1} + 0.81z^{-2}} \\ &= \frac{z^2}{z^2 - 0.9z + 0.81} \end{aligned}$$
2. **Poles.** They solve $z^2 - 0.9z + 0.81 = 0$:
   $$z = 0.9e^{\pm j\pi/3}$$
   radius 0.9, inside the unit circle.
3. **Behavior.** Causal and stable, ringing every 6 samples and halving every 6.6.

**Answer:** $H(z) = z^2/(z^2 - 0.9z + 0.81)$, with poles at $0.9e^{\pm j\pi/3}$ inside the unit circle, so it's stable.
:::
:::

::: example
## Find X(z) and its region of convergence for $x[n] = 0.5^n u[n] + 2^n u[-n - 1]$.

::: solution
1. **Right-sided part.** For |z| > 0.5 it gives
   $$\frac{1}{1 - 0.5z^{-1}}$$
2. **Left-sided part.** For |z| < 2 it gives
   $$\frac{-1}{1 - 2z^{-1}}$$
3. **ROC.** Both converge only in the ring 0.5 < |z| < 2, so that's the ROC.
4. **DTFT.** It includes the unit circle, so the DTFT exists: the signal decays in both directions.

**Answer:** $X(z) = 1/(1 - 0.5z^{-1}) - 1/(1 - 2z^{-1})$, with ROC 0.5 < |z| < 2.
:::
:::

::: check
given: a = 2 | 1 | -1; b = 3 | -2; c = 1 | 4; z0 = 2 | -2 | 0.5
answer: a + b/z0 + c/z0^2
tolerance: 0.5%

## x = [{a}, {b}, {c}], starting at n = 0. What is X(z) at z = {z0}?

::: right
Right. $a + bz^{-1} + cz^{-2}$ = {answer}.
:::

::: misses
- [a + b*z0 + c*z0^2] The z-transform uses negative powers: $z^{-n}$.
- [any] Not yet. $\sum x[n]z^{-n}$.
:::
:::

::: check
given: a = 0.5 | 0.8 | -0.6; z0 = 2 | 1.5 | -1
answer: z0/(z0 - a)
tolerance: 0.5%

## What is the z-transform of $(\given{a})^n u[n]$ at z = {z0}?

::: right
Right. $z/(z - a)$ = {answer}; the point is in the ROC, |z| > |a|.
:::

::: misses
- [1/(z0 - a)] $1/(1 - az^{-1}) = z/(z - a)$: keep the factor z.
- [any] Not yet. $1/(1 - az^{-1})$.
:::
:::

::: check
given: r1 = 0.5 | 0.9; r2 = 0.3 | 0.95 | 1.2
answer: (r1 + r2 + abs(r1 - r2))/2
tolerance: 0.5%

## A causal filter has poles at radius {r1} and {r2}. Its ROC is |z| > ρ. What is ρ?

::: right
Right. The outermost pole: {answer}.
:::

::: misses
- [(r1 + r2 - abs(r1 - r2))/2] A causal ROC is outside all the poles.
- [any] Not yet. The largest pole radius.
:::
:::

::: check
kind: parts
given: a = 0.5 | 0.9 | -0.7; b = 2 | 0.3

## A filter computes $y[n] = \given{a}\,y[n-1] + \given{b}\,x[n]$.

::: part
answer: a
tolerance: 0.5%

### Where is its pole?

::: misses
- [any] $H(z) = b/(1 - az^{-1}) = bz/(z - a)$.
:::
:::

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

### What is its DC gain, H(1)?

::: misses
- [any] $b/(1 - a)$.
:::
:::
:::

::: check
kind: parts
given: a1 = 1 | 1.2 | 0.6; a2 = -0.64 | -0.81 | -0.49

## A filter computes $y[n] = \given{a1}\,y[n-1] + (\given{a2})\,y[n-2] + x[n]$, and its poles are a complex pair.

::: part
answer: sqrt(-a2)
tolerance: 0.5%

### What is their radius?

::: misses
- [-a2] The poles' product is $-a_2 = r^2$: take the square root.
- [any] Not yet. $r = \sqrt{-a_2}$.
:::
:::

::: part
answer: 1/(1 - a1 - a2)
tolerance: 0.5%

### What is the DC gain?

::: misses
- [any] H(1) = $1/(1 - a_1 - a_2)$.
:::
:::
:::

::: check
given: a = 0.5 | 0.9; b = 1 | 2
answer: b/(1 + a)
tolerance: 0.5%

## $H(z) = \given{b}/(1 - \given{a}z^{-1})$. What is its gain at ω = π?

::: right
Right. H(−1) = $b/(1 + a)$ = {answer}.
:::

::: misses
- [b/(1 - a)] That's at z = 1, DC. At ω = π, z = −1.
- [any] Not yet. Evaluate at z = −1.
:::
:::

::: check
kind: choice

## A causal filter's poles are at 0.5, 0.95e^{±j0.3} and 1.02. Is it stable?

- [ ] Yes: most poles are inside the unit circle
- [x] No: the pole at 1.02 is outside the unit circle
- [ ] Yes: only complex poles matter
- [ ] No: the pole at 0.95 is too close to the circle

::: misses
- [1] One pole outside is enough: its mode grows as $1.02^n$.
- [3] A real pole outside the circle grows without oscillating, but it grows.
- [4] 0.95 is inside: it rings for a while but dies away.
:::
:::

::: check
kind: parts
given: p = 1 | 3; q = -2 | 4; r = 2 | 5

## x = [{p}, {q}, {r}] for n = 0 to 2.

::: part
answer: p + q + r
tolerance: 0

### What is X(z) at z = 1?

::: misses
- [any] The sum of the samples.
:::
:::

::: part
answer: p - q + r
tolerance: 0

### And at z = −1?

::: misses
- [any] $z^{-n}$ alternates in sign.
:::
:::
:::

::: check
kind: parts
given: a = 0.5 | 0.8 | -0.6; z = 2 | 1.5 | -2

## $x[n] = a^n u[n]$ with a = {a}.

::: part
answer: 1/(1 - a/z)
tolerance: 0.5%

### What is X(z) at z = {z}?

::: misses
- [any] $1/(1 - az^{-1})$.
:::
:::

::: part
answer: abs(a)
tolerance: 0.5%

### Outside what radius does it converge?

::: misses
- [any] |z| > |a|.
:::
:::
:::

::: explain
## Why is the unit circle the boundary between stable and unstable for causal digital filters?

::: model
Each pole p of a causal filter contributes a term $p^n$ to the impulse response. Its size is $\lvert p\rvert^n$, which shrinks to zero if |p| < 1, stays constant if |p| = 1, and grows without limit if |p| > 1. The impulse response is absolutely summable, the condition for stability, exactly when every such term shrinks geometrically, so every pole must be strictly inside the circle of radius 1. It's the discrete-time image of the jω axis: $z = e^{sT}$ maps the left half of the s-plane to the inside of the unit circle.
:::
:::

::: practice

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

## X(z) at z = {z0} for x = [{a}, {b}]?

::: misses
- [any] $a + bz^{-1}$.
:::
:::

::: check
given: a2 = -0.25 | -0.36 | -0.49 | -0.64 | -0.81 | -0.9
answer: sqrt(-a2)
tolerance: 0.5%

## Pole radius of a complex pair with $a_2$ = {a2}?

::: misses
- [any] $\sqrt{-a_2}$.
:::
:::

::: check
given: r = 0.8 | 0.95 | 0.99
answer: log(0.5)/log(r)
tolerance: 0.5%

## In how many samples does a pole at radius {r} halve?

::: misses
- [any] $\ln 0.5/\ln r$.
:::
:::
:::
