# Number of binary operations on a set

So ,in an interview I was asked to explain how to find the number of Binary Operations on a given set $S$ with cardinality $n.$ I was so nervous I forgot the standard method that as binary operations meant mappings $$S\times S \rightarrow S$$ , the number has to be $|S^{(S\times S)}|=|S|^{|S\times S|}=n^{n^2}$ in this case .

And I tried to take an alternative route that goes as follows**:**

Since Binary Operations are mappings $\tau$ $$\tau:S\times S\rightarrow S\\s.t.\ \ \ \tau:(s_1,s_2)\mapsto s_3$$ so we take a $2$-tuple and map it to another element. There are $n^2$ ways of choosing that $2$-tuple . The first one can get mapped to any of the $n$ elements so can the second and the $n^2$ th element . So the number is again $n^{n^2}.$

I was going right , no $?$ Or was there any fault in my way $?$ I don't know because I could not finish it there . I fumbled so badly that they showed me the way out.

• Seems fine. Say, two elements $a,b$ & binary operation would take $2$ elements at a time leading to $4=\{ aa, ab, ba, bb\}$ pairs; with each mapping to $2= \{ a, b\}$ values. So, each of four pairs mapping to two values leads to $16$ values. In fact, your expln. is quite good. Jul 16 '20 at 1:44

Yes, correct. You want functions $S\times S \rightarrow S$. There are $|S|^{|S\times S|}$ such functions.