# Finding number of alternations in parks mcclellan

I'm given this question and asked to find number of alternations for filter 1 and 2, using parks mcclellan algorithm. I search for solution and find this answer : My question is why the number of filter taps are 9 in the solution, and how exactly to use parks mcclellan to resolve number of alternations for filter 1 and 2 ?

For a type I (even symmetry, odd filter length) linear phase low pass filter, the degree of the corresponding polynomial is $$L=(N-1)/2$$, where $$N$$ is the filter length. Note that the filter order $$M$$ is equal to $$N-1$$.
According to the alternation theorem, a Chebyshev optimal type I low pass filter must have $$L+2$$ or $$L+3$$ alternations. Alternations are points of maximum error, with the only restriction that adjacent alternations must have errors of different signs (that's why we talk about alternations after all). Note that the band edges also count as alternations because at these points the approximation error attains its maximum.
Looking at the figures we see that the first filter has $$3$$ alternations in the passband (one at $$\omega=0$$, one at the maximum, and one at the passband edge), and $$3$$ alternations in the stopband (one at the band edge, one at the minimum, and one at $$\omega=\pi$$), which makes for a total of $$6$$ alternations. In the same way you can see that the second filter has $$7$$ alternations.
If the filter length is $$N=11$$, we get $$L=(N-1)/2=5$$, and the consequently, the optimal filter must have $$L+2=7$$ or $$L+3=8$$ alternations. In this case, only the second filter satisfies the alternation theorem.
On the other hand, for $$N=9$$ we have $$L=4$$, and both filter satisfy the alternation theorem because $$L+2=6$$ and $$L+3=7$$.