Pairwise Puzzler

You may wish to take a look at Pairwise Adding before trying this problem

 

Alison reckons that if Charlie gives her the sums of all the pairs of numbers from any set of five numbers, she'll be able to work out the original five numbers.

Charlie gives her this set of pair sums: $0$, $2$, $4$, $4$, $6$, $8$, $9$, $11$, $13$, $15$.

Can you work out Charlie's original five numbers?

Can you work out a strategy to work out the original five numbers for any set of pair sums that you are given?

Does it help to add together all the pair sums?

Given ten randomly generated numbers, will there always be a set of five numbers whose pair sums are that set of ten? 

Can two different sets of five numbers give the same set of pair sums?

 

Four numbers are added together in pairs to produce the following answers: $5$, $9$, $10$, $12$, $13$, $17$.

What are the four numbers?

Is there more than one possible solution?

 

Six numbers are added together in pairs to produce the following answers: $7$, $10$, $13$, $13$, $15$, $16$, $18$, $19$, $21$, $21$, $24$, $24$, $27$, $30$, $32$.

What are the six numbers?

Can you devise a general strategy to work out a set of six numbers when you are given their pair sums?

 

We'd love you to share how you've tried this and what you've discovered. You can add a comment below, or you can email us - your work may be featured in the showcase.

Comments

The five numbers can be calculated simply by using simultaneous equations.

Let's call the lowest number a, the second lowest b etc.. and we'll place the sums from smallest to largest in series s.
We know straight away that a + b = s1, as the smallest sum must be made up of the smallest pair.
Also the largest sum is clear: d + e = s10
We can also work out that a + c = s2, as this is the second smallest sum; a and c are the smallest two numbers which haven't yet been paired.
Similarly, c + e = s9 (the second largest).

So we now have five unknowns and four equations... we just need one more equation.
If we look at the sum of all the sums in terms of the five original numbers ((a + b) + (a + c)...(e + f)),
this simplifies to 4 (a + b + c + d + e).
So therefore a + b + c + d + e = sum (s) / 4
Here we have the final equation, and we can now calculate the five numbers through simple algebra.

So let's make each letter in turn the subject of an equation.

We can do this easily for c, using substitution: a + b = s1, d + e = s10, and a + b + c + d + e + f = sum (s) / 4;
therefore s1 + s10 + c = sum (s) / 4
So c = sum (s) / 4 - s1 - s10

Now that we have c, all of the other letters can be expressed in terms of c:
a = s2 - c
b = s1 - (s2 - c) = s1 - s2 + c
e = s9 - c
d = s10 - (s9 - c) = s10 - s9 + c

These equations can all be written, by substituting c, in terms of the sums:
a = s1 + s2 + s10 - sum (s) / 4
b = sum (s) / 4 - s2 - s10
c = sum (s) / 4 - s1 - s10
d = sum (s) / 4 - s1 - s9
e = s1 + s9 + s10 - sum (s) / 4

So to find the original five numbers given only the sum of each pair, just arrange the sums from smallest to largest and substitute them into the equations above.

This is an excellent solution, well done! I particularly like the way that you simplified the problem by writing the numbers as \(a \leq b \leq c \leq d \leq e\), and the way that adding all the numbers together allows you to say for certain what the algebraic sum is.

I thought this puzzle was set in a misleading way - at first sight it appears it only involves positive integers, whereas the solution includes a negative integer

(-1,1,3,5,10)

I suppose it does teach you to assume nothing that is not explicitly stated!

The answer to the first question is 0,2,6,7,9!!!!!

Julie, I can choose pairs of numbers from your set of five and add them to get 2, 6, 8, 9, 11, 13 and 15, but I can't get 0, 4 and 4.

Do have another go.

0, 2, 4, 6, 9
or
-1, 1, 3, 5, 10

One of your sets of five numbers can be used to produce this set of pair sums 0, 2, 4, 4, 6, 8, 9, 11, 13, 15, but I'm afraid the other one can't.

Can you figure out which one is which?

Having tackled the 4- and 5-number versions of this problem, I couldn't see an obvious way to generate the 6th equation which would allow direct solution via simultaneous equations. Five equations are simple enough to find, as Mr Redman showed very clearly in his comment, but without the sixth (which I hope someone will enlighten me about at some point), the system would be under-determined. So, without an elegant solution to hand, I tried an inelegant one instead...

About 10 lines of matlab code allowed me to generate random collections of six integers (within a reasonable range to keep things somewhat manageable), generate all 15 of their pairwise combinations and sums, and test the resulting sums against the given sums. About 25 seconds of computer time gave me the following answer (which I have checked by hand just to be sure): 2 5 8 11 13 19

I know that this technique will scale very poorly as the size of problem increases - I certainly wouldn't want to attempt it for pairwise combinations of 10 numbers, for example - and would welcome any suggestions regarding a more subtle approach, but feel that a computational approach does have a place even on this website!

Those six numbers do indeed produce the pair sums 7, 10, 13, 13, 15, 16, 18, 19, 21, 21, 24, 24, 27, 30 and 32. Very well done! Could you explain in more detail the method that you programmed Matlab to use?

As for a more elegant solution, it is indeed difficult to find a 6th equation. In some of the cases where some of the pair sums are equal, you can deduce a 6th equation. For example if $s_3 = s_4$, then you know the value of $a+d$. Would considering the possible positions of the some of the pair sums (such as $a+d$) help you to deduce a more general approach for all cases?

Add new comment

By submitting this form, you accept the Mollom privacy policy.