How to prove that averaging averages of different partitions of a dataset produces the same overall average 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?
Thanks!
 A: 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}.
$$
A: 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:
$0.5(\frac{S_1}{N_1}+\frac{S_2}{N_2})=0.5(\frac{S_1+S_2}{0.5N})=\frac{S_1+S_2}{N}$
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.
A: 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

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

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