Class 12 Maths, Worked in Full Past papersGet updates
Chapter 1 · Relations and Functions

Example 22: Number of one-one functions on {1, 2, 3}

ExamplesCounting functions · Miscellaneous Examples
The question

Find the number of all one-one functions from set A={1,2,3}A = \{1, 2, 3\} to itself.

Exam answer

For a one-one function f:A→Af : A \to A⁠, f(1)f(1) can be chosen in 3 ways, then f(2)≠f(1)f(2) \ne f(1) in 2 ways, and f(3)f(3)⁠, different from both, in 1 way.

∴\therefore Required number =3×2×1=3!=6= 3 \times 2 \times 1 = 3! = 6⁠.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

A function from {1,2,3}\{1,2,3\} to itself is fixed by three choices: the value f(1)f(1)⁠, the value f(2)f(2) and the value f(3)f(3)⁠. "One-one" says no value may be used twice. So the three outputs are three different numbers taken from {1,2,3}\{1,2,3\}⁠, which means they are 1,2,31, 2, 3 in some order. A one-one function here is nothing more than an arrangement (permutation) of the three symbols, and there are 3×2×1=3!=63 \times 2 \times 1 = 3! = 6 arrangements.

Given, to find, and the plan
Given
The set A={1,2,3}A = \{1,2,3\}⁠. We consider functions f:A→Af : A \to A⁠.
To find
How many of these functions are one-one.
Plan
(1) Describe a function by the list (f(1),f(2),f(3))\big(f(1), f(2), f(3)\big)⁠. (2) Translate "one-one" into "the three entries are all different". (3) Count the lists by choosing the entries one at a time (multiplication principle). (4) List all of them to see the count is right, and compare with the total number of functions.

Basics you need

1What a function is

A function f:A→Bf : A \to B assigns to every element of AA exactly one element of BB⁠. For a finite AA⁠, knowing the value at each element tells you the whole function. Basics: what a function is

2One-one (injective)

ff is one-one when different inputs give different outputs: x1≠x2⇒f(x1)≠f(x2)x_1 \ne x_2 \Rightarrow f(x_1) \ne f(x_2)⁠, or equivalently f(x1)=f(x2)⇒x1=x2f(x_1)=f(x_2) \Rightarrow x_1 = x_2⁠. Basics: one-one and onto

3The multiplication principle

If a task is done in stages, with mm ways for the first stage and, whatever happened there, nn ways for the second, then the task can be done in m×nm \times n ways. This extends to any number of stages. Basics: counting choices

4Permutations and n!n!

An arrangement of nn different objects in a row is a permutation. There are n!=n(n−1)⋯2⋅1n! = n(n-1)\cdots 2\cdot 1 of them. So 3!=3⋅2⋅1=63! = 3\cdot2\cdot1 = 6⁠. (Class XI, Permutations and Combinations.)

Solution

  1. Describe every function by a list of three values

    A function f:{1,2,3}→{1,2,3}f : \{1,2,3\} \to \{1,2,3\} is completely known once we know f(1)f(1)⁠, f(2)f(2) and f(3)f(3)⁠. So we can record it as the ordered list

    (f(1), f(2), f(3)).\big(f(1),\, f(2),\, f(3)\big).

    Each entry is chosen from {1,2,3}\{1,2,3\}⁠. For example, the list (2,2,1)(2,2,1) means f(1)=2, f(2)=2, f(3)=1f(1)=2,\ f(2)=2,\ f(3)=1⁠. Different lists give different functions, and every list gives a function. Since each of the three entries can be any of 3 values, there are 3×3×3=273 \times 3 \times 3 = 27 functions from AA to itself altogether.

    Turning a function into a list of values changes a question about "functions" into a question about "lists", and lists are easy to count. Nothing is lost: two functions on the same domain are equal exactly when they agree at every point, which is exactly when their lists are equal.
    A function must give one output for each input (Basic 1). That is why the list has exactly one entry per input, and why every entry must be filled in.
  2. Translate "one-one" into a condition on the list

    One-one means no two different inputs share an output. With inputs 1, 2, 3 this says

    f(1)≠f(2),f(1)≠f(3),f(2)≠f(3).f(1) \ne f(2), \qquad f(1) \ne f(3), \qquad f(2) \ne f(3).

    So the three entries of the list must all be different. Three different numbers taken from the three-element set {1,2,3}\{1,2,3\} must use up every element, so the list is just 1,2,31, 2, 3 written in some order: a permutation of the three symbols. For instance (2,2,1)(2,2,1) is not one-one (f(1)=f(2)f(1)=f(2)⁠), while (2,3,1)(2,3,1) is.

    The definition of one-one is about pairs of inputs. A set of three inputs has exactly three pairs, {1,2},{1,3},{2,3}\{1,2\}, \{1,3\}, \{2,3\}⁠, so checking those three inequalities is a complete check. This is the textbook's observation that a one-one function from {1,2,3}\{1,2,3\} to itself "is simply a permutation on three symbols".
    One-one: x1≠x2⇒f(x1)≠f(x2)x_1 \ne x_2 \Rightarrow f(x_1) \ne f(x_2) (Definition 5, Basic 2). On a finite set, "all outputs different" and "one-one" are the same statement.
  3. Count the lists one entry at a time

    Build a one-one function by choosing its values in order.

    • Choose f(1)f(1)⁠: any of 1, 2, 3. That is 3 ways.
    • Choose f(2)f(2)⁠: it must differ from f(1)f(1)⁠, so one value is ruled out. Whatever f(1)f(1) was, 2 values remain.
    • Choose f(3)f(3)⁠: it must differ from both f(1)f(1) and f(2)f(2)⁠, which are two different values. Exactly 1 value remains, so f(3)f(3) is forced.

    By the multiplication principle,

    number of one-one functions=3×2×1=3!=6.\text{number of one-one functions} = 3 \times 2 \times 1 = 3! = 6.
    start 123 231312 323121 (1,2,3)(1,3,2)(2,1,3)(2,3,1)(3,1,2)(3,2,1) f(1)3 ways f(2)2 ways f(3)1 way
    Each path from "start" to the bottom is one one-one function, read as (f(1),f(2),f(3))\big(f(1),f(2),f(3)\big)⁠. The tree splits 3 ways, then 2 ways under each branch, then does not split at all, so it has 3×2×1=63\times2\times1 = 6 paths.
    The multiplication principle needs the number of choices at each stage to be the same no matter what was chosen before. It is: after any choice of f(1)f(1) there are always exactly 2 values left for f(2)f(2)⁠, and after any two different values there is always exactly 1 left for f(3)f(3)⁠. The tree shows this: every blue node has two children, every gold node has one.
    Multiplication principle (Basic 3) and n!=n(n−1)⋯1n! = n(n-1)\cdots1 (Basic 4). Counting arrangements of nn different objects gives n!n! because the first place has nn options, the next n−1n-1⁠, and so on down to 1.
  4. List all six to confirm

    Functionf(1)f(1)f(2)f(2)f(3)f(3)Description
    f1f_1123the identity IAI_A
    f2f_2132swaps 2 and 3
    f3f_3213swaps 1 and 2
    f4f_4231cycles 1→2→3→11\to2\to3\to1
    f5f_5312cycles 1→3→2→11\to3\to2\to1
    f6f_6321swaps 1 and 3

    Each row uses 1, 2 and 3 exactly once, so each is one-one, and no permutation of 1, 2, 3 is missing (there are only 6). Hence there are exactly 6 one-one functions from AA to itself.

    The count from Step 3 is an argument; the list is an independent confirmation. Writing them in "dictionary order" (by f(1)f(1)⁠, then f(2)f(2)⁠) makes it easy to see that none is repeated and none is left out. It also shows each one is onto: every element of AA appears as an output, which matches Example 14 (one-one on {1,2,3}\{1,2,3\} forces onto).
    On a finite set, a one-one function from the set to itself is automatically onto, hence bijective. So these 6 functions are exactly the bijections of AA⁠. Lesson: types of functions
  5. Compare with all 27 functions

    Of the 27 functions in Step 1, the other 27−6=2127 - 6 = 21 are not one-one. They split into two kinds:

    • Constant functions (all three outputs equal): (1,1,1),(2,2,2),(3,3,3)(1,1,1), (2,2,2), (3,3,3)⁠. That is 3 functions.
    • Exactly two different outputs, such as (2,2,1)(2,2,1)⁠: the remaining 21−3=1821 - 3 = 18 functions.
    6⏟3 different values+18⏟exactly 2 values+3⏟1 value=27=33.\underbrace{6}_{\text{3 different values}} + \underbrace{18}_{\text{exactly 2 values}} + \underbrace{3}_{\text{1 value}} = 27 = 3^3.
    Sorting all 27 functions by how many different outputs they use accounts for every function exactly once, and the three groups add up to the total. That is a strong check that 6 is right. It also shows how restrictive "one-one" is: only 6 of the 27 functions qualify.
    Every function uses 1, 2 or 3 different output values, never anything else, so these three groups cover all cases without overlap.
Result

A one-one function from {1,2,3}\{1,2,3\} to itself is a permutation of the symbols 1, 2, 3, so the number of such functions is 3!=3×2×1=63! = 3\times2\times1 = 6. (This agrees with the textbook's answer of 6.)

Check it with numbers

A computer check (in the site's verification script) runs through all 33=273^3 = 27 lists (f(1),f(2),f(3))\big(f(1),f(2),f(3)\big) and keeps those with three different entries. It finds exactly 6, and they are exactly the six permutations listed in Step 4. The same test on a 4-element set finds 24=4!24 = 4! one-one functions out of 44=2564^4 = 256⁠, as the pattern predicts.

Common mistakes
  1. Answering 27. That counts all functions from AA to AA (333^3⁠), not just the one-one ones.
  2. Writing 3×3×33 \times 3 \times 3 or 3+2+13+2+1⁠. The choices shrink (3, then 2, then 1) and are multiplied, not added.
  3. Thinking the order of the list does not matter. (1,3,2)(1,3,2) and (3,1,2)(3,1,2) are different functions: in the first f(1)=1f(1)=1⁠, in the second f(1)=3f(1)=3⁠.
  4. Forgetting the identity. IA=(1,2,3)I_A = (1,2,3) is one-one and must be counted.
What to take away
  1. A function on a finite set is a list of values. Counting functions means counting lists.
  2. One-one functions from an nn-element set to itself are the permutations of the set, so there are n!n! of them. They are also onto, so they are exactly the bijections.
  3. The same reasoning gives n!n! onto functions from {1,…,n}\{1,\dots,n\} to itself: see Miscellaneous Q4.

Every fact used, and where it comes from

FactUsed inSource
A function gives one output for each inputStep 1Definition of a function (Class XI; Lesson: types of functions)
One-one (injective)Step 2Definition 5, Section 1.3
Multiplication principle; n!n! permutations of nn objectsSteps 1, 3, 5Class XI, Permutations and Combinations (Lesson: counting functions and relations)
One-one on {1,2,3}\{1,2,3\} implies ontoStep 4Example 14, Section 1.3; onto is Definition 6
Counts 6, 21, 18, 3, 27 and 4!=244! = 24Steps 3–5, CheckBrute force over all functions in the site's verification script
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →