In short
If g: A \to B and f: B \to C, the composite f \circ g: A \to C is injective precisely when g is injective and f is injective on the range of g. The composite is surjective precisely when f is surjective. A composite can be injective even if f is not, and surjective even if g is not — the key is how the two functions interact, not their individual types alone.
Suppose your school assigns each student to a house (Agni, Vayu, Jal, Prithvi), and each house has a fixed jersey colour (red, blue, green, yellow). Student \to house \to colour gives a composite function from students to colours.
If two students are in different houses, they get different colours — the composite is injective. But what if two houses share a colour? Then students in those houses collide at the colour stage, even though they were separated at the house stage. And what if no house maps to green? Then green is unreachable — the composite is not surjective.
The question this article answers: when you chain two functions, which properties of the individual functions survive the chain, and which can break?
The setup
Throughout this article, g: A \to B and f: B \to C are functions, and the composite is f \circ g: A \to C, defined by (f \circ g)(x) = f(g(x)).
When is f \circ g injective?
The main theorem
Injectivity of a composite
f \circ g is injective if and only if g is injective and f is injective on the range of g (that is, f restricted to g(A) is injective).
In practice, the cleanest sufficient condition is: if both f and g are injective, then f \circ g is injective.
Here is the proof. Suppose (f \circ g)(x_1) = (f \circ g)(x_2). This means f(g(x_1)) = f(g(x_2)). Since f is injective, g(x_1) = g(x_2). Since g is injective, x_1 = x_2. So equal outputs force equal inputs, and f \circ g is injective.
The converse direction is more nuanced. If f \circ g is injective, what can you say about f and g individually?
Claim 1: If f \circ g is injective, then g must be injective.
Proof: Suppose g(x_1) = g(x_2). Then f(g(x_1)) = f(g(x_2)), so (f \circ g)(x_1) = (f \circ g)(x_2). Since f \circ g is injective, x_1 = x_2. So g is injective.
Claim 2: If f \circ g is injective, f need not be injective (on all of B).
A concrete example makes this clear. Take A = \{1, 2\}, B = \{a, b, c\}, C = \{p, q\}. Define g(1) = a, g(2) = b. Define f(a) = p, f(b) = q, f(c) = p. The composite f \circ g sends 1 \mapsto p and 2 \mapsto q — injective. But f is not injective: f(a) = f(c) = p. The collision in f happens at c, which is outside the range of g, so the composite never encounters it.
Summary for injectivity
| What you know | What you can conclude |
|---|---|
| g injective and f injective | f \circ g injective |
| f \circ g injective | g is injective (but f might not be) |
| g not injective | f \circ g is not injective, no matter what f is |
The last row follows because if g(x_1) = g(x_2) for some x_1 \neq x_2, then f(g(x_1)) = f(g(x_2)), so the composite has a collision too. A non-injective g poisons the composite — the collision at stage one carries through.
When is f \circ g surjective?
The main theorem
Surjectivity of a composite
f \circ g is surjective if and only if f is surjective and g hits enough of B so that f, restricted to g(A), still covers all of C. The cleanest sufficient condition: if both f and g are surjective, then f \circ g is surjective.
Proof: Take any c \in C. Since f is surjective, there exists b \in B with f(b) = c. Since g is surjective, there exists a \in A with g(a) = b. Then (f \circ g)(a) = f(g(a)) = f(b) = c. So every element of C is reached by the composite.
Now the converse questions.
Claim 3: If f \circ g is surjective, then f must be surjective.
Proof: Take any c \in C. Since f \circ g is surjective, there exists a \in A with f(g(a)) = c. Set b = g(a) \in B. Then f(b) = c. So every c \in C has a preimage under f.
Claim 4: If f \circ g is surjective, g need not be surjective.
Take A = \{1, 2, 3\}, B = \{a, b, c\}, C = \{p, q\}. Define g(1) = a, g(2) = a, g(3) = b. The range of g is \{a, b\} — missing c, so g is not surjective. Define f(a) = p, f(b) = q, f(c) = p. The composite sends 1 \mapsto p, 2 \mapsto p, 3 \mapsto q. Every element of C = \{p, q\} is hit — the composite is surjective even though g is not.
Summary for surjectivity
| What you know | What you can conclude |
|---|---|
| f surjective and g surjective | f \circ g surjective |
| f \circ g surjective | f is surjective (but g might not be) |
| f not surjective | f \circ g is not surjective, no matter what g is |
The last row holds because if some c \in C has no preimage under f, then certainly no element of A can reach c through f \circ g, since the composite must pass through f.
The full picture
Combining both results:
If both f and g are bijective, then f \circ g is bijective. (Injective + surjective gives bijective on each side; both properties transfer.)
If f \circ g is bijective, then g is injective and f is surjective. (From Claims 1 and 3 above. But g need not be surjective and f need not be injective.)
The asymmetry makes sense if you think about the pipeline. Injectivity is about avoiding collisions. The first function g is where collisions can originate — if g merges two inputs, no amount of care from f can separate them again. Surjectivity is about covering the target. The last function f is the gatekeeper — if f cannot reach some element of C, no choice of g can fix that.
Two worked examples
Example 1: Algebraic functions on $\mathbb{R}$
Let g: \mathbb{R} \to \mathbb{R} be g(x) = 2x + 1 and f: \mathbb{R} \to \mathbb{R} be f(x) = x^2.
Step 1. Find the composite.
Why: apply g first, then feed the result into f. The composite is a quadratic.
Step 2. Is g injective? Suppose g(x_1) = g(x_2): 2x_1 + 1 = 2x_2 + 1, so x_1 = x_2. Yes, g is injective.
Why: a linear function with non-zero slope is always injective.
Step 3. Is f injective? f(1) = f(-1) = 1. No — f is not injective.
Why: squaring loses the sign, creating collisions between positive and negative inputs.
Step 4. Is f \circ g injective? (2x_1 + 1)^2 = (2x_2 + 1)^2 implies 2x_1 + 1 = \pm(2x_2 + 1). Taking x_1 = 0 gives f \circ g(0) = 1. Taking x_2 = -1 gives f \circ g(-1) = (-1)^2 = 1. Two distinct inputs, same output. So the composite is not injective.
Why: even though g is injective, f creates a collision between g(0) = 1 and g(-1) = -1, since f(1) = f(-1). The collision in f occurs within the range of g, so it survives into the composite.
Step 5. Is f \circ g surjective? The range of (2x+1)^2 is [0, \infty), not all of \mathbb{R}. For example, -3 is never an output. So the composite is not surjective. Since f is not surjective (f(x) = x^2 has range [0, \infty)), this aligns with our theorem: a non-surjective f means the composite cannot be surjective.
Result: f \circ g is neither injective nor surjective (many-one into).
The graph confirms both failures: the horizontal line at y = 1 hits two points (not injective), and no part of the curve dips below the x-axis (not surjective onto \mathbb{R}).
Example 2: Finite sets
Let A = \{1, 2, 3\}, B = \{a, b, c\}, C = \{p, q, r\}. Define:
Step 1. Compute the composite.
Why: trace each element through both stages. 1 \to a \to p, 2 \to b \to q, 3 \to c \to r.
Step 2. Check injectivity of g. All three outputs a, b, c are distinct. g is injective.
Why: no element of B appears twice in the output list.
Step 3. Check injectivity of f. All three outputs p, q, r are distinct. f is injective.
Step 4. Check injectivity of f \circ g. The outputs p, q, r are all distinct. f \circ g is injective. This confirms the theorem: both injective implies composite injective.
Step 5. Check surjectivity. g hits \{a, b, c\} = B — surjective. f hits \{p, q, r\} = C — surjective. And f \circ g hits \{p, q, r\} = C — surjective.
Result: Both f and g are bijective, so f \circ g is bijective. The composite is a perfect one-to-one pairing between A and C.
Now modify f to f(a) = p, f(b) = p, f(c) = r. The composite becomes (f \circ g)(1) = p, (f \circ g)(2) = p, (f \circ g)(3) = r — not injective (1 and 2 collide at p) and not surjective (q is never reached). Breaking f's injectivity created a collision; breaking f's surjectivity created a gap. Both failures propagate to the composite.
Common confusions
-
"If the composite is injective, both components must be injective." False. Only g must be injective. The function f can have collisions outside the range of g without affecting the composite.
-
"If the composite is surjective, both components must be surjective." False. Only f must be surjective. The function g can miss parts of B, as long as f still covers all of C using what g does provide.
-
"Injectivity and surjectivity transfer symmetrically." They do not. Injectivity is a property of the first stage (g), because that is where collisions originate. Surjectivity is a property of the last stage (f), because that is the gatekeeper to the codomain C. The asymmetry is fundamental, not accidental.
-
"A composite of two non-injective functions is always non-injective." True, actually. If g is not injective, the composite inherits the collision, regardless of f. This one is correct — be careful not to dismiss it as a misconception.
-
"You need both f and g bijective for f \circ g to be bijective." As a sufficient condition, yes. But f \circ g can be bijective even if neither component is bijective on the full sets as declared — it depends on the interplay of their ranges and domains. The sufficient condition (both bijective) is the standard tool for problem-solving.
Going deeper
If the forward and reverse implications above are comfortable, and you can construct counterexamples for the false converses, you are ready for the next chapter on inverses. The rest of this section collects sharper statements.
Left-cancellative and right-cancellative
A function g: A \to B is called left-cancellative if f_1 \circ g = f_2 \circ g implies f_1 = f_2 for all functions f_1, f_2: B \to C. This holds if and only if g is injective. Intuitively: an injective g does not lose information, so you can tell f_1 and f_2 apart by their behaviour on the range of g.
A function f: B \to C is called right-cancellative if f \circ g_1 = f \circ g_2 implies g_1 = g_2 for all functions g_1, g_2: A \to B. This holds if and only if f is surjective... no, that is the wrong direction. Right-cancellative requires f to be injective. Left-cancellative for g requires g to be surjective when g appears on the right.
The precise statements: g is injective if and only if it is left-cancellative. f is surjective if and only if it is right-cancellative.
A counting perspective
For finite sets with |A| = m, |B| = n, |C| = k:
- If f \circ g is injective, then m \le k (since injective functions cannot map a larger set into a smaller one). Since g: A \to B is forced to be injective, m \le n. So m \le \min(n, k).
- If f \circ g is surjective, then m \ge k (since surjective functions require the domain to be at least as large as the codomain). Since f: B \to C is forced to be surjective, n \ge k. So both m \ge k and n \ge k.
Interactive: building a composite
Pick arrow mappings for g and f in the diagram below. The composite arrows update automatically. Watch how collisions in g propagate, and how gaps in f's coverage create gaps in the composite.
Where this leads next
You now know exactly when a composite inherits injectivity and surjectivity from its components — and what you can deduce about the components when the composite has these properties.
- Inverse Functions — a function has an inverse precisely when it is bijective. The theorems from this article tell you when a composite is bijective, and therefore when it is invertible.
- Composite Functions — the mechanics of composition itself: how to compute f \circ g, the order of application, and associativity.
- Types of Functions — the classification of individual functions as one-one, onto, bijective, or many-one into.
- Functions — Definition and Notation — the foundation: what a function is, domain, codomain, range.
- Direct Proof — the proof technique used throughout this article: assume the hypothesis, derive the conclusion.