# Cardinality of sets, relations, and functions

If there are two sets, A and B with each having finite number of elements, what would be the cardinalities of a set of all relations and a set of all functions from A to B?

1. Relations: Since a relation is a subset of cartesian product, would cardinality of the set of all relations from A to B be the cardinality of the power set of A x B? So if set A has 2 elements, and B has 3 elements, then cardinality of the set of all relations is $$2^6$$?

2. Functions: Since a function is a relation where each element from the domain has exactly 1 associated element from the co-domain, if cardinality of set A is x and cardinality of set B is y, then cardinality of all functions from A to B is $$y^x$$?

• That is correct. – drhab Nov 26 '19 at 11:34

Your explanation is absolutely correct. For the first one, you could subtract $$1$$ because people usually define a relation to be a nonempty subset of $$A$$x$$B$$. Empty relations are not that good.:p