# Can two distinct sets of N numbers between -1 and 1 have the same sum and sum of squares?

Is is possible to find two different sets of numbers $$\{ a_1, a_2, \dots, a_N\}$$ and $$\{ b_1, b_2, \dots, b_N\}$$ with $$a_i,b_i\in[-1,1]$$ such that $$\sum a_i = \sum b_i$$ and $$\sum a_i^2 = \sum b_i^2$$ are both true at the same time?

EDIT: Also, no number in each set may be $$0$$, i.e. $$a_i,b_i \neq 0$$. John Omielan has posted an example for $$N=3$$, before I edited the question.

For $$N=1$$, it is obvious that this is impossible, because $$a_1 = b_1$$ (sum over elements in the set) and $$a_1 \neq b_1$$ (the sets must be different) cannot be true at the same time. Is there a minimum number of $$N$$ for which it is possible to find such sets, or is it never possible?

• Try to find an example for $N=2$. The same example can be used for any $N>2$ by adding zeros. Jan 21, 2021 at 10:03
• Thank you for your suggestion, but I am unable to find an example for $N=2$. Do you have an example in mind? Jan 21, 2021 at 10:17

As you stated, it's not possible for $$N = 1$$. It's also not possible for $$N = 2$$, where I assume the order doesn't count. To see this, assume there is a solution to get

$$a_1 + a_2 = b_1 + b_2 = c \tag{1}\label{eq1A}$$

$$a_1^2 + a_2^2 = b_1^2 + b_2^2 = d \tag{2}\label{eq2A}$$

Squaring the first $$2$$ sides of \eqref{eq1A} and subtracting \eqref{eq2A} gives

$$2a_1 a_2 = 2b_1 b_2 \implies a_1 a_2 = b_1 b_2 = e \tag{3}\label{eq3A}$$

Using Vieta's formulas, or just simply expanding a quadratic, i.e., $$(x - r_1)(x - r_2) = x^2 - (r_1 + r_2)x + r_1 r_2$$, we have that $$a_1$$ and $$a_2$$, as well as $$b_1$$ and $$b_2$$, are the roots of

$$x^2 - cx + e = 0 \tag{4}\label{eq4A}$$

Since \eqref{eq4A} has only $$2$$ roots (e.g., by seeing it's a parabola or, more formally, using the Fundamental theorem of algebra), this means $$a_1$$ and $$a_2$$ must be the same, up to order, as $$b_1$$ and $$b_2$$.

However, for $$N = 3$$, we have

$$\frac{1}{2} - \frac{1}{2} + 0 = \frac{1}{\sqrt{3}} - \frac{1}{2\sqrt{3}} - \frac{1}{2\sqrt{3}} = 0 \tag{5}\label{eq5A}$$

$$\left(\frac{1}{2}\right)^2 + \left(\frac{1}{2}\right)^2 + 0 = \left(\frac{1}{\sqrt{3}}\right)^2 + \left(\frac{1}{2\sqrt{3}}\right)^2 + \left(\frac{1}{2\sqrt{3}}\right)^2 = \frac{1}{2} \tag{6}\label{eq6A}$$

For any $$N \gt 3$$, as stated in Kavi Rama Murthy's question comment, examples can be constructed by just adding zeros.

Update: Since the question now states $$0$$ are not allowed as values, then as dm63's comment suggests, we can just simply use values which sum to $$0$$ and with $$b_i = -a_i$$. For example, with $$N = 3$$, we could use

$$\frac{1}{2} - \frac{1}{3} - \frac{1}{6} = -\frac{1}{2} + \frac{1}{3} + \frac{1}{6} = 0 \tag{7}\label{eq7A}$$

$$\left(\frac{1}{2}\right)^2 + \left(-\frac{1}{3}\right)^2 + \left(-\frac{1}{6}\right)^2 = \left(-\frac{1}{2}\right)^2 + \left(\frac{1}{3}\right)^2 + \left(\frac{1}{6}\right)^2 = \frac{7}{18} \tag{8}\label{eq8A}$$

To not have the values adding to $$0$$, have the $$a_i$$ add up to a value relatively close to $$0$$, with $$b_1$$ being equal to this (e.g., have $$|b_1| \lt |a_i|$$ for $$1 \le i \le 3$$). Also, have $$b_2 \gt 0$$ and $$b_3 = -b_2$$. Then, using that the sums of squares are equal, solving for $$b_2$$ gives

$$b_2 = \sqrt{\frac{a_1^2 + a_2^2 + a_3^2 - b_1^2}{2}} \tag{9}\label{eq9A}$$

For example, we have

$$-\frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{1}{12} + \frac{\sqrt{69}}{12\sqrt{2}} - \frac{\sqrt{69}}{12\sqrt{2}} = \frac{1}{12} \tag{10}\label{eq10A}$$

$$\left(-\frac{1}{2}\right)^2 + \left(\frac{1}{3}\right)^2 + \left(\frac{1}{4}\right)^2 = \left(\frac{1}{12}\right)^2 + \left(\frac{\sqrt{69}}{12\sqrt{2}}\right)^2 + \left(-\frac{\sqrt{69}}{12\sqrt{2}}\right)^2 = \frac{35}{72} \tag{11}\label{eq11A}$$

You can easily extend this to $$N \gt 3$$. Also, you can also ensure that all $$|a_i|$$ and $$|b_i|$$ are unique, but the algebra becomes more complicated and messy.

• Thank you very much! Your answer made me realize that there should be an additional requirement for the elements in each set, which I unfortunately did not realize when I first posted the question. No element in either set may be 0, I will update my original question. Jan 21, 2021 at 10:44
• Yes, I am certain that this was the only condition I had forgotten. Sorry! An exception for $N=3$ without $0$ would be extremely helpful! Jan 21, 2021 at 10:50
• How about selecting any set of $a_i$ such that the average (and sum) of $a_i$ is zero and then pick $b_i = -a_i$ ?
– dm63
Jan 21, 2021 at 10:52
• @dm63 Thanks for the feedback. I was working on a more interesting example, but decided to use your suggestion instead. Jan 21, 2021 at 11:02
• @sunoukami FYI, I've added more details to my answer, such as how to have the sums of the $a_i$ and $b_i$ not be $0$, along with an example. Jan 21, 2021 at 22:00

The equality condition on the sums and sums of squares is affine invariant, so you can look for solutions in integers and then move them to the required range, which can be any interval.

$$(1,4,6,7) \text{ and } (2,3,5,8)$$ do the job for $$n=4$$. Dividing each by $$10$$ puts them all in $$(0,1)$$.

For lots more along these lines see The Prouhet-Tarry-Escott problem and generalized Thue-Morse sequences at https://www.intlpress.com/site/pub/files/_fulltext/journals/joc/2016/0007/0001/JOC-2016-0007-0001-a005.pdf

There you will see that for $$n=8$$ you can make the sums of cubes match too.

Using the fact that $$9^2+2^2=6^2+7^2$$ it is easy to see that for $$N=4$$ the two sets

$$\{a_i\} = \{-0.9, -0.2, 0.2, 0.9\} \\ \{b_i\} = \{-0.7, -0.6, 0.6, 0.7\} \\$$

satisfy all the requirements.