6

We define an onto function from $[n] \times [n]$ to $[n-2] \cup \{0\}$ as follows, where $[n] = \{1,2,3,\ldots ,n\}$,

$$f : [n] \times [n] \rightarrow [n-2] \cup \{0\}.$$

1) $f(x,x) = 0$.

2) $f(x,y) = f(y,x) > 0$, for $y ≠ x$.

3) $f(x,y) \leq \max(f(x,z),f(z,y))$ for all $x,y,z$ belonging to $[n]$.

How many such functions are possible for a given $n$? I have tried my best but I am not able to get any close to the solution! One may even see it as a undirected simple graph with n vertices, f(x,y) representing the edge weights. Any help is appreciated!

1 Answers1

1

First note that condition 3) is trivially satisfied by letting $z=x$ or $z=y$, as user Marc van Leeuwen noted in the comments.

Next, we note that in order for the map to be onto, every element of $[n-2]\cup \{0\}$ must have a nonempty preimage in $[n]\times[n]$.

By condition 1), $0$ has a nonempty preimage consisting of all element in the form $(x,x)$.

Condition 2) states $f(x,y)=f(y,x)\ne0$ for $x\ne y$, so we can identify the elements $(x,y)$ and $(y,x)$, since they must either both be in or both not be in the preimage of any particular element.

Since we have $n\choose2$ elements $(x,y)$ of $[n]\times[n]$ such that $x\ne y$, we can reduce our problem to counting the number of onto mappings from a set of $n\choose 2$ elements to a set of $n-2$ elements.

As is explained here: Calculating the total number of surjective functions, this number is given by $S({n\choose2},n-2)(n-2)!$ where $S(x,y)$ are the Stirling numbers of the second kind.