# Why is Direct Form 2 (Digital Filters) equivalent to Direct Form 1

According to Wikipedia : The alternate Direct Form II only needs N delay units, where N is the order of the filter – potentially half as much as Direct Form I. This structure is obtained by reversing the order of the numerator and denominator sections of Direct Form I, since they are in fact two linear systems, and the commutativity property applies.

Direct Form I:

Direct Form II:

I don't understand this sentence, what is meant by reversing order ?

-

To answer the question why are Direct Form I and Direct Form II equivalent we need to do a little math.

For the Direct Form I Filter

$y_n = b_0 \cdot x_n + b_1 \cdot x_{n-1} + b_2 \cdot x_{n-2} - a_1 \cdot y_{n-1} - a_2 \cdot y_{n-2}$

And its transfer function would be written

$H = \dfrac{b_0 + b_1 \cdot z^{-1} + b_2 \cdot z^{-2}}{1 - a_1 \cdot z^{-1} - a_2 \cdot z^{-2}}$

For the Direct Form II filter we need to introduce a new variable $t_n$ which is the signal at the top centre node

We can easily see that

$y_n = b_0 \cdot t_n + b_1 \cdot t_{n-1} + b_2 \cdot t_{n-2}$

and

$t_n = x_n - a_1 \cdot t_{n-1} - a_2 \cdot t_{n-2}$

Using $z$ notation

$y = t \cdot \left( b_0 + b_1 \cdot z^{-1} + b_2 \cdot z^{-2} \right)$

$t \cdot \left( 1 - a_1 \cdot z^{-1} - a_2 \cdot z^{-2} \right) = x$

Transfer function:

$H = \dfrac{y}{x} = \dfrac{t \cdot \left( b_0 + b_1 \cdot z^{-1} + b_2 \cdot z^{-2} \right)}{t \cdot \left( 1 - a_1 \cdot z^{-1} - a_2 \cdot z^{-2} \right)}$

Which simplifies to

$H = \dfrac{b_0 + b_1 \cdot z^{-1} + b_2 \cdot z^{-2}}{1 - a_1 \cdot z^{-1} - a_2 \cdot z^{-2}}$

Proving the two are equivalent.

The Direct Form II filter has half the number of delay blocks however.

-

The word "order" is used two ways in your quotation from wikipaedia: -

The alternate Direct Form II only needs N delay units, where N is the order of the filter

and

This structure is obtained by reversing the order of the numerator and denominator sections of Direct Form I

In the first quote "order" refers to the "order" of the filter i.e. 1st order, 2nd order etc..

In the 2nd quote, "reversing the order" refers to a re-arrangement of the "circuit": -

Becomes this: -

These are both 2nd order filters and the re-arrangement (reversing of order) of the "a" coefficients with the "b" coefficients (in the circuit) is just a simplification. If you look at the two pictures hard enough you can see how this is achieved: -

Finally the two sections of delay elements ($Z^{-1}$) can be shared. No need for math!!

-

Let me throw another explanation into the mix.

First lets look at Direct Form 1.If you use the diagram you have provided to extract the difference equation that characterizes the diagram you will get:

$$Y(z) = b_0X(z) - a_1z^{-1}Y(z) + b_1z^{-1}X(z) + a_2z^{-1}X(z) - a_2z^{-1}Y(z)$$

but we can rearrange the terms in such a way that we have only 2 delay elements ie.

$$Y(z) = b_0X(z) + z^{-1}\left( b_1X(z) - a_1Y(z) + z^{-1}\left(b_2X(z) - a_2Y(z)\right) \right)$$

the form we have put the transfer function in is called the Direct 2 form, it uses only 2 delay elements instead of 4.

To see one of the reasons expressing a function Direct form 2 is useful note that $Y(z) = (a) + z^{-1}(b) + z^{-2}(c)$) where (a), (b) and (c) are defined below.

$$Y(z) = \underbrace{b_0X(z)}_\text{(a)} + z^{-1}\left( \underbrace{b_1X(z) - a_1Y(z)}_\text{(b)} + z^{-1} \left( \underbrace{b_2X(z) - a_2Y(z)}_\text{(c)}\right) \right)$$

So to compute the value at any time instant we only need two values in memory, (b) from 1 time instant ago and (c) from 2 time instants ago, but in direct form 1 we would have needed 4.

-