Composition of functions
Take two machines that transform numbers. The first machine, , eats an input and spits out . Feed that output straight into a second machine, , and out comes . Chaining functions this way — output of one becomes input of the next — is composition of functions, written . It sits in the NCERT Relations and Functions chapter right after one-one and onto functions. A quick scope note before you invest time here: under the current CBSE Class 12 syllabus (2025-26), composition of functions is not examinable — it was rationalised down to informal, non-formative treatment in Class 11. It still appears in the printed textbook and in older question banks, so it's covered here for completeness and because it quietly underpins ideas like inverse functions. Treat what follows as background reading rather than exam-critical prep; your marks in this chapter come from types of relations and one-one/onto functions.
The composite chains two functions so the output of the inner one feeds the outer one, and — because order changes which function acts first — and are generally different functions with possibly different domains.
The core idea
Given two functions and , the codomain of must match the domain of for the composite to be defined. The composite function is defined by
where: is the inner function (applied first), is the outer function (applied second), is the domain of , is the shared codomain-of-/domain-of-, and is the codomain of . Read from right to left: "first , then ." A few facts worth carrying forward without formal proof:
- Not commutative. and are generally different functions — sometimes one of the two isn't even defined.
- Associative. whenever every composite involved is defined, so a chain of three functions can be bracketed either way.
- Preserves one-one and onto. If and are both one-one, is one-one; if both are onto, is onto.
The picture below shows the chain of sets and how a single input threads through both machines.
The domain of a composite function
Knowing the composite formula is half the story — the harder, exam-style subtlety is figuring out where it is actually valid. A wrong guess here is the single most common slip in this topic, so it deserves a careful derivation: we work out the general rule that pins down the domain of any composite function , showing why simply intersecting the domains of and separately is not enough, and why you must instead trace which outputs of the inner function are allowed to land inside the outer function's domain.
Step 1. Start from the definition . For the right-hand side to even be computable, two things must independently hold — must exist, and then must accept the value produces.
Step 2. The first requirement is simply that lies in the domain of , since otherwise is not defined and there is nothing to feed forward.
Step 3. The second requirement is that the output , not itself, must lie in the domain of . This is the step people skip: they check whether is a valid input to , but never sees directly — it only ever sees .
Step 4. Combining both conditions gives the domain of the composite as . This set can be smaller than the domain of alone (extra values get filtered out by the second condition) but it can never contain any outside the domain of (the first condition is a hard floor). Applying this to with domain and with domain : every real passes Step 2, but Step 3 demands , i.e. , so the composite domain shrinks to .
Worked example
Let with domain , and with domain — the same pair used above. Earlier we found with domain . Now find and its domain, and compare.
Step 1. Apply the definition with as the inner function: .
Step 2. Substitute into : .
Step 3. Find the domain using the rule from the derivation. First, must lie in the domain of , so . Second, the output must lie in the domain of , which is all of — so this second condition places no extra restriction.
Step 4. The domain of is therefore just , unlike the domain of , which was the smaller set . So with domain , while with domain — same two functions, opposite order, genuinely different formulas and different domains. This is the clearest possible illustration that composition is not commutative in either its rule or its domain.
Common traps
- Writing but computing instead of — the function on the right of always acts first.
- Assuming ; as the worked example shows, both the formula and the domain can differ.
- Checking whether is a valid input to the outer function instead of checking whether the inner function's output is a valid input to it — this is the exact mistake Step 3 of the derivation guards against.
- Forgetting that the composite's domain can never exceed the inner function's domain, even if the algebra after simplification looks defined everywhere.
Ask the tutor: Want to see how composition sets up the definition of an inverse function, or try a few more domain-of-composite problems? Ask the AI tutor to work through them with you.
Why does the codomain of f have to match the domain of g for g∘f to make sense
Because literally feeds the output of into . If can produce a value that has no rule for, is meaningless for that . In practice, for real-valued functions this usually just means checking that the outputs actually produces land inside wherever is defined — exactly the domain-of-composite rule from the derivation above.
Is composition of functions the same as multiplying two functions together
No — multiplying gives , a single new value formed by multiplying two numbers, while composing gives , where one function's output becomes the other's input. They can even have different domains: multiplication only needs both and to exist, while composition additionally needs to be an acceptable input for .
If this topic is not examinable in CBSE Class 12, why bother learning it well
Two reasons. First, some schools, coaching materials and older question banks still use it, so recognising it avoids confusion. Second, it is the quiet backbone of ideas you'll meet if you continue with mathematics — inverse functions are defined using composition (), and later topics in calculus and beyond routinely chain functions together, so a working intuition here pays off even without direct exam marks.