3.6 How to write a window of deltas using unit step function?

Suppose we have

\[ f\left [ n\right ] =\left \{ \begin{array} [c]{ccc}1 & & \left \vert n\right \vert \leq M\\ 0 & & o.w. \end{array} \right . \]

To write the above using unit step \(u\left [ n\right ] \), do

\[ f\left [ n\right ] =u\left [ n+M\right ] -u\left [ n-M+1\right ] \]

The thing to notice for is to add \(1\) for the shifted version on the right side. Else I would not get an even function, and so \(X\left ( \omega \right ) \) will turn out to be complex. For example, if \(M=5\), then write

\(u\left [ n+5\right ] -u\left [ n-6\right ] \) and NOT \(u\left [ n+5\right ] -u\left [ n-5\right ] \)