I want to sum up the partials of a harmonic series, how do I do it?
If I was using the 'Lagrange trigonometric identity to solve this problem', how would I plot it on Wolfram mathematica (using which input)?
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityI want to sum up the partials of a harmonic series, how do I do it?
If I was using the 'Lagrange trigonometric identity to solve this problem', how would I plot it on Wolfram mathematica (using which input)?
Using De Moivre's formula, you find that
$$\sin(na)=\mathrm{Im}\left(\left(e^{ia}\right)^n\right)$$
for every real number $a$.
Then, using the linearity of the imaginary part, your sum is clearly equal to the imaginary part of another much simpler sum :
$$\sin(a)+\ldots+\sin((n-1)a)=\mathrm{Im}\left(e^{ia}\right)+\ldots+\mathrm{Im}\left(\left(e^{ia}\right)^{n-1}\right)=\mathrm{Im}\left(e^{ia}+\ldots+\left(e^{ia}\right)^{n-1}\right)$$
If $a$ is an integer multiple of $2\pi$, then your sum is clearly equal to $0$.
If $a$ is not an integer multiple of $2\pi$, then $r=e^{ia}\neq 1$, and the terms of the sum $e^{ia}+\ldots+\left(e^{ia}\right)^{n-1}$ are just the terms of the geometric sequence
$$r,r^2,\ldots,r^{n-1}$$
Now, you should remember that if $(u_n)_{n\geqslant 0}$ is a geometric sequence with ratio $r\neq 1$, then the sum of the $N$ first terms of this sequence is :
$$u_0\frac{r^N-1}{r-1}$$
In our case, we have $u_0=r$ and $N=n-1$, so :
$$e^{ia}+\ldots+\left(e^{ia}\right)^{n-1}=e^{ia}\frac{e^{i(n-1)a}-1}{e^{ia}-1}$$
Now, we'll use this useful formula :
$$\forall \alpha\in\mathbb R,\ e^{i\alpha}-1=2ie^{i\frac\alpha 2}\sin\left(\frac\alpha 2\right)$$
(To prove it, just use the fact that $\sin(\theta)=\dfrac{e^{i\theta}-e^{-i\theta}}{2i}$ for all real number $\theta$ and develop the RHS).
Using this formula on both the numerator and denominator of our latest identity, we get :
$$e^{ia}+\ldots+\left(e^{ia}\right)^{n-1}=e^{ia}\frac{2ie^{i\frac{N-1}2a}\sin\left(\frac{N-1}2a\right)}{2ie^{i\frac a2}\sin\left(\frac a2\right)}=e^{i\frac N2a}\frac{\sin\left(\frac{N-1}2a\right)}{\sin\left(\frac a2\right)}$$
The imaginary part of the RHS is just the sum you wanted :
$$\sin(a)+\ldots+\sin((n-1)a)=\sin\left(\frac N2a\right)\frac{\sin\left(\frac{N-1}2a\right)}{\sin\left(\frac a2\right)}\quad (a\notin 2\pi\mathbb Z)$$
They are called Lagrange's trigonometric identities
$$\sum_{n=1}^N \sin (na)= \frac{1}{2}\cot\frac{a}{2}-\frac{\cos(N+\frac{1}{2})a}{2\sin\frac{a}{2}}$$
$$\sum_{n=1}^N \cos(na)= -\frac{1}{2}+\frac{\sin(N+\frac{1}{2})a}{2\sin\frac{a}{2}}$$
Source: http://en.wikipedia.org/wiki/List_of_trigonometric_identities
Hint: Multiple by $\sin\frac{a}{2}$ and use the equality $\sin x\sin y=\frac{1}{2}(\cos(x-y)-\cos(x+y))$:
$$ \sin\frac{a}{2}(\sin a+\sin 2a+\ldots)= \frac{1}{2}(\cos\frac{a}{2}-\cos\frac{3a}{2}+\cos\frac{3a}{2}-\cos\frac{5a}{2}+\ldots) $$ etc.
$\sin a + \sin2a+\cdots+\sin((n-1)a)$ is the imaginary part of $e^{ia}+e^{2ia}+e^{3ia}+\cdots+e^{(n-1)ia}$. That is a finite geometric series whose sum is expressible in closed form. It will be $\dfrac{\text{something}}{1-e^{ia}}$. Multiplying the top and bottom both by $e^{-ia/2}$ will make it
$$ \frac{\text{something}}{e^{-ia/2}-e^{ia/2}} = 2i\cdot \frac{\text{something}}{\sin(a/2)}. $$
Once it's in that form you only have to look at the numerator to find the imaginary part.
Use the formula $$2\sin(x)\sin(y)= \cos(x-y)-\cos(x+y)$$
Then
$$2\sin(\frac{a}{2})\sin(a)=\cos(\frac{a}{2})-\cos(\frac{3a}{2}) \\ 2\sin(\frac{a}{2})\sin(2a)=\cos(\frac{3a}{2})-\cos(\frac{5a}{2}) \\ 2\sin(\frac{a}{2})\sin(3a)=\cos(\frac{5a}{2})-\cos(\frac{7a}{2}) \\ ....\\ 2\sin(\frac{a}{2})\sin(na)=\cos(\frac{(2n-1)a}{2})-\cos(\frac{(2n+1)a}{2}) \\$$
Add them together.