Equal averages

Average

There are several different notions of average: the mean, the median, the mode and the range (see below for the definitions). If you work out each of these for the set of numbers 2, 5, 5, 6, 7, you'll notice something interesting — they are all equal to 5!

Can you find other sets of five positive whole numbers where mean = median = mode = range?

How many sets of five positive whole numbers are there with mean = median = mode = range = 100?

Share your thoughts and discoveries by posting a comment below!

This puzzle comes from our sister site Wild maths, which encourages students to explore maths beyond the classroom and is designed to nurture mathematical creativity. Visit Wild maths for more games, investigations, stories and spaces to explore!


Definitions

Given a list of $n$ numbers $x_1,$ $x_2,$ $x_3,$ up to $x_ n,$ (ordered by size) the mean is

  \[ \frac{x_1+ x_2 + ... x_ n}{n}. \]    

The median separates the lower half of the list from the higher half. It is the middle number if there are an odd number of numbers in the list, or the number half-way between the two middle numbers if there are an even number. So, assuming that $x_1 \leq x_2 \leq x_3 ... \leq x_ n.$ The median is

  \[ x_{(n+1)/2} \]    

if $n$ is odd and

  \[ \frac{x_{n/2} + x_{n/2+1}}{2} \]    

if $n$ is even.

The mode is the number in the list that occurs most often — which means that there can be more than one mode.

The range is the difference between the largest and the smallest number in the list:

  \[ x_ n - x_1. \]    

Comments

What possible number of sets has each 'target N'
so for instance with a target of 4 there are 2 sets:
2-4-4-4-6
2-3-4-5-6
And with target 5 there are also 2 sets:
2-5-5-6-7
3-4-5-5-8

This is a fun poser. I looked at it and found some patterns. I wanted to express what I found as an single elegant formula but couldn't manage it, so here is a description instead.

=================================
To calculate how many sets for an even number target:
(N divide by 2) add (N-6, + N-12, + N-18, ................for any positive number)

so for example
N4 =(4/2=2) (but nothing to add because 4 minus 6 is negative) answer= 2 sets
N8 =(8/2=4) + (8-6) (this time there is 2 to add because 8 minus 6 is positive) answer = 6 sets
=================================
To calculate how many sets for an odd number target:
N-3 + N-9 + N-15........ for any positive number

So for example
N5 =(5-3=2) answer is 2 sets
N9 =(9-3=6) answer is 6 sets
N13=(13-3=10) + (13-9=4) answer is 14 sets
=================================

I calculated 832 sets for a target of number of 100, but I could be wrong about it all. I'd love to have an elegant formula. Things to think about: modulus, partitions, triangles numbers, golden ratio ...... It levels at N=12. I kept looking at modulus tricks but couldn't quite nail it.
Thanks for another great thought provoking article!
here's the list I made
3 :0
4 :2
5 :2
6 :3
7 :4
8 :6
9 :6
10 :9
11 :10
12 :12
13 :14
14 :17
15 :18
16 :22
17 :24
18 :27
19 :30
20 :34
21 :36
22 :41
23 :44
24 :48
25 :52
26 :57

100:832

I think that last value for 100 from previously was meant to be 834 instead of 832
===========================

I've looked into this a bit more, but for variables other 5. this is what I found:
====================================
I looked at 3 variables. For example "1,2,3" which is the solution for target 2. Every even number has a single solution based on this ratio.
1,2,3
2,4,6
3,6,9
I found no solutions for odd numbers though.
====================================
I looked at 4 variables. For example "1,2,2,3" which is the solution for target 2. The same pattern as for three variables arises with a single solution for every even number, and none for the odd numbers
====================================
The case for 5 variables is stated previously.
====================================
I looked at 6 variables. Here I found a similar pattern to the 5 variable pattern. Here is my description for calculation;

EVENS
((N divided by 2) +1)+(N minus 4)+(N minus 10)+(N minus 16) + ...........for any positive number.

(Jumping by 6 every time as before)

ODDS
(N minus 1) + (N minus 7) + (N minus 13) + ..........for any positive number.
====================================
I looked at the case for 7 variables. Here the pattern changes, here is where it gets much complicated. I haven't produced a method for calculation at 7 variables yet. Here are my initial results followed by my thoughts.

target 2 : 2 sets
target 3 : 2 sets
target 4 : 7 sets
target 5 : 8 sets
target 6 : 15 sets
target 7 : 16 sets
target 8 : 32 sets
target 9 : 34 sets
target 10 : 60 sets

target 12 : 107 sets

Counting these by hand gets a bit tricky so mistakes could have crept in. Now it seems to relate to powers of 2 maybe.
I found that halving N and squaring the result seemed to relate to the grouping of the sets for each target.

Let me know what you think

Short Answers:

  1. There are other sets of five positive whole numbers where mean=median=mode=range.
  2. There are 33 sets where mean=median=mode=range=100

*I should mention that sets with all five numbers being distinct are not taken into account since, after exploring the web a little bit, it seems that those type of sets are considered to have no mode at all (plus it gets pretty messy if we add those type of sets as solutions). So the set {2,3,4,5,6} that was mentioned by the first commenter is not a solution.

Long Answers:
We'll start with expressing the equations for the mean, median and range first, as they are pretty straightforward, and deal with the mode later.
So for well-ordered sets of five positive whole numbers, and where we denote mean=median=mode=range=a, we get:

  1. Mean: (x1+x2+x3+x4+x5)/5=a , or x1+x2+x3+x4+x5=5a
  2. Median: x3=a
  3. Range: x5-x1=a, or x5=x1+a

Substitute (2) & (3) into (1) to get:
(Eq.1) 2x1+x2+x4=3a

Now let's deal with the mode. With a well-ordered set of five numbers, there are 3 possible combinations for the mode:

  1. x2=x3=a, x4 and x5 may or may not be the same
  2. x3=x4=a, x1 and x2 may or may not be the same
  3. x2=x3=x4=a

For the first case Eq.1 becomes x4=2(a-x1). Since the set is well-ordered we can write x3<x4≤x5, or a<x4≤x1+a, or a<2(a-x1)≤x1+a. After a few algebraic manipulations on this inequality, we get a/3≤x1<a/2.
For the second case Eq.1 becomes x2=2(a-x1). After applying the same logic and math procedure as before we get, a/2<x1≤2a/3.
The third case is the simplest. Just substitute x2=x4=a (x3 is already equal a since it's the median) into Eq.1 to get, x1=a/2.

Let's summarize all the important relations:

  1. x3=a
  2. x5=x1+a
  3. When x2=a, x1 takes positive whole values a/3≤x1<a/2 and x4=2(a-x1)
  4. When x4=a, x1 takes positive whole values a/2<x1≤2a/3 and x2=2(a-x1)
  5. When x2=x4=a, x1 takes positive whole value x1=a/2

Let's see two examples:

  1. a=5. For the case x2=a, the inequality for x1 is 1.66≤x1<2.5, thus x1 can only take the value 2. In this case x4=2(5-2)=6, x5=2+5=7 and the set is {2,5,5,6,7} just like presented in the article.
    For the case x4=a, the inequality for x1 is 2.5≤x1<3.33, thus x1 can only take the value 3. In this case x2=2(5-3)=4, x5=3+5=8 and the set is {2,4,5,5,8}.
    For the case x2=x4=a, x1=5/2=2.5 which is impossible since x1 can only have integer values. This means that there is no set where the mode occurs three times.
  2. Before continuing to the next example, we can notice that x1 takes the same amount of values whether x2=a or x4=a. So for example, if x1 took two values from the inequality a/3≤x1<a/2 then it will take two values from the inequality a/2<x1≤2a/3. So to count the number of solutions, we only need to consider one inequality and double the amount of values that x1 took. If a is even then we have one more solution and if a is odd then we dont. With this in mind let's continue to the second example:

  3. a=100. For the case x2=a, the inequality for x1 is 33.33≤x1<50, thus x1 can only take the values 34,35,...,49, which is a total of 16 values. Double that number because from the second inequality we'll also get 16 values for x1, and add 1 because a=100 is even. So we have a total of 16+16+1=33 sets where mean=median=mode=range=100

An observation that I made is that when a is even, starting with a=2, the number of sets that satisfy mean=median=mode=range=a are:
1,1,3,3,3,5,5,5,7,7,7,9,9,9,... and so on. And for a odd, starting with a=1, we have: 0,2,2,2,4,4,4,6,6,6,8,8,8,... and so on. So clearly there is a pattern yet I'm not sure how to immediately know the number of sets that satisfy mean=median=mode=range directly from the value of a.

When I do take into account sets where all five numbers are distinct, I get into pretty ugly mess of inequalities which are not so easily solved. But I did manage to find a limit to the number of sets. If all numbers are distinct and x3 must be equal to a because it's the median, then x1 can take at maximum (a-2) values (in this case x2=a-1). So for example when a=100, then x3=100, x2=99 and x1 can at maximum take 98 vlaues (1,..,98). Thus the maximum number of sets that will satisfy mean=median=mode=range is 33+98=131. I'm pretty sure that the actual amount of sets that satisfy our condition is way lower since a few inequalities are involved and many of them won't be satisfied.

That's It! If you read up until now then thank you very much! :)
I'd love to hear some feedback!

Ignore this comment. I rewrote it plus there were some mistakes in it..

Short Answers:

  1. There are other sets of five positive whole numbers where mean=median=mode=range.
  2. There are 33 sets where mean=median=mode=range=100

*I should mention that sets with all five numbers being distinct are not taken into account since, after exploring the web a little bit, it seems that those type of sets are considered to have no mode at all (plus it gets pretty messy if we add this type of sets as solutions). So the set {2,3,4,5,6} that was mentioned by the first commenter is not a solution.

Long Answers:
We'll start with expressing the equations for the mean, median and range first, as they are pretty straightforward, and deal with the mode later.
So for well-ordered sets of five positive whole numbers, and where we denote mean=median=mode=range=N, we get:

  1. Mean: (x1+x2+x3+x4+x5)/5=N , or x1+x2+x3+x4+x5=5N
  2. Median: x3=N
  3. Range: x5-x1=N, or x5=x1+N

Substitute (2) & (3) into (1) to get:
(Eq.1) 2x1+x2+x4=3N

Now let's deal with the mode. With a well-ordered set of five numbers, there are 3 possible combinations for the mode:

  1. x2=x3=N, x4 and x5 may or may not be the same
  2. x3=x4=N, x1 and x2 may or may not be the same
  3. x2=x3=x4=N

For the first case Eq.1 becomes x4=2(N-x1). Since the set is well-ordered we can write x3<x4≤x5, or N<x4≤x1+N, or N<2(N-x1)≤x1+N. After a few algebraic manipulations on this inequality, we get N/3≤x1<N/2.
For the second case Eq.1 becomes x2=2(N-x1). After applying the same logic and math procedure as before we get, N/2<x1≤2N/3.
The third case is the simplest. Just substitute x2=x4=N (x3 is already equal N since it's the median) into Eq.1 to get, x1=N/2.

Let's summarize all the important relations:

  1. x3=N
  2. x5=x1+N
  3. When x2=N, x1 takes positive whole values N/3≤x1<N/2 and x4=2(N-x1)
  4. When x4=N, x1 takes positive whole values N/2<x1≤2N/3 and x2=2(N-x1)
  5. When x2=x4=N, x1 takes positive whole value x1=N/2

Let's see two examples:

  1. N=5. For the case x2=N, the inequality for x1 is 1.66≤x1<2.5, thus x1 can only take the value 2. In this case x4=2(5-2)=6, x5=2+5=7 and the set is {2,5,5,6,7} just like presented in the article.
    For the case x4=N, the inequality for x1 is 2.5≤x1<3.33, thus x1 can only take the value 3. In this case x2=2(5-3)=4, x5=3+5=8 and the set is {2,4,5,5,8}.
    For the case x2=x4=N, x1=5/2=2.5 which is impossible since x1 can only have integer values. This means that there is no set where the mode occurs three times.
  2. Before continuing to the next example, we can notice that x1 takes the same amount of values whether x2=N or x4=N. So for example, if x1 took two values from the inequality N/3≤x1<N/2 then it will take two values from the inequality N/2<x1≤2N/3. So to count the number of solutions, we only need to consider one inequality and double the amount of values that x1 took. If N is even then we have one more solution and if N is odd then we dont. With this in mind let's continue to the second example:

  3. N=100. For the case x2=N, the inequality for x1 is 33.33≤x1<50, thus x1 can only take the values 34,35,...,49, which is a total of 16 values. Double that number because from the second inequality we'll also get 16 values for x1, and add 1 because N=100 is even. So we have a total of 16+16+1=33 sets where mean=median=mode=range=100

An observation that I made is that when N is even, starting with N=2, the number of sets that satisfy mean=median=mode=range=N are:
1,1,3,3,3,5,5,5,7,7,7,9,9,9,... and so on. And for N odd, starting with N=1, we have: 0,2,2,2,4,4,4,6,6,6,8,8,8,... and so on. So clearly there is a pattern yet I'm not sure how to formulate an equation that will calculate the number of sets that satisfy mean=median=mode=range directly from the value of N. I did manage to find an algorithm though:

  1. Divide N by 3 to get a number M
  2. If N is even & M is not an integer, then round M to the nearest odd integer
  3. If N is odd & M is not an integer, then round M to the nearest even integer
  4. If M is an integer, then add 1 to M

So for example, for N=100 we have M=100/3=33.33, and the nearest odd integer is 33. For N=5, M=1.66 and so the number of solutions is 2.

When I do take into account sets where all five numbers are distinct, I get into pretty ugly mess of inequalities which seems hard to solve, so I'm not sure how to count the number of solutions in this case. I'd love to hear suggestions!

That's It! If you read up until now then thank you very much! :)
I'd love to hear some feedback!

Dear S.K.

The formula you are looking for is:

Number of sets = (N - 3 + 2*(N MOD(3)) / 3, N = 1, 2, 3, .........

Examples: N = 5: number = (5 - 3 + 2*2) / 3 = 2
N = 100: number = (100 - 3 + 2*1) / 3 = 33

Hub Boreas

Thanks!
So we have a nice elegant formula..! (excluding sets where all numbers are distinct)

Would you mind explaining how did you come to this formula?

How to derive the formula?
Enumerate the first 15 possibilities:
N: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
NS: 0 1 0 1 2 1 2 3 2 3 4 3 4 5 4
NS is number of sets

See the pattern:
1: N: 1 4 7 10 13
NS: 0 1 2 3 4
2: N: 2 5 8 11 14
NS: 1 2 3 4 5
3: N: 3 6 9 12 15
NS: 0 1 2 3 4

or

1: N mod(3) = 1 -> NS = (N - 1) / 3
2: N mod(3) = 2 -> NS = (N + 1) / 3
3: N mod(3) = 0 -> NS = (N - 3) / 3

and

1: (N – 1) / 3 = (N - 3 + 2 * 1) / 3
2: (N + 1) / 3 = (N - 3 + 2 * 2) / 3
3: (N – 3) / 3 = (N - 3 + 2 * 0) / 3

All together: NS = (N - 3 + 2 * N(mod(3)) / 3
I verified the result for N = 1 up to 10000. Everything OK.

Hub.

I dislike the idea that the range is an average; it is surely a measure of dispersion, not of central tendency.

There are many other genuine averages of interest, such as the geometric mean, the harmonic mean, the root mean square, and the mid-range.
Other averages exist but I don't have room in the margin to list them.