Functions: One-to-One, Onto, and Definitions
Define the two strict requirements for a relation \(R\) from set \(A\) to set \(B\) to be considered a function \(f: A \to B\).
Consider the set \(A = \{1, 2, 3\}\) and \(B = \{x, y\}\). Is the relation \(f = \{(1, x), (2, y)\}\) a function from \(A\) to \(B\)? Why or why not?
No. It fails the existence requirement. The element \(3 \in A\) does not have a corresponding image in \(B\).
State the formal definition of a One-to-One (Injective) function using logic notation.
A function \(f: A \to B\) is injective if: \[\forall a_1, a_2 \in A, f(a_1) = f(a_2) \implies a_1 = a_2\] Alternatively: Distinct inputs must yield distinct outputs.
Let \(f: \mathbb{Z} \to \mathbb{Z}\) be defined by \(f(n) = n^2\). Is this function one-to-one?
No. Counterexample: \(f(2) = 4\) and \(f(-2) = 4\). Since \(f(2) = f(-2)\) but \(2 \neq -2\), it is not injective.
What is the formal definition of an Onto (Surjective) function?
A function \(f: A \to B\) is surjective if: \[\forall b \in B, \exists a \in A \text{ s.t. } f(a) = b\] In plain English: The Range is equal to the Codomain.
Let \(f: \mathbb{R} \to \mathbb{R}\) be defined by \(f(x) = x + 5\). Is this function onto?
Yes. To prove it, pick any \(y \in \mathbb{R}\) (the codomain). We need an \(x\) such that \(x + 5 = y\). Solving for \(x\) gives \(x = y - 5\). Since \(y - 5\) is always a real number, every \(y\) has a pre-image.
If a function is both one-to-one and onto, what is it called?
A Bijection (or a one-to-one correspondence). Bijections are the only functions that have a well-defined inverse function \(f^{-1}\).
If \(|A| = 5\) and \(|B| = 3\), can there exist an injective function \(f: A \to B\)?
No. By the Pigeonhole Principle, if you try to map 5 items into 3 slots, at least one slot must contain more than one item. Therefore, at least two elements in \(A\) must map to the same element in \(B\).
If \(|A| = 3\) and \(|B| = 5\), can there exist a surjective function \(f: A \to B\)?
No. There are not enough elements in the domain to “cover” every element in the codomain. At least 2 elements in \(B\) will be left without a pre-image.
Consider the Python function below. In mathematical terms, what is the Domain of this function?
The domain is \(\mathbb{R} \setminus \{0\}\) (all real numbers except zero), or more specifically in CS terms, all non-zero floats.
What is the horizontal line test used for in coordinate geometry?
It determines if a function is one-to-one. If any horizontal line intersects the graph more than once, the function is not injective because multiple \(x\)-values produce the same \(y\)-value.
Let \(A = \{1, 2, 3\}\) and \(B = \{a, b, c\}\). How many total functions are possible from \(A\) to \(B\)?
For each of the 3 elements in \(A\), there are 3 choices in \(B\). \[|B|^{|A|} = 3^3 = 27 \text{ functions}\]
True or False: Every function is a relation, but not every relation is a function.
True. A relation is simply any set of ordered pairs. A function is a specific type of relation that obeys the existence and uniqueness rules.
Determine if \(f(n) = 2n\) is a bijection from \(\mathbb{Z} \to \mathbb{Z}\).
No. It is one-to-one, but it is not onto. The codomain is all integers, but the range is only even integers. There is no integer \(n\) such that \(2n = 3\).
What is the composition \((g \circ f)(x)\) if \(f(x) = x^2\) and \(g(x) = x + 1\)?
\[(g \circ f)(x) = g(f(x)) = g(x^2) = x^2 + 1\]