# A double sum with complex numbers having stochastic variables

I am very confused by a sum I have been trying to solve analytically/ numerically for a long time. It comes from the idea of a physical problem where the observation is made that has a combined response of a number of entities. For example, I want to evaluate the mathematical sum at a observation point $$\omega$$ that looks like the following when $$M \to \infty$$ .

$$L(\omega) = \sum_{n = 0}^{N-1}\sum_{m = 1}^{M} \exp\left(i \left( (\omega_m - \omega)n + \beta_m \right) \right)$$

Where all $$\omega_m$$s are random draws from a normal distribution

$$\omega_m \sim \mathcal{N}(\mu, \sigma^2)$$

and the $$\beta_m$$ are the normal draws from a uniform distribution

$$\beta_m \sim \mathcal{U}[-\pi, +\pi]$$

Let's try to solve it first with the sum with respect to $$m$$ and then $$n$$. The sum with respect to $$m$$ can be approximated to an infinite integral when $$M \to \infty$$.

$$\mathbb{E}(L(\omega)) \approx M \sum_{n = 0}^{N-1} \int_{-\infty}^{+\infty} \int_{-\pi}^{+\pi} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)\exp(i(x - \omega)n)\frac{1}{2\pi} \exp(i\beta) d\beta dx$$

This integral is $$0$$ because of the integral $$\int_{-\pi}^{+\pi}\exp(i\beta) d\beta$$.

Let's approach this sum first with respect to $$n$$ and then $$m$$. The function has a closed form with respect to the sum with $$n$$.

$$L(\omega) = \sum_{m = 1}^{M} \frac{\sin\left( \frac{N (\omega_m-\omega)}{2} \right)}{\sin\left( \frac{(\omega_m-\omega)}{2} \right)} \exp\left(i \left( (1-N)\frac{\omega_m-\omega}{2} - \beta_m \right) \right)$$

If I take the expectation here with an integral approximation, it also becomes $$0$$. However, I proceeded with finding the expression for the absolute value of $$L(\omega)$$ from the above expression.

$$|L(\omega)|^2 = \sum_{m = 1}^{M} \left| \frac{\sin\left( \frac{N (\omega_m-\omega)}{2} \right)}{\sin\left( \frac{(\omega_m-\omega)}{2} \right)} \right|^2 + \sum_{p = 1}^{P} \sum_{q = 1}^{Q} \frac{\sin\left( \frac{N (\omega_p-\omega)}{2} \right)}{\sin\left( \frac{(\omega_p-\omega)}{2} \right)} \frac{\sin\left( \frac{N (\omega_q-\omega)}{2} \right)}{\sin\left( \frac{(\omega_q-\omega)}{2} \right)} \cos\left( (1 - N) \frac{(\omega_p-\omega_q)}{2} + \beta_q - \beta_p \right)$$. The sum with $$p$$ and $$q$$ are similar to $$m$$. The second term is clearly $$0$$ based on the same type of approximations with expected value when $$M \to \infty$$. So, taking only the first term, the expected value becomes,

$$|L(\omega)|^2 \approx M \int_{-\infty}^{+\infty} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \left| \frac{\sin\left( \frac{N (x-\omega)}{2} \right)}{\sin\left( \frac{(x-\omega)}{2} \right)} \right|^2 dx$$

Can I further reduce this to a closed form or a form that can only depend on $$N$$ numerically?

Let's take a simpler form by choosing $$\mu = 0$$, $$\sigma = 1$$ and find the integral at $$\omega = 0$$.

$$|L(0)|^2 \approx M \int_{-\infty}^{+\infty} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{(x)^2}{2}\right) \left| \frac{\sin\left( \frac{N (x)}{2} \right)}{\sin\left( \frac{(x)}{2} \right)} \right|^2 dx$$

Your final integral can be readily evaluated by expanding the fraction of sines into sums of exponentials $$e^{ikx/2}$$ with integer $$k$$, and integrating term by term with the Gaussian weight, to arrive at $$|L(0)|^2 \equiv\frac{M}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} e^{-x^2/2} \frac{\sin^2\left(Nx/2 \right)}{\sin^2\left( x/2 \right)} \, dx=$$ $$=MN+2M e^{-N^2/2} \sum _{k=1}^{N-1} k e^{\frac{1}{2} \left(2 k N-k^2\right)}.$$

• Thank you! However, when I look for the geometric series sum $\exp(ixk/2)$ from $k=0$ to $k=N-1$, I see that it is $\frac{\cos(1/4 (1 + N) x) \sin((N x)/4)}{ \sin(x/4)} + i \frac{sin((N x)/4) sin(1/4 (1 + N) x)} {sin(x/4)}$ in a trigonometric form. It is a complex expression. Did you mean that it can be written in a different way, or did you mean it is this exact sum? Commented Dec 6, 2022 at 9:55
• Also the final term looks like it is a divergent sum, am I correct? I quickly did a simulation with respect to $N$ and it looks like it diverges quickly. Commented Dec 6, 2022 at 10:10
• the expression on the second line is an exact evaluation of the integral on the first line; it increases linearly in $N$, with a slope of $M\times \sqrt{2\pi}$. Commented Dec 6, 2022 at 11:49
• Thank you so much for the answer again. It gave me a lot of perspective. My simulations agree with this. Commented Dec 7, 2022 at 16:39

I tried the way @Carlo suggested in the answer.

First, I tried expanding the sine ratio term.

$$\left( \frac{\sin(Nx/2)}{\sin(x/2)} \right)^2 = \left( \frac{ \exp(i N x/2) - \exp(-iN x/2) }{ \exp(i x/2) - \exp(-ix/2) } \right)^2$$ $$= \exp({-i(N-1)x}) \left( \frac{ \exp(i N x) - 1 }{ \exp(i x) - 1 } \right)^2$$

If I replace $$t = \exp(ix)$$, then this expression becomes,

$$= t^{-(N-1)} \left( \frac{ t^{N} - 1 }{ t - 1 } \right)^2$$

$$= t^{-(N-1)} [1 + t + t^2 + t^3 + ... + t^{N-1}]^2$$

$$= t^{-(N-1)} [1 + 2t + 3t^2 + 4t^3 + ... + N t^{N-1} + (N-1)t^{N+1} + ... + t^{2N-1}]$$

$$= t^{-(N-1)} [1 + \sum_{p=1}^{N-1} (p+1) t^{p} + (N-p) t^{N+p}]$$ $$= [t^{-(N-1)} + \sum_{p=1}^{N-1} (p+1) t^{p-N+1} + (N-p) t^{p+1} ]$$ $$= [\exp({-ix(N-1)}) + \sum_{p=1}^{N-1} (p+1) \exp({ix(p-N+1)}) + (N-p) \exp({ix(p+1)} )]$$

So the original integral is,

$$I = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} \exp(-x^2/2) \left[\exp({-ix(N-1)}) + \sum_{p=1}^{N-1} (p+1) \exp({ix(p-N+1)}) + (N-p) \exp({ix(p+1)} )\right] dx$$

We know the integral of

$$\frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} \exp(-x^2/2) \exp(iax) dx = \exp{(-a^2/2)}$$

Hence,

$$I = \exp\left({-\frac{(N-1)^2}{2}}\right) + \sum_{p=1}^{N-1} (p+1) \exp\left({-\frac{(p-N+1)^2}{2}}\right) + (N-p) \exp\left({-\frac{(p+1)^2}{2}}\right)$$

So,

$$|L(0)|^2 \approx M \left[ \exp\left({-\frac{(N-1)^2}{2}}\right) + \sum_{p=1}^{N-1} (p+1) \exp\left({-\frac{(p-N+1)^2}{2}}\right) + (N-p) \exp\left({-\frac{(p+1)^2}{2}}\right) \right]$$

Is this what I am supposed to get? Just want to verify it. The solutions don't look exactly the same.

• try to compare with the answer for $N=5$, which is $$|L(0)|^2=M\left[5+\frac{2}{e^8}+\frac{4}{e^{9/2}}+\frac{6}{e^2}+\frac{8}{\sqrt{e}}\right].$$ Your formula does not agree... Commented Dec 7, 2022 at 12:34
• Indeed it is different. Did I do something wrong? Is this the same you suggested when you said it could be expressed in terms of a sum over $\exp(ipx/2)$ ? Commented Dec 7, 2022 at 13:06
• what I would suggest you do is to first try a small value of $N$, like $N=3$; then you should be able to directly check whether each step is correct or not; once you have that under control you can generalise to arbitrary $N$ more reliably. Commented Dec 7, 2022 at 13:08
• Excellent. I did it with $N=3$ and I saw a nice pattern. I arrived at your solution. Thanks! In fact, it can be even written in a divergent series form $|L(0)|^2 = M( N + 2 \sum_{p=1}^{N-1} \frac{p}{e^{(N-p)^2/2}} )$ Commented Dec 7, 2022 at 13:41