# 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.

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