Finding a missing number of a sequence based on the average and median

2k Views Asked by At

Is there a way for you to know the value of a single missing $x$ inside of a sequence of numbers, given that you know the average and the median of this sequence are the same?

For instance:

Take the following sequence defined in the set of Real numbers: $5, x, 2, 6, 5, 2, 8$

And you know beforehand that the average and the median of such sequence are supposed to be exactly the same value, but you don't know the actual value of it.

It feels to me that it should be possible to tell the value of $x$ but I couldn't get to it.

Or maybe, if you were to sort that sequence from lower to higher values, could you tell at least where $x$ would lie in the sorted sequence?

I know I could run a loop through possible values and check if they turn the average and the median to be the same, which is what I'm doing right now, but I am wondering if you could get to it in a more direct fashion.

Any thoughts on this would be appreciated.

1

There are 1 best solutions below

3
On BEST ANSWER

The average is $\frac {28+x}7=4+\frac x7$
The median is always $5$ because if $x \lt 5$ the ordered list is $x,2,2,5,5,6,8$ or $2,2,x,5,5,6,8$ while if $x \gt 5$ the ordered list is something like $2,2,5,5,x,6,8$. In either case $5$ is the median. $$4+\frac x7=5\\x=7$$ If the numbers had not been chosen carefully, the median could depend on $x$. You would have to divide into cases based on which interval $x$ fit into, then solve it for each one and find which was consistent.