I have a low pass filter defined as:
$$ H_{lp}(e^{j\omega})=\left\{ \begin{aligned} &1 &|\omega|>\omega_c \\ &0 &\omega_c<|\omega|<\pi \end{aligned} \right. $$
and the corresponding sequence in the discrete-time domain is
$$h[n]=\frac{1}{2\pi} \int^{\omega_c}_{-\omega_c}e^{j\omega n}d\omega=\frac{\sin(\omega_cn)}{\pi n}$$
The discrete time-domain signal $h[n]$ has infinite samples.
If we consider only a finite amount of samples:
$$H_M(e^{j\omega})=\sum^{M}_{n=-M}\frac{\sin(\omega_c n)}{\pi n}e^{-j\omega n}$$
And then the book says
$H_M(e^{j\omega})$ can also be represented as:
$$H_M(e^{j\omega})=\frac{1}{2\pi}\int^{\omega_c}_{-\omega_c} \frac{\sin[(2M+1)\frac{(\omega-\theta)}{2}]}{\sin[\frac{(\omega-\theta)}{2}]} d\theta$$
How was this expression evaluated?
This is an example from Oppenheim Discrete-Time Signal Processing book