Why is it that if $n \in \mathbb{Z}, g_n(x)=e^{in}$, then $\int g_n(x)e^{-imx}dx= 0$ if $n=m$ or $1$ if $n≠m$
Now let $n=m$, then $\int g_n(x)e^{-imx}dx = \int e^{inx}e^{-imx}dx=\int e^0dx= \int dx$
Now let $n≠m$ then $\int g_n(x)e^{-imx}dx = \int e^{inx}e^{-imx}dx=\int e^{ix(n-m)}dx$
But I really can't go farther.
Could someone explain why $\int g_n(x)e^{-imx}dx= 0$ if $n=m$ or $1$ if $n≠m$
hint
$$e^{ipx}=\cos (px)+i\sin (px) $$
$$\int_0^{2\pi}\cos (px)dx=0$$