# Equal and Unequal Averages: Zach's Solution

Thanks to Zach for submitting this solution in response to the problem Unequal Averages  on NRICH.

The question says you can input any five positive integers and that the output must be a single digit number. This means that the output must also be positive and lie in the range 1-9.

$\text{sum of quantities} = \text{mean} \times \text{number of quantities}$

The first thing I did was to calculate the sum of quantities by multiplying the possible means (1-9) by the number of quantities, which is fixed at 5. I then used spaces to represent the five positive integers:

 $n$ Possibly $x$ $x$ Possibly $x$ $n+x$ $A$ $B$ $C$ $D$ $E$

Let's say that the mean is $x$. Since the mean must equal the median, then $x = \text{median}$, which must occupy position C. But as the median = mode, then $x = \text{mode}$, meaning that $x$ must appear at least twice, so $x$ can appear in B and/or D. If n occupies position A, then n + x will occupy position E, as $x =$ range which also equals the mode.

$A + B + C + D + E = 5x$ because $5x \div 5 = x$, where $x$ is the mean. Then $5x - 2x = 3x$

The mode will appear at least twice, so the remaining three numbers will sum to 3 times the mean.

Next I reduced the number of variables to just one space, which became the balancing figure. Here is how I did it:

(i) input a value x for the median into position C

(ii) add the same number to represent the mode (this could occupy B or D)

(iii) calculate a target sum of quantities using a mean in the range 1 - 9, e.g. $5 \times 9 = 45$

(iv) subtract the mode from the sum of quantities

(v) input a value into position A (start with 1 then 2 etc..), add this to the number x you put in C and use this to populate position E.

(vi) now only one space is left blank - this is the balancing figure (which could be in B or D)

(vii) test the model against the target sum of quantities (e.g. $5 \times 9 = 45$, pretty quickly you will find all the available sets (including bimodal sets, which do not technically fulfil the criteria. These usually sit either side of any sets that do actually work).

 Mean = Median = Mode = Range Sets and Observations =1 none possible (can only input 1, but range = 0) =2 1,2,2,2,3 works =3 1,3,3,4,4 and 2,2,3,3,5 are bimodal (mode has two values). =4 2,4,4,4,6 works =5 2,5,5,6,7 and 3,4,5,5,8 work =6 3,6,6,6,9 works but 2,6,6,8,8 and 4,4,6,6,10 are bimodal =7 3,7,7,8,10 and 4,6,7,7,11 work =8 3,8,8,10,11 and 4,8,8,8,12 and 5,6,8,8,13 work =9 4,9,9,10,13 and 5,8,9,9,14 work, but 3,9,9,12,12 and 6,6,9,9,15 are bimodal

Part Two: we still have five spaces labelled A-E, but we now need to find values that will satisfy an inequality

Mode<Median<Mean

I started with the mean. 3 is the smallest mean possible, therefore the median would have to be 2 and the mode 1. This time I put 2 in space C, and 1's in A and B. Then I put a 3 in D (median plus 1), leaving E as the balancing figure required to obtain an overall mean of 3. Once I found a set that worked, I increased D and reduced E to obtain further sets. I then worked systematically to substitute ever larger numbers for the mean. Here is a sample of what I found:

 Mode

The pattern leaps out: if the first four numbers are fixed, just increase the number in space E by 5 each time, so $(1,1,2,3,8)$  satisfies $1<2<3$ and $(1,1,2,3,13)$  satisfies $1<2<4$. This is because $P \div 5 = Q$, whereas $(P+5) \div 5 = (Q+1)$. And you can go on to find many sets: e.g. $(1,1,3,4,11)$, $(1,1,3,5,10)$, $(1,1,3,6,9)$ and $(1,1,3,7,8)$ satisfy $1<3<4$, and $(1,1,3,4,16)$, $(1,1,3,5,15)$, $(1,1,3,6,14)$, $(1,1,3,7,13)$, $(1,1,3,8,12)$, $(1,1,3,9,11)$ satisfy $1<3<5$ etc...

For four numbers I started with $1<2<3$. Put 1 in space A and B, and 3 in space C to make a median of 2. Mean of 3 leads to a sum of quantities of 12 ($3 \times 4 = 12$), balancing figure in D is 7. So $(1,1,3,7)$ satisfies $1<2<3$, $(6,6,8,12)$ satisfies $6<7<8$, $(5,5,9,17)$ satisfies $5<7<9$ etc...

Six numbers leads to six spaces labelled A-F. Test $1<2<3$: put 1 in spaces A, B and C, then 3 in space D to generate a median of 2. I then chose to put 3 in space E, although you could also put in 4,5,6 in this case, leaving F as the balancing figure required to make an overall mean of 3. So $(1,1,1,3,3,9)$, $(1,1,1,3,4,8)$, $(1,1,1,3,5,7)$ and $(1,1,1,3,6,6)$ satisfy $1<2<3$. There are many possibilities if you use other variables.

Mode<Mean<Median

To satisfy the inequality, mode will occupy space A and B, median will occupy space C, the remaining two numbers in D and E are found as follows: $(D + E) = 5 \times \text{mean} - (A + B + C)$

$1<2<3$ is not possible, as the numbers are too small, $1<3<4$ only generates a bimodal set $(1,1,4,4,5)$, but $(1,1,5,6,7)$ works for $1<4<5$; $(2,2,7,8,11)$ and $(2,2,7,9,10)$ also work for $2<6<7$.

I then tried $5<8<10$, but the mode was too big, so I reduced it to find: $(3,3,10,11,13)$ for $3<8<10$, $(2,2,10,11,15)$ and $(2,2,10,12,14)$ for $2<8<10$, then $(1,1,10,11,17)$, $(1,1,10,12,16)$ and $(1,1,10,13,15)$ all satisfy $1<8<10$. If you use other variables, you will find other sets.

Four numbers: I tried many combinations of variables, but struggled to find any that satisfied this inequality using only four positive integers. I realised that I had to try and keep the mean and median as close together as possible to generate a mean that is as large as possible. Despite using lots of large numbers, I found that I was often stuck with a constant difference of 4 (figure in C was 4 larger than the balancing figure in D). To understand why, I substituted a googol into the inequality:

$\text{mode}<\text{mean}<\text{median} = G - (G - 1) < G - 1 < G$

 $G-(G-1)$ $G - (G-1)$ $2G-1$ $N$ $A$ $B$ $C$ $D$

This simplifies to $1 + 1 + (2G - 1) + N = 4G - 4$. We are left with $N = 2G - 5$, which explains why C is 4 larger than D. It is not possible to satisfy this inequality using 4 positive integers.

Six numbers do satisfy this inequality, e.g. $(1,1,6,8,9,11)$ for $1<6<7$ or $(2,2,20,22,23,51)$, $(2,2,20,22,24,50)$, $(2,2,20,22,25,49)$ ... $(2,2,20,22,36,38)$ for $2>20>21$.

Mean<Mode<Median

I used consecutive numbers to try and satisfy this inequality, so that the mean is as large as possible in relation to the mode and median. The mode has to occupy spaces A and B, and the median in space C, leaving sum of the numbers in spaces D and E as the balancing figure required to get an overall mean. However, the mean is just too small and this inequality cannot be satisfied by 5 positive integers.

I found it very difficult to try and explain this using algebra, so I used numbers and logic instead: $1<2<3$ is the smallest set we can try, so: $2 + 2 + 3 + D + E = 5$. The smallest number that can go in space D is 4, and the smallest number that can go in E is 5. Obviously, this set doesn't work, but if I rewrite it using letters then $1<2<3$ becomes

$R < R + 1 < R + 2$, and we know that space D must be at least 1 number bigger than space C, and space E at least one number bigger than space D. So we get: $(R + 1) + (R + 1) + (R + 2) + (R + 3) + (R + 4) = 5R$ but this simplifies to 5R + 11 = 5R, which obviously is not possible. Similarly four numbers are not possible, as the sum of quantities is made even smaller whereas six numbers will work for the opposite reason, e.g. $(1,1001,1001,1003,1004,1990)$ satisfies $1000<1001<1002$

Mean<Median<Mode

This time the mode will go into spaces D and E, and the median into space C. The sum of numbers in spaces A and B become the balancing figure to achieve an overall mean. Five numbers work: e.g. $(7,12,13,14,14)$, $(8,11,13,14,14)$ and $(9,10,13,14,14)$ all satisfy $12<13<14$ which can also generate a four numbered set: $(8,12,14,14)$ and a six numbered set $(7,11,12,14,14,14)$, which is really cool!

Median<Mode<Mean

Using five figures, the median must occupy space C: the smallest possible median number is 3 since space B must be at least one less than 3, and space A must be at least two less than C. Because the mode is larger than the median, the mode must occupy spaces D and E. This leaves the sum of numbers in spaces A and B as the balancing figure. If you try to test the inequality $3<4<5$, you quickly realise that this will not work, as the balancing figure $(A + B)$ must equal 14, and yet, because of the order of the inequality, $A +B$ can only equal 3, a difference of 11. I did try lots of variables, but I don't think this inequality can be satisfied by five positive integers. I then tried to use algebra to help understand what was happening: $G-1 < G < G + 1$

 $G-2$ $G-1$ $G$ $G+1$ $G+1$ $A$ $B$ $C$ $D$ $E$

This simplifies to $5G - 1 = 5G + 10$, which will not work, and again produces a constant difference of 11.

All this means is that you cannot use consecutive numbers to satisfy this inequality, however if you try to use non-consecutive numbers, it still will not work as the mean becomes even bigger. A and B must both be smaller than C, and yet A and B are the balancing figures.

Four numbers seem possible, as the mean will be smaller (multiply by 4 instead of 5), but the mode must occupy spaces C and D, and spaces B and C must sum to two times the median. Only space A is left as the balancing figure (which must also be smaller than B). I could not find a valid set.

Six numbers are possible though, e.g $(1,2,3,5,5,32)$ satisfies $4<5<8$, because you are able to move the mode to spaces D and E, and leave space F as the balancing figure.

Median<Mean<Mode

As above, I populated space C first with the median: the smallest possible number is 3, leaving 2 in space B and 1 in space A. Spaces D and E will then become the mode. This way $(1,2,3,7,7)$ satisfies $3<4<7$ and $(2,3,4,8,8)$ satisfies $4<5<8$. I did find lots of sets and observed the following:

If $G$ is greater than or equal to 3, this pattern will always work: $\text{median}<\text{mean}<\text{mode} = G < G + 1 < G + 4$

 $G-2$ $G-1$ $G$ $G+4$ $G+4$ $A$ $B$ $C$ $D$ $E$

The sum of these is $5(G+1)$

When I tried four numbers I struggled to obtain a valid set. Because the median is the smallest number, spaces B and C sum to two times the median. Whatever figure goes in space C must be repeated in space D, leaving A as the balancing number (which must also be smaller than B). It seems that if you establish a mode you cannot get a mean and vice versa.

Six numbers are possible because you are able to work backwards and first populate spaces D and E with the mode. Then populate space C to establish the median. Space B and A need to be progressively smaller than C, leaving F as the balancing figure: e.g. $(8,9,10,18,18,27)$ satisfies $14<15<18$, $(6,7,8,16,16,25)$ satisfies $12<13<16$ for the same reason.

Response to: