# Comparing a number with a set of numbers

Before start writting, I should declare that I'm not a mathematician at all. I know only the basics that taught us at school and hence what follows could be huge nonsense.

In order one to compare two numbers e.g 8 with 4, it is enough to just take the ratio of them, like $$\frac{8}{4} = 2$$ that says that 8 is 2 times bigger than 4. So far ok. But what happens if you want to compare one number with a set of numbers? For example to compare the 8 with the set of [7,4,2]?

The first idea that comes in my mind is to use the average of the set numbers and divide 8 with it. i.e $$\frac{8}{4.33333333333 } = 1.84615384616$$. But by taking the mean drives to lose some information that the biggest numbers in the set provide us with. In that case the 7.

From the other hand, you could divide the 8 only with the biggest number of the set since it carries the most information but then as you can understand you lose the information of the smaller ones.

So finally I saw the mean as the simplest linear model that could grab a bit of information of the underlying system and I was wondering if there is another linear or even nonlinear model that could boil down the numbers of the set into a representative value and then compare that value with the 8. Does something like that ever exist or all these are nonsense?

• See here - wikipedia.org/wiki/Average. What you refer to as average is called the arithmetic mean. Jun 30, 2019 at 8:42
• If you take in a set, why not output a set as well? So for your example, 8 compared to [7, 4, 2] would give [8/7, 2, 4] or [1.142857, 2, 4]. Jun 30, 2019 at 8:45
• What the most appropriate interpretation of comparing a number with a set of numbers is, certainly depends on your application ... You might want to comapre with arithmetic mean, geometric mean, the median, or any other mean, or with the maximum of the minimum, or you may want to find out the percentile of the candidate number, ... Jun 30, 2019 at 8:46
• @HagenvonEitzen: Can you give me an example using the percentile of the candidate number? I'm not sure that I understood it exactly. Jun 30, 2019 at 9:26
• @Infiaria: I thought it too to use that but I must provide one single number at the end of the comparison. Jun 30, 2019 at 9:26

I guess it depends a lot on your application what kind of comparison you use. One thing you could do which you didn't mention yet is to compare $$x$$ to a set $$S$$ by stating how many numbers of $$S$$ are smaller than $$x$$. This could be done in terms of percentage. So for example when comparing $$x = 8$$ to $$S = {9, 5, 2}$$ you would get $$\frac{|\{y \in S|y < x\}|}{|S|} = 2/3$$. Using this method you loose "information" in cases where $$x$$ is larger than all values in your set.
So what you could do is use the above method but whenever the above method returns $$1$$ (meaning that all elements in $$S$$ are smaller than $$x$$) you switch to the method where you take the fraction with the largest element of $$S$$ i.e. $$\frac{x}{max(S)}$$.
Another method would be to define a total order on finite sets: Let $$p_S(n)$$ be the $$n$$-th largest number in $$S$$. For example you could say that $$S < R$$ if $$|S| < |R|$$ or ( if $$|S| = |R|$$ and there is an $$n$$ such that for all $$i < n. p_S(i) = p_R(i)$$ and $$p_S(n) < p_R(n)$$ ). This is basically a lexicographic order. According to this order there is a smallest set (namely the empty set). Also for any two distinct sets you can say which set is larger. This means that for any set you can say that it is the $$i$$-th largest set (for some $$i$$) by this order. Now let $$f$$ be the function which takes a set $$S$$ and tells you the $$i \in N$$ such that $$S$$ is the $$i$$-th largest set. Computing $$f(S)$$ would give you some unique natural number which holds all the information of $$S$$ (together with knowing the function $$f$$). For given $$x$$ $$x/f(S)$$ holds all information.
• My fault that didn't mention that all numbers in the set are by default smaller than the $x$. So, in that case, you suggesting the division with the $max(S)$ Jun 30, 2019 at 9:23
• Ok. Well I guess in the end it depends on what you want to do with it. With my answer I just wanted to give you another idea what might be a viable option. For example one problem with going for the division with $max(S)$ is that different sets could give you the same number for one $x$ i.e. $\{7, 4, 2\}, \{7, 0\}$ would both yield $2$ for $x=14$. Would this cause problems in your application? Jun 30, 2019 at 9:29
• I mean what you could do is define some total order on finite sets of natural numbers. This would induce a bijective function $f$ from finite sets of natural numbers to natural numbers. You could then compute for given $x$ the ratio $x/f(S)$. This would yield distinct values for a given $x$ and interpreting the values depends on how you define the ordering. Jun 30, 2019 at 9:42