Functions explained through an analogy
We start from two sets A and B
Let $A$ and $B$ be two sets. A function is a mapping from elements of $A$ onto elements in $B$ that follows three rules:
The three fundamental rules for a function $f: A \to B$:
-
Domain Rule: For every element $x \in A$, there exists at least one element $y \in B$ such that $f(x) = y$.
-
Uniqueness Rule: For every element $x \in A$, there exists at most one element $y \in B$ such that $f(x) = y$.
-
Well-defined Rule: Combining rules 1 and 2, for every $x \in A$, there exists exactly one $y \in B$ such that $f(x) = y$.
Formally:
$$\forall x \in A, \exists! y \in B : f(x) = y$$We map elements from set A into elements of B
Think of a mapping as a relation that unites elements of $A$ with elements of $B$.
Example: Consider the sets $A = \{1, 2, 3\}$ and $B = \{a, b, c, d\}$. Which of the following relations is a function?
Relation 1:
$$f_1: \{(1, a), (2, b), (3, c)\}$$Is this a function? Yes! Each element in $A$ maps to exactly one element in $B$.
Relation 2:
$$f_2: \{(1, a), (2, b), (2, c), (3, d)\}$$Is this a function? No! The element $2 \in A$ maps to both $b$ and $c$, violating uniqueness.
Relation 3:
$$f_3: \{(1, a), (3, c)\}$$Is this a function? No! The element $2 \in A$ has no mapping, violating the domain rule.
The mapping should follow existence and uniqueness for all possible values of the domain
Patriarchy reigns in Africa. Let $A$ be the set of sub-Saharan African women. Any African woman in $A$ must have a husband in $B$ celibacy isn’t allowed. Furthermore, she should only have a unique husband. Forget about polyandry. Only monogamy for African girls. Do you see how it captures the conditions for a relation to be a function?
As in a true patriarchal society, men can have multiple relations (polygamy). They don’t have to have a unique partner. They are allowed to be celibate unlike women. This analogy encapsulates the rules for a relation to be considered a function.
One way to bring equality in our society is to apply all the conditions we imposed on women onto men.
Injective Functions (One-to-One)
If we are to bring equality by saying that men in $B$ must date only one girl in $A$, then we have an injective function.
Formal Definition: A function $f: A \to B$ is injective (or one-to-one) if:
$$\forall x_1, x_2 \in A, \text{ if } f(x_1) = f(x_2) \text{, then } x_1 = x_2$$Equivalently:
$$\forall x_1, x_2 \in A, \text{ if } x_1 \neq x_2 \text{, then } f(x_1) \neq f(x_2)$$Example of an Injective Function:
Let $A = \{1, 2, 3\}$ and $B = \{a, b, c, d\}$. Consider:
$$f: A \to B \text{ defined by } f(1) = a, f(2) = c, f(3) = d$$This is injective because each element of $A$ maps to a different element of $B$. No two women share the same man.
Example of a Non-Injective Function:
Let $g: A \to B$ be defined by:
$$g(1) = a, g(2) = b, g(3) = b$$This is NOT injective because $g(2) = g(3) = b$. Two women (2 and 3) are married to the same man ($b$).
Surjective Functions (Onto)
Now, what if we also require that every man in $B$ must be married to at least one woman in $A$? No man can remain celibate. This gives us a surjective function.
Formal Definition: A function $f: A \to B$ is surjective (or onto) if:
$$\forall y \in B, \exists x \in A : f(x) = y$$In other words, every element in $B$ is the image of at least one element in $A$.
Example of a Surjective Function:
Let $A = \{1, 2, 3, 4\}$ and $B = \{a, b, c\}$. Consider:
$$f: A \to B \text{ defined by } f(1) = a, f(2) = b, f(3) = c, f(4) = a$$This is surjective because every element in $B$ (every man) is mapped to by at least one element in $A$ (has at least one wife). Note that $f(1) = f(4) = a$, so man $a$ has two wives (polygamy), but no man is celibate.
Example of a Non-Surjective Function:
Let $A = \{1, 2, 3\}$ and $B = \{a, b, c, d\}$. Consider:
$$g: A \to B \text{ defined by } g(1) = a, g(2) = b, g(3) = c$$This is NOT surjective because $d \in B$ has no pre-image in $A$. Man $d$ remains celibate.
Bijective Functions (One-to-One Correspondence)
When we are both surjective and injective the equal society where the rules applied to women in $A$ are also applied to men in $B$ a function is said to be bijective.
Formal Definition: A function $f: A \to B$ is bijective if it is both injective and surjective.
This means:
- Every woman has exactly one husband (function property)
- Every man has exactly one wife (injectivity + surjectivity)
- No one is celibate (surjectivity)
- No one has multiple partners (injectivity)
Perfect monogamous equality!
Example of a Bijective Function:
Let $A = \{1, 2, 3\}$ and $B = \{a, b, c\}$. Consider:
$$f: A \to B \text{ defined by } f(1) = a, f(2) = b, f(3) = c$$This is bijective because:
- It’s injective: Each woman maps to a different man
- It’s surjective: Every man has a wife
- We have a perfect one-to-one pairing!
Important Note: For a bijective function $f: A \to B$ to exist, we must have $|A| = |B|$ (the sets must have the same cardinality). You cannot have a perfectly monogamous society if there are more men than women or vice versa!