-2
$\begingroup$

A function f applied is applied to the Cartesian product of the set $ s = \{a,b\} $ :

f(a,a) , f(a,b) , f(b,a) , f(b,b)

I think it's ok to ignore the output of the function f except to say that the output of f is commutative in terms of its arguments : f(a,b) == f(b,a)

for a set $ s = \{a,b,\,c\} $

the possible functions are :

f(a,a),f(b,b),f(c,c),f(a,b),f(a,c),f(b,a),f(b,b),f(c,a),f(c,b)

Of interest here is f(a,b) , (f(a,c) , f(b,c) -> 3 comparisons

Is there a theorem or proof that describes

if n=2 then 1 comparison required, if n=3 then 3 comparison required ?

This is my approach so far but I'm unable to show number of comparisons required for set of size n :

For set s of size n there exists $n^2$ pairs, to find 'unique' comparison remove self comparisons. A self comparison is one where a pair contains same elements such as (a,a) , (b,b) .

If $s = \{a,b\}$ there are $2^2$ = 4 pairs. Remove self comparisons , self comparisons are of size n. In this case n=2 so $4^2-2=2$. There are two pairs but just one is of interest as f(a,b) , f(b,a) will yield the same result. I'm struggling how to describe that I can remove f(a,b) or f(b,a).

1 Answers 1

1

The number you are looking for is known as the binomial. For any number $n$, the symbol $$ \binom{n}{2} $$ is the number of ways to pick two elements from a set of $n$ elements. So, as you observed, $$ \binom{2}{2} = 2 \qquad \text{and}\qquad \binom{3}{2} = 3. $$ You can prove that generally $$ \binom{n}{2} = \frac{n(n-1)}{2}, $$ which tells you the number of "comparisons" there are.

  • 0
    how does $n(n-1) / 2$ relate to "binomial" ? Reading https://en.wikipedia.org/wiki/Binomial_theorem & https://en.wikipedia.org/wiki/Binomial_coefficient does not mention the formula $n(n-1) / 2$ . Closest I found is this post http://mathforum.org/library/drmath/view/61212.html which describes $n(n-1) / 2$ in terms of number of connections but does not mention "binomial".2017-01-15
  • 1
    @blue-sky, more generally, numbers of the form $\binom{n}{k}$ are called binomials or binomial coefficients. You are looking at one special case, namely the case where $k = 2$.2017-01-15