The maximum absolute value of DFT of window vector

Let x=[1, ⋯ ,1, 0, ⋯ ,0] be a window vector of length N, which consists of B consecutive 1s and the remaining N-B consecutive 0s.

I took the N-point DFT on x and got X=[X_0, X_1, ⋯, X_(N-1)] which is the result of the DFT.

I tried to show that the maximum absolute value of X_k, where k=1, ⋯, N-1, is always when k=1, for any B=1, ⋯,N.

(when k=0, it is trivial that X_0=B)

My approach was as follows:

Click and see the "The maximum absolute value of DFT of window vector" post: http://taekyo11.tistory.com/

Could anybody please help me figure out |X_k| is at peak when k=1?

I am strongly convinced that it is true through computer simulations and my intuition with the shape of cosecant function also suggests the same result, but I could not be successful mathematically.

May some kind person help me!

Thank you very much.

Think of the coefficients $\mathrm e^{2\pi\mathrm ik/N}$ as vectors in the complex plane, like the spokes of a wheel. It's geometrically clear that for any number $m$, the greatest magnitude of any sum of $m$ of these vectors is achieved if you add $m$ consecutive vectors. This is exactly what the transform with $k=1$ does. The only thing to check is whether it's possible to do better by having several copies of the same vector in the sum. But if the sum for some $k$ contains the same vector twice, the vectors in between (including one of the copies) add up to zero, so the sum is equal to a sum of a smaller number of unique vectors. For $B\le N/2$, the sum of a smaller number of consecutive vectors has a smaller magnitude, and we can reduce the case $B\gt N/2$ to the other one by substracting $1$, multiplying by $-1$ and shifting by $N-B$, none of which changes the magnitudes of the DFT coefficients.