What the inverse Z-transform gives you
The Z-transform plays the same role for discrete sequences that the Laplace transform plays for continuous signals: it turns a difference equation into an algebraic expression in z. Inverting it recovers the sequence, and for a filter the most informative sequence is the impulse response.
y[n] = (b₀x[n] + b₁x[n−1] + b₂x[n−2] − a₁y[n−1] − a₂y[n−2]) / a₀
Setting x[0] = 1 and every other input to zero makes y[n] equal h[n], the impulse response. That single substitution is all the tool does — the rest is bookkeeping.
The recursion, step by step
Because each output depends on past outputs as well as past inputs, the sequence is generated one sample at a time. Nothing is solved globally; the values fall out of the recurrence.
- Start with y[−1] = y[−2] = 0 and x[0] = 1, x[n] = 0 for n > 0.
- Compute y[0] = b₀/a₀. For the default example that is 1.
- For n = 1, subtract a₁y[0] from b₁x[0], then divide by a₀: (0 − (−0.5)(1))/1 = 0.5.
- For n = 2, subtract a₁y[1]: (0 − (−0.5)(0.5)) = 0.25. The pattern continues.
| n | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| h[n] | 1 | 0.5 | 0.25 | 0.125 | 0.0625 | 0.03125 |
Each sample is exactly half the one before, so h[n] = 0.5ⁿ. That is the discrete twin of e^(−at): a single pole at z = 0.5 produces a geometric decay whose ratio is the pole location itself.
Poles and the unit circle
The denominator a₀ + a₁z⁻¹ + a₂z⁻² has at most two roots. Their positions in the complex plane determine everything about the filter's long-run behaviour, and the boundary that matters is the unit circle rather than the imaginary axis.
| Pole location | Impulse response | Verdict |
|---|---|---|
| |p| < 1, real positive | Monotone geometric decay | Stable |
| |p| < 1, real negative | Alternating decay | Stable |
| |p| < 1, complex pair | Decaying oscillation | Stable |
| |p| = 1 | Constant or sustained oscillation | Marginally stable |
| |p| > 1 | Growth without bound | Unstable |
A pole on the circle is not stable. A pole exactly at z = 1 makes the filter an accumulator: h[n] = 1 for every n, forever. That is a perfect integrator in exact arithmetic, but any rounding error accumulates with it, so real implementations drift.
Reading the frequency response from two numbers
The DC gain is H(1), found by setting z = 1 so every z⁻¹ becomes 1. The Nyquist gain is H(−1), where z⁻¹ alternates sign. Together they tell you whether the filter passes low frequencies, high frequencies, or neither.
For the default example, H(1) = 1/(1 − 0.5) = 2 and H(−1) = 1/(1 + 0.5) = 0.667. Low frequencies are boosted threefold relative to the highest frequency, so this is a low-pass filter — and a fairly gentle one. A two-sample average, b₀ = b₁ = 0.5, gives H(1) = 1 and H(−1) = 0, which is a much stronger low-pass.
A gain above 1 at DC is not an error. It means the filter has a DC gain of 2, which you may or may not want; normalising so that H(1) = 1 is a standard first step in filter design.
Common transform pairs
| H(z) | h[n] | Description |
|---|---|---|
| 1 | δ[n] | Identity — passes the signal through |
| z⁻¹ | δ[n−1] | One-sample delay |
| 1/(1 − az⁻¹) | aⁿ·u[n] | Geometric decay (|a| < 1) |
| 1/(1 − z⁻¹) | u[n] | Accumulator — a running sum |
| (1 − z⁻¹)/(1 − az⁻¹) | aⁿ − aⁿ⁻¹ | First difference of a decay |
| 1/(1 − 2cosθ·z⁻¹ + z⁻²) | sin((n+1)θ)/sinθ | Undamped resonator |
The last pair is the discrete oscillator: poles on the unit circle at e^(±jθ) produce a sine that never decays. Digital signal generators are built from exactly this recursion, which is why they need their initial conditions set precisely — a rounding error shows up as a slowly growing or shrinking amplitude.
Scope and limits
This tool handles denominators up to second order and reports the first N samples of h[n]. That covers the overwhelming majority of textbook filters and every biquad in a real audio chain, since higher-order filters are almost always built by cascading second-order sections.
It does not perform symbolic inversion, so it will not hand you a closed form like 0.5ⁿ. It gives you the numbers, the pole locations and the stability verdict — from which the closed form is usually obvious, as it is for the default example.
Frequently asked questions
What is the inverse Z-transform of 1/(1 − 0.5z⁻¹)?
The impulse response is h[n] = 0.5ⁿ for n ≥ 0: 1, 0.5, 0.25, 0.125 and so on. Each sample is half the previous one because the single pole sits at z = 0.5.
How do I know a digital filter is stable?
Every pole of H(z) must lie strictly inside the unit circle, |p| < 1. A pole on the circle gives a response that never decays, and a pole outside it grows without bound.
What is the difference between the DC gain and the Nyquist gain?
H(1) is the response at zero frequency — set z = 1. H(−1) is the response at the highest representable frequency, where the signal alternates every sample — set z = −1. Comparing the two tells you which end of the spectrum the filter favours.
Why does a₂ = 0 give only one pole?
With a₂ = 0 the denominator is first order, so there is a single pole at z = −a₁/a₀. The apparent second root at zero is an artefact of treating a first-order polynomial as quadratic.
Can this handle a filter with three or more poles?
Not directly. In practice you cascade second-order sections and multiply their responses, which is how biquads are implemented in audio software. Each section is within this tool's range.
Why does the impulse response of an accumulator never decay?
Its pole sits exactly at z = 1, on the unit circle. Every input adds permanently to the running total, so a single impulse leaves a step of height 1 that stays at 1 forever.