Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you have N numbers, A1 .. An, you calculate all sums of 2, e.g A1 + A2, A1 + A3 etc., and name them S12, S13 etc., so you end up with n * (n - 1) / 2 sums,

My question is, given all these sub sums, how can I recover those N numbers,

If I have only 3 numbers, that's easy,

A1 = (S12 + S13 + S23) / 2 - S23
A3 = (S12 + S13 + S23) / 2 - S12
A2 = (S12 + S13 + S23) / 2 - S13

But when it comes more than 3 numbers, is there a more general formula that would work ? It looks like solving some complexed equation with linear algebra, but I'm not sure

share|cite|improve this question

Compute $A_1$ using your method : $A_1 = \frac{S_{12} + S_{13} - S_{23}}2$

After that use : $\ A_{n+1}=S_{n,n+1}-A_n$

share|cite|improve this answer

Edit: Original version of this answer contained several mistakes. Hopefully I've cleared those out.

First you can compute the sum of all $n$ of the $a_i$; let's call this sum $S$. If you add up all the $s_{ij}$, you'll have added up each number $n-1$ times, so the result will be $(n-1)S$, and you can divide to find $S$.

Now if you want a particular $a_k$ -- well, what distinguishes it from the others? The $s_{kj}$ it appears in. So we'll add up all the $s_{kj}$; we add up all of them so we're not distinguishing any particular $a_i$ other than $a_k$. But if the others appear in an even mixture, this means we can use our computation of $S$ (which tells us what happens when each element appears in an even mixture). In this new sum we've just computed, each $a_i$ for $i\ne k$ will appear only once in the sum, but $a_k$ will appear $n-1$ times. Thus this sum is $S+(n-2)a_k$. Since you know $S$, you can solve for $a_k$.

If we put this all together, we find that $$a_k=\frac{\sum_j s_{kj}-\frac{\sum_{i<j} s_{ij}}{n-1}}{n-2}=\frac{1}{n-1}\sum_j s_{kj}-\frac{1}{(n-2)(n-1)}\sum_{\substack{i<j \\ i,j\ne k}}s_{ij}.$$

(Note that as per Raymond Manzoni's answer, this is way more information than needed to find each $a_i$; you've given us $\binom{n}{2}$ equations, when only $n$ are necessary. But this is the symmetric way of doing it.)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.