# Summing cosines

1. Mar 14, 2014

### nikki92

1. The problem statement, all variables and given/known data

x=cos(2n*pi/n)

E[x]=0;
3. The attempt at a solution

Last edited: Mar 15, 2014
2. Mar 14, 2014

### Simon Bridge

In general: $$E[x]=\sum_{n=0}^N p(x_n)x_n$$

You have: $$x\in \{ x_n:x_n=2\cos \frac{2\pi n}{N}\}$$
I'm guessing from your working that $p(x_n)=1/N$ - i.e. each value is equally likely?
... is that correct? (It helps to write the problem statement out in full.)

You can check your answers by sketching the distribution of x out and looking at the symmetry. The expetation should be sort-of a middle-ish value.

i.e. Looking at the first expectation:$$E[x]=\frac{2}{N}\sum_{n=0}^N \cos \frac{2\pi n}{N}$$ ... the cosine function of n has equal weighting to values on either side of zero - for every value of x that is, say x=a:a>0, there is another value that is x=-a:a>0, so the sum comes to zero.

* You may want to check that this is the case: i.e. what if N is an odd number? What if it is not a multiple of 4?
However, you may be doing this in the limit that N is large.

Thus: $(E[x])^2=0$ also.

$$E[x^2]=\frac{4}{N}\sum_{n=0}^N \cos^2 \frac{2\pi n}{N}$$ ... your answer says that $E[x^2]=2$ ... is that correct?

You can check this out the same way ... $A\cos^2(\theta)$ is evenly distributed about a particular number.
What is that number? Compare with the expression for $x_n$.

3. Mar 14, 2014

### nikki92

There is really no details on the problem as it was not really homework.But I assumed n=1 to N and each were equally likely.

I do not understand your approach.

Last edited: Mar 14, 2014
4. Mar 14, 2014

### Simon Bridge

You have asked if what you have done is correct. This suggests to me that you don't know how to check or that you do not understand the subject.

I am suggesting you sketch a graph of how x and x^2 varies with n and use the symmetry of that graph, along with your understanding of what "expectation value" means, to check to see if your answers are plausible. If the symmetry is easy (it is) then it is easy to tell if you are right or not.

i.e. you have got E[x]=0 - so sketch x vs n and see if x=0 is a plausible average value.

But if you don't understand "expectation value" then that won't make much sense to you: this is part of what I'm trying to find out.

i.e. There is a complication in the formula if N is a small number.

say if $N=2$
then $x_1=2\cos(\pi)=0, x_2=2\cos(2\pi)=2\implies E[x]=(x_1+x_2)/2=(0+2)/2=1$ ...

It can also make a difference where you start your sum from.
If you start from $n=1$, then the expectation works out as above, but if you start from $n=0$:

$E[x]=(x_0+x_1+x_2)/3 = (2+0+2)/3=4/3$

... notice: in both cases: $(E[x])^2\neq 0$

So: is N a small number or a large number? (see the definition of the expectation value)
Details matter - what is the original problem statement?

5. Mar 14, 2014

### nikki92

Thanks I understand it much better now.