Put . Since , the finite geometric series gives
where the second equality multiplies numerator and denominator by . Taking imaginary parts gives the finite trigonometric sum
Taking real parts of the same finite geometric series gives
The denominator is nonzero by the restriction on . Equivalently, these finite trigonometric sums are and , respectively.