# Generalised Square of Sum of Modulus of Product of Complex Numbers

A cursory search of the site showed no answer I was looking for. Essentially I have a few questions.

I know already that for $z_1, z_2 \in \mathbb{C}$, with arguments $\theta_1$ and $\theta_2$ respectively, we have $$|z_1 + z_2|^2 = |z_1|^2 + |z_2|^2 + 2|z_1||z_2|\cos(\theta_1 - \theta_2)$$

(for those who are interested, proof wiki has a simple proof here: https://proofwiki.org/wiki/Complex_Modulus_of_Sum_of_Complex_Numbers )

I have 2 questions. I think the first one is solved by me, but would like confirmation. The second question is a bit beyond me at the moment xD

1. How would one generalize this for $z_1,...,z_k \in \mathbb{C},$ where we know the arguments of $z_i$: $$\left| \sum_{i=1}^k z_i \right|^2?$$
2. How would one generalize this for $\alpha_1,...,\alpha_k,z_1,...,z_k \in \mathbb{C},$ where we know the arguments of $z_i$ but not of $\alpha_i$: $$\left| \sum_{i=1}^k \alpha_iz_i \right|^2?$$

My attempt so far:

1. Suppose for $z_1, ..., z_k \in \mathbb{C}$ with arguments $\theta_1, ...,\theta_k$ respectively, we have

$$\left| \sum_{i=1}^k z_i \right|^2 = |z_1 + ... + z_k|^2 \\ =(|z_1|]\cos(\theta_1) + ... + |z_k|\cos(\theta_k))^2 + (|z_1|\sin(\theta_1) + ... + |z_k|\sin(\theta_k))^2 \\ = |z_1|^2 \cos^2\theta_1 + |z_1||z_2|\cos\theta_1\cos\theta_2 + ... |z_1|z_k|\cos\theta_1\cos\theta_k + \\ |z_2|^2 \cos^2\theta_2 + |z_1||z_2|\cos\theta_1\cos\theta_2 + ... |z_2|z_k|\cos\theta_2\cos\theta_k + \\ ... + \\ |z_k|^2\cos^2\theta_k + |z_1||z_k|\cos\theta_1\cos\theta_k + ... + |z_{k-1}||z_k|\cos\theta_{k-1}\cos\theta_k + \\ |z_1|^2 \sin^2\theta_1 + |z_1||z_2|\sin\theta_1\sin\theta_2 + ... |z_1|z_k|\sin\theta_1\sin\theta_k + \\ |z_2|^2 \sin^2\theta_2 + |z_1||z_2|\sin\theta_1\sin\theta_2 + ... |z_2|z_k|\sin\theta_2\sin\theta_k + \\ ... + \\ |z_k|^2\sin^2\theta_k + |z_1||z_k|\sin\theta_1\sin\theta_k + ... + |z_{k-1}||z_k|\sin\theta_{k-1}\sin\theta_k \\ = |z_1|^2(\cos^2\theta_1 + \sin^2\theta_1) + |z_2|^2(\cos^2\theta_2 + \sin^2\theta_2) + ... + |z_k|^2(\cos^2\theta_k + \sin^2\theta_k) + \\ 2|z_1||z_2|(\cos\theta_1\cos\theta_2 + \sin\theta_1\sin\theta_2) +2|z_1||z_3|(\cos\theta_1\cos\theta_3 + \sin\theta_1\sin\theta_3) + \\ ... + \\ 2|z_{k-1}||z_k|(\cos\theta_{k-1}\cos\theta_k + \sin\theta_{k-1}\sin\theta_k)$$

Now use the fact that $\cos^2\theta + sin^2\theta = 1$ and the fact that $\cos\theta_1\cos\theta_2 + \sin\theta_1\sin\theta_2 = \cos(\theta_1 - \theta_2)$:

$$\left| \sum_{i=1}^k z_i \right|^2 = \sum_{i=1}^k |z_i|^2 + \sum_{i \neq j}|z_i||z_j|\cos(\theta_i - \theta_j)$$

For 2. I have no idea where to start. I am asking because I am working through this paper on Quantum Clustering and Gaussian Mixtures https://arxiv.org/abs/1612.09199 and they give a simple answer: $$\left| \sum_{i=1}^k \alpha_iz_i \right|^2 = \sum_{i=1}^k \alpha_i|z_i| \sum_{j=1}^k \bar{\alpha_j}|z_j|\cos(\theta_i - \theta_j)$$ is this true? How would I show it?

For those who are interested, in the paper $|z_k|$ is the unnormalized Gaussian Distribution with parameters $(\mu_k, \mathbf{C}_k)$ given for some $d$-dimensional point $p$ by $$|z_k| = \frac{1}{\sqrt{Z_k}}e^{-\frac{1}{4}(p - \mu_k)^T \mathbf{C}^{-1}_k(p-\mu_k)} \\ Z_k = (2\pi)^{\frac{d}{2}}|\mathbf{C}_k|^{\frac{1}{2}}$$ whereas $z_k$, the complex number, is given by $$z_k = \frac{1}{\sqrt{Z_i}}e^{-\frac{1}{4}(p - \mu_k)^T \mathbf{C}^{-1}_k(p-\mu_k)}e^{-i\phi_k}$$ When I programmed this up I encountered some errors (i am getting negative probabilities), and now I'm trying to determine if its because of my code or if there's an error in the paper. I think it might because the exponent with the phase is $-i\phi_k$ instead of $i\phi_k$. I'm checking out this hunch but it would be super helpful to know that the above summation of square modulus is correct.

Edit history:

1. Removed coefficient of 2 from last term.
2. Using saulspatz idea: $$\left|\sum_{i=1}^k \alpha_iz_i \right|^2 = \sum_{i=1}^k \alpha_i z_i \sum_{j=1}^k \overline{\alpha_j z_j} \\ = \sum_{i=1}^k \alpha_i |z_i|(\cos\theta_i + i\sin\theta_i) \sum_{j=1}^k \overline{\alpha_j} |z_j|(\cos\theta_j - i\sin\theta_j) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j|(\cos\theta_i + i\sin\theta_i)(\cos\theta_j - i\sin\theta_j) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j| (\cos\theta_i\cos\theta_j -i\cos\theta_i\sin\theta_j + i\cos\theta_j\sin\theta_i +\sin\theta_i\sin\theta_j) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j| (\cos\theta_i\cos\theta_j + \sin\theta_i\sin\theta_j + i\cos\theta_j\sin\theta_i - i\cos\theta_i\sin\theta_j) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j| (\cos(\theta_i - \theta_j) + i\sin(\theta_i - \theta_j)) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j|\cos(\theta_i - \theta_j) + \overline{\alpha_j} |z_j|i\sin(\theta_i - \theta_j) \\ = \sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j|\cos(\theta_i - \theta_j) + i\sum_{i=1}^k \alpha_i |z_i| \sum_{j=1}^k \overline{\alpha_j} |z_j|\sin(\theta_i - \theta_j)$$ Presumably this imaginary part equals 0, but I'm really at a loss as to how to show that >.<

In any case, now I see that the real part must be as was shown in the paper, meaning I have a bug in my code... whoops.

• It's the square of a modulus, so undoubtedly the imaginary parts should somehow cancel away... but it's hard to see how. – Marko Apr 4 '18 at 6:54

Start with $$\left|\sum_{i=1}^k{a_iz_i}\right|^2=\sum_{i=1}^k{a_i}{z_i}\sum_{j=1}^k\overline{{a_j}{z_j}}$$

Note that the coefficient of $2$ is incorrect in the formula you give. When you sum over $i\ne j$ you sum over $(2,3)$ and $(3,2)$ separately.

EDIT You're making things too hard. I'm going to change the index of summation from $i$ to $m$ to avoid confusion with the imaginary unit.

$$\left|\sum_{m=1}^k{a_mz_m}\right|^2= \sum_{m=1}^k{a_mz_m}\sum_{j=1}^k\overline{{a_jz_j}}= \sum_{m=1}^k{a_mz_m}\sum_{j=1}^k\overline{{a_jz_j}}=\\ \sum_{m=1}^k{a_m|z_m|e^{i\theta_m}}\sum_{j=1}^k{\overline{a_j}|z_j|e^{-i\theta_j}}= \sum_{m=1}^k{a_m|z_m|}\sum_{j=1}^k{\overline{a_j}|z_j|e^{i(\theta_m-\theta_j)}}=\\ \sum_{m=1}^k{a_m|z_m|}\sum_{j=1}^k{\overline{a_j}|z_j|\cos(\theta_m-\theta_j)}+i\sum_{m=1}^k{a_m|z_m|}\sum_{j=1}^k{\overline{a_j}|z_j|\sin(\theta_m-\theta_j)}=\\ \sum_{m=1}^k{a_m|z_m|}\sum_{j=1}^k{\overline{a_j}|z_j|\cos(\theta_m-\theta_j)}$$ because $$\left|\sum_{m=1}^k{a_mz_m}\right|^2\text{ is real.}$$

So yes, the imaginary part is $0$, but it's usually easier to use $e^{i\theta}$ than $\cos\theta+i\sin\theta.$

• Right that was a silly mistake from me, thanks. I'm busy looking at what you just wrote and seeing how much progress I can make on it. – Marko Apr 4 '18 at 4:11
• @Marko The only part of math I was ever really good at was silly mistakes. – saulspatz Apr 4 '18 at 4:16
• Hmmm either I'm stuck or the paper does indeed have a mistake... – Marko Apr 4 '18 at 6:36
• @Marko I just looked at the obvious way to start. I'll check it out. – saulspatz Apr 4 '18 at 13:16
• @Marko I think I've got it right now. Thanks for the heads up. – saulspatz Apr 6 '18 at 15:43