# Magnitude and phase of $-\delta[n]$?

I was reading this document and it shows the computation of the magnitude and phase of $h[n]=-\delta[n]$.

We can get the DTFT as: $$H(e^{j\omega})= -1$$

So the magnitude will be $1$, and according to my understanding, the phase is calculated as $$\tan^{-1}\left(\frac{\Im\{H\}}{\Re\{H\}}\right) = \tan^{-1}\left(\frac{-0}{1}\right)=0$$

But in the document, the phase is $\pi$. Where is my mistake here?

If the magnitude is $1$ and the phase were $0$, you would get

$$H(e^{j\omega})=1$$

which corresponds to $h[n]=\delta[n]$. So this is obviously wrong.

The fact that the phase of a negative real-valued number equals $\pm \pi$ can be easily seen by drawing the number as a vector in the complex plane and measuring its angle with the positive real axis. Analytically, the phase angle of a complex number must be computed using the atan2 function. The formula with the $\arctan$ function that you used only gives the correct result if the real part of the complex number is positive. Note that by dividing the imaginary part by the real part, sign information is lost: if the result is negative you don't know if the real part or the imaginary part was negative, and if the result is positive, real and imaginary part must have the same sign, but we don't know which. This is why the $\arctan$ function of the ratio of the imaginary part and the real part is generally not sufficient for determining the argument (apart from the fact that you can't compute the ratio if the real part is zero).

In sum, a negative real-valued number $a<0$ can be written as

$$a=|a|e^{\pm j\pi}$$

Also take a look at this related question.

Let $|H(e^{j\omega})|=r$ and $\angle H(e^{j\omega})=\phi$. Then $$H(e^{j\omega})=re^{j\phi}=r\cos \phi+j r\sin \phi$$ Substituding $r=1$ and $H(e^{j\omega})=-1$ we have $$-1=-1+j0=\cos \phi+j \sin \phi$$ which yields $$\begin{cases} \sin \phi=0\\ \cos \phi=-1 \end{cases}$$

You can see that the only answers to the above system of equations in the range $[0, 2\pi]$ is $\phi=\pi$ and $\phi=0$ cannot be an answer since $\cos(0)\neq-1$.