Anish Singhal
Let Abe a set with nelements. We want functionsf:A×A⟶A such thatf(x,y)=f(y,x) for allx,y∈A.
Let us writeA×A=J∪K={(x,x)|x∈A}∪{(x,y)|x≠y,x,y∈A}.
Observe that|J|=n and|K|=n^2−n.To define fon A×A, we need to define fon Jand onK.
For each (x,x)∈Jwe can assign any of the nvalues of A, this means we have a totality ofn^nchoices.
Without any restrictions, for each (x,y)∈Kwe can assign any of then^nvalues ofAAbut for commutativity we have to assign the same value forf(x,y) andf(y,x) so in fact we can only assign values to n^2−n^2pairs (x,y)∈K. Thus there are a totality ofn^(n2−n)^2 choices.
So in all the number of commutative binary functions on Ais:n^n⋅n^(n2−n)2=n^n(n+1)2.