# Converting a lowpass filter to a highpass filter. FIR filter-type 1

I was told that in the FIR filter type I, the impulse response of a highpass filter $$h_H[n]$$can be obtained as follows,

$$h_H[n] = \delta[n − m] − h_L[n]$$

where $$h_L[n]$$ is the impulse response of a lowpass filter, $$\delta$$ is a Dirac pulse (Dirac delta function), which delayed by an appropriate value of $$m$$.

I've computed the impulse response according to the formula in MATLAB and observed the frequency response. I noticed that when $$m=\frac{M+1}{2}$$, where $$M$$ is the number of filter taps, the formula is indeed correct. However, I don't understand Why and How it possible.

If you have a real-valued amplitude function $$A_{LP}(\omega)$$ of a low pass filter with unity gain in the passband, then it is easy to see that

$$A_{HP}(\omega)=1-A_{LP}(\omega)\tag{1}$$

is the (real-valued) amplitude function of a high pass filter.

A type I length $$N$$ linear phase low pass filter's frequency response is given by

$$H_{LP}(\omega)=A_{LP}(\omega)e^{-j\omega(N-1)/2}\tag{2}$$

Consequently, according to $$(1)$$, the desired high pass amplitude function is obtained by computing

\begin{align}H_{HP}(\omega)&=\big(1-A_{LP}(\omega)\big) e^{-j\omega(N-1)/2}\\&=e^{-j\omega(N-1)/2}-H_{LP}(\omega)\tag{3}\end{align}

The inverse discrete-time Fourier transform of $$(3)$$ is

$$h_{HP}[n]=\delta\left[n-\frac{N-1}{2}\right]-h_{LP}[n]\tag{4}$$

Note that for type I linear phase filters the filter length $$N$$ is odd, so $$(N-1)/2$$ is an integer shift. Eq. $$(4)$$ shows that apart from sign inversion we only modify the center bin of the low pass filter in order to obtain a type I linear phase high pass filter.