Maths WorkshopMaths problems with full solutions
Exercise 486Combinatorics › Inclusion-exclusionHigh schoolAdded 3 Nov 2026

Non-constant functions to $\{0,1\}$

#IE#functions#non-constant

Statement

Count non-constant functions from an nn-element set to a 22-element set.

Hint

Total minus constant.

Show solutionHide solution

Solution

Total. 2n2^n functions.

Constant. 22 constants (all 00 or all 11).

Non-constant. 2n−22^n-2.

Conclusion. 2n−22^n-2.