# Square of the sum of n positive numbers

I have a following problem

When we want to write $a^2 + b^2$ in terms of $(a \pm b)^2$ we can do it like that $$a^2 +b^2 = \frac{(a+b)^2}{2} + \frac{(a-b)^2}{2}.$$

Can we do anything similar for $a_1^2 + a_2^2 + \ldots + a_n^2$ ? I can add the assumption that all $a_i$ are positive numbers. I mean to express this as combination of their sums and differences. I know that this question is a little bit naive but I'm curious whether it has an easy answer.

-
Is sunflower's answer enough? – Amr Dec 11 '12 at 15:04

Yes. You have to sum over all of the possibilities of $a\pm b\pm c$: $$4(a^2+b^2+c^2)=(a+b+c)^2+(a+b-c)^2+(a-b+c)^2+(a-b-c)^2$$

This can be extended to n factors by:

$$\sum_{k=1}^n a_k^2=\sum_{\alpha=(1,-1,...,-1)\; |a_i|=1}^{(1,...,1)}\frac{\big(\sum_{i=1}^{n}\alpha_ia_i\big)^2}{2^{n-1}}$$

($\alpha$ is a multiindex with values that are either -1 or 1, except the first that is always 1)

-

Another way would be:

$$\frac{\sum_{x\in \{-1,1\}^n}(x_1a_1+x_2a_2+....+x_na_n)^2}{2^n}$$

Where $x_i$ is the ith component of the vector $x$

-
I think this is correct but I still need to check. Unfortunately I have to leave now. I will check it later – Amr Dec 11 '12 at 15:09
nice way to write it too ^.^ I wrote an answer using multiindices... this is probably nicer. But should it not be $2^{n-1}$? – CBenni Dec 11 '12 at 15:12
No. It should be $2^n$ – Amr Dec 11 '12 at 15:19
Try the case when $n=2$ or 1 – Amr Dec 11 '12 at 15:20
nah, sorry. I was looking at the solutions for n=2 or 3 where the first index is 1. (These work just fine too). For those, we have only half the terms and thus, only $2^{n-1}$ but you are correct. – CBenni Dec 11 '12 at 15:26
The text passage contains a mathematical question about expressing the sum of squares of n positive numbers in terms of their sums and differences, and multiple answers are provided.
multiple_questions_with_answers
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
# Square of the sum of n positive numbers

I have a following problem

When we want to write $a^2 + b^2$ in terms of $(a \pm b)^2$ we can do it like that $$a^2 +b^2 = \frac{(a+b)^2}{2} + \frac{(a-b)^2}{2}.$$

Can we do anything similar for $a_1^2 + a_2^2 + \ldots + a_n^2$ ? I can add the assumption that all $a_i$ are positive numbers. I mean to express this as combination of their sums and differences. I know that this question is a little bit naive but I'm curious whether it has an easy answer.

-
Is sunflower's answer enough? – Amr Dec 11 '12 at 15:04

Yes. You have to sum over all of the possibilities of $a\pm b\pm c$: $$4(a^2+b^2+c^2)=(a+b+c)^2+(a+b-c)^2+(a-b+c)^2+(a-b-c)^2$$

This can be extended to n factors by:

$$\sum_{k=1}^n a_k^2=\sum_{\alpha=(1,-1,...,-1)\; |a_i|=1}^{(1,...,1)}\frac{\big(\sum_{i=1}^{n}\alpha_ia_i\big)^2}{2^{n-1}}$$

($\alpha$ is a multiindex with values that are either -1 or 1, except the first that is always 1)

-

Another way would be:

$$\frac{\sum_{x\in \{-1,1\}^n}(x_1a_1+x_2a_2+....+x_na_n)^2}{2^n}$$

Where $x_i$ is the ith component of the vector $x$

-
I think this is correct but I still need to check. Unfortunately I have to leave now. I will check it later – Amr Dec 11 '12 at 15:09
nice way to write it too ^.^ I wrote an answer using multiindices... this is probably nicer. But should it not be $2^{n-1}$? – CBenni Dec 11 '12 at 15:12
No. It should be $2^n$ – Amr Dec 11 '12 at 15:19
Try the case when $n=2$ or 1 – Amr Dec 11 '12 at 15:20
nah, sorry. I was looking at the solutions for n=2 or 3 where the first index is 1. (These work just fine too). For those, we have only half the terms and thus, only $2^{n-1}$ but you are correct. – CBenni Dec 11 '12 at 15:26
user
The text passage contains a mathematical question about expressing the sum of squares of n positive numbers in terms of their sums and differences, and multiple answers are provided.

TYPE: MULTIPLE_QUESTIONS_WITH_ANSWERS