One of the most powerful ideas in Class 12 Maths Chapter 1 is the composition of functions — chaining two functions so that the output of one becomes the input of the other. It underpins invertible functions and appears in both CBSE board questions and entrance exams like CUET and IPMAT.
What Is Composition of Functions?
Let f : A → B and g : B → C be two functions. The composition g ∘ f (read “g of f”), also written gof, is a function from A to C defined by:
gof(x) = g(f(x)), for all x ∈ A
First apply f to x (producing f(x) in B), then apply g to that result (producing g(f(x)) in C).
A ──f──► B ──g──► C
x ──► f(x) ──► g(f(x))
└─────── gof ─────────────►A Worked Example
Let f : {2, 3, 4, 5} → {3, 4, 5, 9} and g : {3, 4, 5, 9} → {7, 11, 15} with:
f(2) = 3, f(3) = 4, f(4) = f(5) = 5 g(3) = g(4) = 7, g(5) = g(9) = 11
Computing gof at each input:
-
gof(2) = g(f(2)) = g(3) = 7
-
gof(3) = g(f(3)) = g(4) = 7
-
gof(4) = g(f(4)) = g(5) = 11
-
gof(5) = g(f(5)) = g(5) = 11
So gof = {(2, 7), (3, 7), (4, 11), (5, 11)}. Notice that gof can be many-one even when the individual functions behave well.
gof vs fog — Order Matters
Composition is not commutative in general: gof and fog are usually different functions.
Proof by Example
Let f(x) = cos x and g(x) = 3x², both from R to R.
-
gof(x) = g(cos x) = 3cos²x
-
fog(x) = f(3x²) = cos(3x²)
At x = 0: gof(0) = 3(1)² = 3, but fog(0) = cos(0) = 1.
Since 3 ≠ 1, gof ≠ fog. One counterexample is sufficient to disprove commutativity.
When gof = fog
This equality holds in the important special case where g = f⁻¹ — the inverse of f — in which case gof = I_X and fog = I_Y (the identity functions). It can also hold for specific function pairs, but this is the exception, not the rule.
Key Properties of Composition
1. Associativity For functions f : A → B, g : B → C, h : C → D:
h ∘ (g ∘ f) = (h ∘ g) ∘ f
You can bracket compositions in any order without changing the result.
2. Identity Function For any function f and the appropriate identity function I:
f ∘ I = f and I ∘ f = f
3. Preserving Injectivity and Surjectivity If f and g are both one-one, then gof is one-one. If both are onto, then gof is onto. Consequently, the composition of two bijections is a bijection.
4. Inverse of a Composition If f and g are both invertible (bijective):
(g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹
The inverse of a composition reverses the order — a result that mirrors the rule for matrix inverses.
Composition and Invertibility
A function f : X → Y is invertible if and only if there exists g : Y → X such that:
gof = I_X and fog = I_Y
This is the formal definition of an inverse, expressed using composition. When you find f⁻¹(y) = (y − 3)/4 for f(x) = 4x + 3, you are finding the unique g satisfying both conditions above.
This connection makes composition the natural language for all invertibility problems in Chapter 1.
Exam Strategy: gof and fog Questions
Board papers typically ask you to compute both gof and fog and show they differ. The most efficient approach:
-
Compute gof(x) = g(f(x)) — substitute f(x) into g.
-
Compute fog(x) = f(g(x)) — substitute g(x) into f.
-
Evaluate both at a convenient point (often x = 0) to find a value where they differ.
One counterexample is all you need.
Related Reading on ChampionsPrep
🎯 Practice Makes Perfect
Composition questions reward students who have seen many examples. Get targeted practice with instant AI-powered solutions on ChampionsPrep .
Practise Composition of Functions on ChampionsPrep →
Test Your Knowledge

Composition of Functions in Class 12 Maths – gof, fog, and Key Properties
Frequently Asked Questions
What does gof mean in maths? +
gof is the composition of functions g and f. It means: first apply f, then apply g to the result. Formally, gof(x) = g(f(x)).
Is composition of functions commutative? +
No. In general, gof ≠ fog. With f(x) = cos x and g(x) = 3x², gof(0) = 3 but fog(0) = 1, proving they are not equal.
What is the domain of gof? +
The domain of gof is the set of all x in the domain of f such that f(x) lies in the domain of g.
When does gof = fog? +
Most importantly, when g is the inverse of f, giving gof = I_X and fog = I_Y. It may hold for specific pairs but is not generally true.
Is the composition of two bijections always a bijection? +
Yes. If f and g are both bijective, then gof is bijective, and its inverse is (gof)⁻¹ = f⁻¹ ∘ g⁻¹.
AI-powered practice — free to start
