$$H(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}} {1 + a_1z^{-1} + a_2z^{-2}}$$

And taking the definition of flipping the polarity as multiplying every tap in a signal by -1 i.e.

$$[0.2, 0.1, -0.1, -0.2] \to [-0.2, -0.1, 0.1, 0.2]$$

For a zero delay biquad is it sufficient to check that $$b_0 >= 0$$ to assume the biquad is not flipping the polarity accidentally (although it will be modifying the waveform) and if it were, a correction $$H'(z)$$ would be:

$$H'(z) = \frac{-b_0 - b_1z^{-1} - b_2z^{-2}} {1 + a_1z^{-1} + a_2z^{-2}}$$

This relates to audio.

A filter will not flip the polarity for all input signals. It might flip it for certain input frequencies, namely for the ones for which the filter's phase response equals $$\pi+2k\pi$$. The way to check if your filter flips the polarity of a relevant input signal (i.e., for a certain frequency), you have to evaluate the frequency response at that frequency. For a low pass filter you can check the filter's behavior at DC (i.e., frequency zero):

$$H(1)=\frac{b_0+b_1+b_2}{1+a_1+a_2}\tag{1}$$

You want this value to be positive. For a high pass filter you may want to check the frequency response at Nyquist:

$$H(-1)=\frac{b_0-b_1+b_2}{1-a_1+a_2}\tag{2}$$

And for a band pass filter you should check the frequency response at the center frequency.

In sum, a non-trivial filter will not flip the sign for all input frequencies, it might flip it for specific frequencies. Depending on the filter type, there are certain prominent frequencies (e.g., DC or Nyquist) that you need to check.

EDIT:

It is straightforward to show that checking the sign of $$b_0$$ is not sufficient. Take the coefficients

b = [0.13111  -0.26221  -0.13111];
a = [1.00000  -0.74779   0.27221];


We have $$b_0>0$$, but the frequency response at DC is

$$H(1)=-0.5$$

and so the sign of a constant input signal will be flipped (as soon as the transients have died out): • It's the pass band that's of interest i.e. the part of the signal frequency content that's not changed. For instance in stereo audio, if I'm filtering just one channel, whether I'm using H(z) or H'(z) in my example will have huge consequences on the stereo image. Sep 21 '18 at 9:59
• @keith: That's what I assumed anyway. It's just important to realize that also in the pass band, different frequencies will experience different phase shifts. Sep 21 '18 at 10:01
• OK thanks, I'll think on it some more. I have a filter designer and I was hoping for a simple mathematical check to determine if the signage is wrong on any of the designed filters. Sep 21 '18 at 10:04
• @keith: Yes, it's simple, just choose a frequency representative of the pass band and check the phase of the frequency response. It's especially simple for DC and Nyquist (Eqs (1) and (2) of my answer). Sep 21 '18 at 10:06
• So would it be fair to say, if you know that the phase shift of the biquad is less that or equal to 90 degrees, then it wouldn't matter what frequency to sample the biquad at based on your technique? Sep 21 '18 at 10:15