Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. 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

After testing some cases, it appears to be true that if you create partitions in a dataset, average the data in the partitions, then average the averages, you get the same result as if you averaged the entire dataset.

For instance:

avg(1,3,5,8,4,2) = 3.8333 avg(1,3,5) = 3 avg(8,4,2) = 4.6667 avg(3, 4.6667) = 3.8333

I'd like to be able to show that this is always true. Any ideas on this?


share|improve this question
This would be true only if the partitions have an equal size. – Bitwise Nov 7 '12 at 14:22
or, equivalently, if each partition is weighted by its size – ttnphns Nov 7 '12 at 14:31
The process becomes more transparent if you re-cast the situation in terms of sums rather than averages. – whuber Nov 15 '12 at 6:07
up vote 1 down vote accepted

Let's partition our $N$ elements into two sets with sizes $N_1,N_2$ and sums $S_1,S_2$.

The averages will be: $\frac{S_1}{N_1},\frac{S_2}{N_2}$

The average of this will be: $0.5(\frac{S_1}{N_1}+\frac{S_2}{N_2})$

If we assume the sizes are equal then $N_1=N_2=0.5N$ and we get:


Which is exactly the average of the original set.

In the general case, as mentioned in ttnphns's comment, this would be true only if you weigh the average by the sizes of the partitions. The proof is similar to the one I gave.

share|improve this answer
This is exactly what I was looking for, thanks! – sudo-nim Nov 7 '12 at 16:53
@user1546029 I just hope I'm not doing your homework... – Bitwise Nov 7 '12 at 16:59
Haha no, but that would be a cool class. – sudo-nim Nov 20 '12 at 5:31

This isn't true, here's a counter example. Consider the set $\{2, 2, 4\}$. Then $$ \text{avg}(\{2, 2, 4\}) = \frac{8}{3} $$ but $$ \text{avg}(\{\text{avg}(\{2\}), \text{avg}(\{2, 4\})\}) = \text{avg}(\{2, 3\}) = \frac{5}{2} \neq \frac{8}{3}. $$

share|improve this answer

Let's partition our N elements into two sets (s1, s2) with sizes N1, N2 and averages A1, A2 respectively.

To to deduce the average A of N elements from this information ( N1, N2, A1, A2 ), we can use this formula:

   Average = Sum / NumElements 
=> Sum = Average * NumElements


   Average of all numbers = Sum of numbers / Count of numbers


Sum of all numbers = N1*A1 + N2*A2
Total Elements = N1 + N2

Therefore correct answer is:

A = ( N1*A1 + N2*A2 ) / ( N1 + N2 )

Only when sizes of both partitions is same:

N1 = N2
A = (N1*A1 + N2*A2 )/ (N1+N2) = (N1*A1 + N1*A2)/(N1+N2) = N1*(A1+A2)/(2*N1)
=> A = (A1 + A2)/2

Hence the first answer only holds when size of both partitions is same.

share|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.