# Proving $\sum\limits_{k=0}^{n}\cos(kx)=\frac{1}{2}+\frac{\sin(\frac{2n+1}{2}x)}{2\sin(x/2)}$

I am being asked to prove that $$\sum\limits_{k=0}^{n}\cos(kx)=\frac{1}{2}+\frac{\sin(\frac{2n+1}{2}x)}{2\sin(x/2)}$$

I have some progress made, but I am stuck and could use some help.

What I did:

It holds that $$\sum\limits_{k=0}^{n}\cos(kx)=\sum\limits_{k=0}^{n}Re(\cos(kx))=\sum\limits_{k=0}^{n}Re(\cos(x)^{k})=Re(\sum\limits_{k=0}^{n}\cos(x)^{k})=Re\left(\cos(0)\cdot\frac{\cos(x)^{n}-1}{\cos(x)-1}\right)=Re\left(\frac{\cos(x)^{n}-1}{\cos(x)-1}\right)$$

For any $$z_{1},z_{2}\in\mathbb{C}$$ we have it that if $$z_{1}=a+bi,z_{2}=c+di$$ then $$\frac{z_{1}}{z_{2}}=\frac{z_{1}\overline{z2}}{|z_{2}|^{2}}=\frac{(a+bi)(c-di)}{|z_{2}|^{2}}=\frac{ac-bd+i(bc-ad)}{|z_{2}|^{2}}$$ hence $$Re\left(\frac{z_{1}}{z_{2}}\right)=\frac{Re(z_{1})Re(z_{2})-Im(z_{1})Im(z_{2})}{|z_{2}|^{2}}$$

Thus, $$Re\left(\frac{\cos(x)^{n}-1}{\cos(x)-1}\right)=\frac{(\cos(nx)-1)(\cos(x)-1)-\sin(nx)\sin(x)}{(\cos(x)-1)^{2}+\sin^{2}(x)}=\frac{\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{\cos^{2}(x)-2\cos(x)+1+\sin^{2}(x)}=\frac{\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{-2\cos(x)+2}=\frac{\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{-2(\cos(x)-1)}= \frac{=\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{-2(-2\cdot\sin^{2}(x/2))}=\frac{\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{4\sin^{2}(x/2)}=\frac{\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1-\sin(nx)\sin(x)}{4\sin^{2}(x/2)}=\frac{\cos(x(n+1))-\cos(nx)-\cos(x)+1}{4\sin^{2}(x/2)}$$

This is the part where I am stuck, I would appriciate any help or hint on how to continue.

Edit: Given the corrections by André I get:

$$(\cos(nx+x)-1)(\cos(x)-1)+\sin(nx+x)\sin(x)=\cos(nx+x)\cos(x)-\cos(nx)-\cos(x)+1+\sin(nx+x)\sin(x)$$

so $$\cos(nx+x)\cos(x)+\sin(nx+x)\sin(x)=\cos(xn+x-x)-\cos(nx)=0$$

Edit 2: I found anoter mistake in the above, I will try to correct

Edit 3: When multiplying correctly the above it works out :-)

• – Hans Lundmark Oct 31 '12 at 9:07
• Hmm... I'm unsure about this being a duplicate. (a) the formulas are not exactly the same, and (b) a large part of this question is helping the OP with their attempt. – Douglas S. Stones Oct 31 '12 at 10:36
• Replaced \Sigma by \sum. – Did Oct 31 '12 at 11:36

There are faster ways to go, but if you want to continue along the path you have taken, you are quite close to the end. Please see the remark for a couple of small things that need to be corrected in the calculation. Essentially the same trigonometric tricks continue to work.

By a double angle formula for the cosine, we have $$\cos x=1-2\sin^2(x/2),$$ so $$\frac{1-\cos x}{4\sin^2(x/2)}=\frac{1}{2},$$ part of what you are aiming for. However, this could have been obtained in a simpler way in the third displayed formula after the "Thus," in the OP.

And the front part will "simplify" by a difference of $\cos$ formula, obtained from $$\cos(a+b)=\cos a\cos b-\sin a\sin b,\qquad \cos(a-b)=\cos a\cos b+\sin a\sin b.$$ Subtract. We get $$\cos(a+b)-\cos(a-b)=-2\sin a\sin b.$$ Let $a+b=x(n+1)$, and $a-b=nx$. So $a=\dfrac{x(2n+1)}{2}$ and $b=\dfrac{x}{2}$.

Remark: There is a little sign glitch in the calculation of $(a+bi)(c-di)$. Note that the real part should be $ac+bd$. Also, when you are summing the geometric progression, we need $\text{cis}^{n+1}$.

• I am having a little problem with this, I get the answer with a minus sign. can you please help me with telling me where I did wrong ? $\cos(x(n+1))-\cos(nx)=-2\sin(xn+\frac{x}{2})\sin(\frac{x}{2})$ thus $\frac{\cos(x(n+1))-\cos(nx)}{4\sin^{2}(x/2)}=\frac{-2\sin(xn+\frac{x}{2})\sin(\frac{x}{2})}{4\sin^{2}(x/2)}=-\frac{\sin(xn+\frac{x}{2})}{2\sin(\frac{x}{2})}$ – Belgi Oct 31 '12 at 10:09
• Am I doing the last step wrong or do you think I have a previous minus sign error somewhere ? – Belgi Oct 31 '12 at 10:17
• I corrected that error after you last comment, but its still not working right: $(\cos(nx)-1)(\cos(x)-1)+\sin(nx)\sin(x)=\cos(nx)\cos(x)-\cos(nx)-\cos(x)+1+\sin(nx)\sin(x)$ so $\cos(nx)\cos(x)+\sin(nx)\sin(x)=\cos(xn-x)-\cos(nx)=\cos(x(n-1))-\cos(nx)$. If $a+b=xn-x,a-b=xn$ then $a=xn-\frac{x}{2},b=-\frac{x}{2}$ so $-2\sin(a)\sin(b)=-2\sin(x(n-1))\sin(-\frac{x}{2})=+2\sin(x(n-1))\sin(\frac{x}{2})$. So when $\sin(\frac{x}{2})$ cancels out we get $\frac{\sin(x(n-1))}{2\sin(\frac{x}{2})}$ – Belgi Oct 31 '12 at 10:38
• I'll try to correct the second mistake you found, thanks! – Belgi Oct 31 '12 at 10:39
• I still have a problem after your last correction: $(\cos(nx+x)-1)(\cos(x)-1)+\sin(nx+x)\sin(x)=\cos(nx+x)\cos(x)-\cos(nx)-\cos(x)+1+\sin(nx+x)\sin(x)$ so $\cos(nx+x)\cos(x)+\sin(nx+x)\sin(x)=\cos(xn+x-x)-\cos(nx)=0$ – Belgi Oct 31 '12 at 10:44

$$\sum_{0\le r\le n}e^{ikx}=\frac{e^{i(n+1)x}-1}{e^{ix}-1}$$

$$=\frac{e^{\frac{i(n+1)x}2}}{e^{\frac{ix}2}}\frac{\left(e^{\frac{i(n+1)x}2}-e^{-\frac{i(n+1)x}2}\right)}{\left( e^{\frac{ix}2}-e^{-\frac{ix}2}\right)}$$

$$=e^{\frac{inx}2}\frac{2i\sin\frac{(n+1)x}2}{2i\sin{\frac{x}2}}$$ as $e^{iy}-e^{-iy}=2i\sin y,$

$$=(\cos\frac{nx}2+i\sin\frac{nx}2)\frac{\sin\frac{(n+1)x}2}{\sin{\frac{x}2}}$$ using Euler's identity.

Its real part is $$\cos\frac{nx}2 \frac{\sin\frac{(n+1)x}2}{\sin{\frac{x}2}}=\frac{2\cos\frac{nx}2\sin\frac{(n+1)x}2}{2\sin{\frac{x}2}}=\frac{\sin\frac{(2n+1)x}2+\sin{\frac{x}2}}{2\sin{\frac{x}2}}$$ using $2\sin A\cos B=\sin(A+B)+\sin(A-B)$

• Can you please provide some insight on how did you know to factor the denomenator numerator in that way in the second line ? – Belgi Oct 31 '12 at 10:56
• @Belgi, we know $e^{2y}-1=e^y(e^y-e^{-y})$ and my target was to utilize $e^{iy}-e^{-iy}=2i\sin y$. You may have a look into the last approach of math.stackexchange.com/questions/183859/… – lab bhattacharjee Oct 31 '12 at 11:10

Just multiply both sides by $2\sin(x/2)$ and use Briggs' formula: $$2 \sin(x/2)\cos(kx) = \sin((k+1/2)x)-\sin((k-1/2)x)$$ to get a telescoping sum.

• Isn't there a nice way to continue my work ? – Belgi Oct 31 '12 at 9:18
• Why did you take with a sin(x/2)? – Buraian Oct 4 '20 at 10:53

Here is the simplest way I've found. \begin{align} 1+2\sum_{k=1}^ncos(\theta) & = \sum_{k=-n}^n e^{ik\theta} \\ & = \frac{e^{i(n+1/2)\theta}-e^{-i(n-1/2)\theta}}{e^{i\theta /2}-e^{-i\theta / 2}} \\ & =\frac{\sin(n+1/2)\theta}{\sin(\theta/2)} \\ \end{align} which can easily be rearranged to get the desired identity. See https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Lagrange's_trigonometric_identities

$$\require{cancel}$$ Start by being inspired by the product-to-sum identity: $$2 \cos a \sin b = \sin(a+b) - \sin(a-b) ,$$

then naturally let $$a = kx$$, next, in order for the right-hand side terms to be eliminated when multiple equalities are superimposedly added, which eventually making the remaining terms as few as possible, the value of $$((a+b)-(a-b))$$ should be the smallest integer multiple of $$x$$, hence let $$b=\dfrac{x}{2} ,$$ so the equality changes as $$2 \cos kx \sin\dfrac{x}{2} = \sin\left(k+\dfrac{1}{2}\right)x - \sin\left(k-\dfrac{1}{2}\right)x .$$

And then, use a table to visualize the cumulative destructive process of the right-hand side terms: $$\begin{array}{c|cc} +)\ k+\dfrac{1}{2} & \cancel{\dfrac{3}{2}} & \cancel{\dfrac{5}{2}} & \cancel{\dfrac{7}{2}} & \cdots & \cancel{n-\dfrac{1}{2}} & n+\dfrac{1}{2}\\ \hline -)\ k-\dfrac{1}{2} & \dfrac{1}{2} & \cancel{\dfrac{3}{2}} & \cancel{\dfrac{5}{2}} & \cdots & \cancel{n-\dfrac{3}{2}} & \cancel{n-\dfrac{1}{2}} \end{array} \\ ⇓ \\ \sum_{k=1}^n \left[\sin\left(k+\dfrac{1}{2}\right)x - \sin\left(k-\dfrac{1}{2}\right)x\right] = \sin\left(n+\dfrac{1}{2}\right)x - \sin\dfrac{x}{2} .$$

Thus $$\sum_{k=1}^n \cos kx = \left.\left[\sin\left(n+\dfrac{1}{2}\right)x - \sin\dfrac{x}{2}\right] \middle/ \left(2 \sin\dfrac{x}{2}\right)\right. .$$

P.S. Similarly, $$\sum_{k=1}^n \sin kx = \left.\left[\cos\dfrac{x}{2} - \cos\left(n+\dfrac{1}{2}\right)x\right] \middle/ \left(2 \sin\dfrac{x}{2}\right)\right.$$ can be derived from $$2 \sin a \sin b = \cos(a-b) - \cos(a+b)$$ through the same steps.

• table to visualize very useful – onepound Feb 5 '20 at 12:24

\begin{align} \sum_{k=0}^n2\cos k\theta&=\sum_{k=0}^n(e^{i\theta k}+e^{-i\theta k})\\ &=\frac{e^{i\theta(n+1)}-1}{e^{i\theta}-1}+\frac{e^{-i\theta(n+1)}-1}{e^{-i\theta}-1}\\ &=\frac{e^{in\theta}+e^{-in\theta}-e^{i(n+1)\theta}-e^{-i(n+1)\theta}-e^{i\theta}-e^{-i\theta}+2}{2-e^{i\theta}-e^{-i\theta}}\\ &=\frac{2\cos n\theta-2\cos(n+1)\theta+2-2\cos\theta}{2-2\cos\theta}\\ &=\frac{\cos n\theta-\cos(n+1)\theta+1-\cos\theta}{1-\cos\theta}=\frac{\sin(n+\frac 1 2)\theta}{\sin\frac\theta2}+1 \end{align}

We wish the compute the sum $$S=\sum_{k=0}^n \cos(k\theta)$$ We can use the properties of the Chebyshev polynomials of the first kind. Recall that the $$n$$th Chebyshev polynomial $$T_n$$ satisfies the relation $$T_n(\cos\theta)=\cos(n\theta).$$ With this definition your sum can be restated as $$S=\sum_{k=0}^n T_k(\cos\theta)$$ We can let $$\cos(\theta):=x$$ and deduce that $$T_0=1 \text{ and }T_1(x)=x$$ And because of the following identity, $$\cos((n+1)\theta) + \cos((n-1)\theta) = 2\cos (\theta) \cos (n\theta)$$ Which can be proved via sum-difference formulas for cosine, we can again let $$\cos(\theta):=x$$ and shift our index to obtain $$T_{n+2}=2xT_{n+1}-T_n$$ So let's return to the sum $$g_n(x)=\sum_{k=0}^n T_k(x)$$ We can start by summing both sides of the recurrence relation: $$\sum_{k=0}^n T_{k+2}=2x\sum_{k=0}^nT_{k+1}-\sum_{k=0}^nT_k$$ We can mix and match different terms in the sums: $$g_n-T_0-T_1+T_{n+1}+T_{n+2}=2x(g_n-T_0+T_{n+1})-g_n$$ Some algebra, $$2(1-x)g_n=T_0-2xT_0+T_1-T_{n+1}+2xT_{n+1}-T_{n+2}$$ However, using the recurrence, one can notice $$2xT_{n+1}-T_{n+2}=T_n.$$ Furthermore, $$T_0=1$$ and $$T_1=x$$, as stated before. Thus, $$g_n(x)=\frac{1}{2}+\frac{T_n(x)-T_{n+1}(x)}{2(1-x)}$$ Letting $$x=\cos(\theta)$$, $$g_n(\cos\theta)=S=\frac{1}{2}+\frac{\cos(n\theta)-\cos((n+1)\theta)}{2(1-\cos\theta)}$$ It remains to be shown that $$\frac{\cos(n\theta)-\cos((n+1)\theta)}{1-\cos\theta}=\frac{\sin\left(\frac{2n+1}{2}x\right)}{\sin(x/2)}$$ Which I'm actually not sure how to verify, though I have checked it in Desmos and on Wolfram.