Similar questions 2 more →
Sets, Relations & Functions


Shared context
A is a finite set of n > 0 elements. N_r counts all binary relations on A, and N_f counts all total functions A → A.
Answer & solution
Answer: N_f = n^n (no official key was published)
1. Apply the definition of a total function. For every element x of the n-element set A, a function f:A → A must select exactly one image f(x). An element may not be left without an image, unlike an arbitrary relation.
2. Count the image choices. There are n possible values of f(x), because the codomain is also A. The images of different domain elements need not be distinct: the question counts all functions, not only injective functions.
3. Apply the product rule over the n domain elements. Independent choices give Nf = n × n × ⋯ × n = nn, with n factors.
4. Check a small example. For A = {a,b}, the ordered pair (f(a),f(b)) can be (a,a), (a,b), (b,a), or (b,b), giving 4 = 2² functions. Using n! would incorrectly discard the two constant functions.