# complementary IIR filters

I would like a pair of complementary IIR filters (lowpass/highpass). By complementary, I mean, when the output from the two filters is summed, the original signal is recovered. I thought I could build such pairs with butterworth filters but using a little math, I discovered only 1st order filters were complementary. I thought I'd done this before, but I'm forgetting how.

Is something wrong with my math? Is there an easy solution I'm forgetting about?

Thanks!

• If you describe your application in more detail, it would be helpful. I don't see any real benefit to complementary filters in this sense. However, if you're willing to filter your signals again prior to adding them and getting the original back, it's a very different story involving wavelets. So if I can get more info on what you're trying to do, I should be able to help you out. – Phonon Jun 22 '12 at 15:34

Juancho's answer is sort of right, however there is one problem: The complimentary filter of a low pass is generally NOT a high pass filter, at least not in the sense that you are looking for. For example the one's compliment of a 4th order Butterworth low pass does not look like a 4th order high pass filter at all. It has about only half the steepness, reaches a maximum gain of ca. +6 dB below the crossover frequency and than slowly approaches unity gain above the cross over frequency.

The only matching high and low pass filters that sum to unity are first order filters. You can however find matching higher order filters that sum to unity gain so that the overall transfer function of the sum is an all pass filter. These are odd order Butterworth filters and even order Linkwitz Riley filters.

• Ah, interesting! The first thing I tried when I was looking at this was third order butterworth because I thought I remembered odd-order butterworth's having these properties (and other properties I want), but it did not work. I must have made a mistake. I'll try again, thanks! – Bjorn Roche Jun 23 '12 at 14:50
• Odd-order BWs are 90 degrees out of phase so you can actually add or subtract them for a flat overall response. However the sum and the difference have significantly different group delay, so there s a unique "best" choice. – Hilmar Jun 23 '12 at 22:51

The frequency response of the two complementary filters are $H_2(e^{j\theta}) = 1 - H_1(e^{j\theta})$, or the impulse responses $h_2[n] = \delta[n] - h_1[n]$.

For an IIR filter, $H_1(z)$ can be written as $\frac{b_0 + b_1 z^{-1} + \ldots}{a_0 + a_1 z^{-1} + \ldots}$. Then $H_2(z)$ should be something like $\frac{(a_0 - b_0) + (a_1 - b_1) z^{-1} + \ldots}{a_0 + a_1 z^{-1} + \ldots}$.

So the non-recursive coefficients for $H_2$ are now $(a_0-b_0)$, $(a_1 - b_1)$, etc.

The recursive coefficients are the same for both filters.

• A great answer is one that seems obvious in retrospect! Thanks! – Bjorn Roche Jun 22 '12 at 16:44