# 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
{"ft_lang_label":"__label__en","ft_lang_prob":0.9742936,"math_prob":0.8096789,"size":462,"snap":"2019-43-2019-47","text_gpt3_token_len":99,"char_repetition_ratio":0.12882096,"word_repetition_ratio":0.0,"special_character_ratio":0.2034632,"punctuation_ratio":0.13483146,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98577595,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-15T06:15:40Z\",\"WARC-Record-ID\":\"<urn:uuid:bee63112-2246-4e10-8144-4d7ebe0d8320>\",\"Content-Length\":\"144091\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a25b37c6-faab-4e0a-ac36-cc5d5b9f8ed6>\",\"WARC-Concurrent-To\":\"<urn:uuid:cbfeb067-7d9a-4dc5-99c5-4925dcea6380>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://dsp.stackexchange.com/questions/2681/complementary-iir-filters\",\"WARC-Payload-Digest\":\"sha1:Q2JJLOKN47F3BKP5SMPMPR2URCVRVZW5\",\"WARC-Block-Digest\":\"sha1:TT5H2X6LC4DXLNUQBLOCNFVSKWQV4N3B\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496668585.12_warc_CC-MAIN-20191115042541-20191115070541-00035.warc.gz\"}"}