Math Lab
Home/Class XII/Ch 1/Composition of functions

Composition of functions

If you can map AA to BB and then BB to CC, you can map AA to CC by performing the two steps in sequence. That sequence is called the composition of the two functions, written g∘fg \circ f. Composition behaves like multiplication: it is associative, it has an identity, and on the set of bijections of any set AA to itself it even has inverses, producing what algebraists call the symmetric group SAS_A. For our purposes the immediate payoff is that composition is how we will define and verify inverse functions in the next subtopic.

Definition

Let f:A→Bf : A \to B and g:B→Cg : B \to C be functions. The composition g∘f:A→Cg \circ f : A \to C is defined by

(g∘f)(x)=g(f(x))for all x∈A.(g \circ f)(x) = g(f(x)) \quad \text{for all } x \in A.

Read g∘fg \circ f as "gg after ff". Caution: g∘fg \circ f requires the codomain of ff to be contained in the domain of gg.

Three immediate properties

Associativity. If f:A→Bf : A \to B, g:B→Cg : B \to C, h:C→Dh : C \to D, then h∘(g∘f)=(h∘g)∘f.h \circ (g \circ f) = (h \circ g) \circ f. Proof. Both sides take xx to h(g(f(x)))h(g(f(x))).

Identity. Let IA:A→AI_A : A \to A, IA(x)=xI_A(x) = x. Then for any f:A→Bf : A \to B, f∘IA=fandIB∘f=f.f \circ I_A = f \quad \text{and} \quad I_B \circ f = f.

Non-commutativity. In general f∘g≠g∘ff \circ g \neq g \circ f, even when both make sense. For f(x)=x+1f(x) = x + 1 and g(x)=2xg(x) = 2x, f(g(x))=2x+1f(g(x)) = 2x + 1 but g(f(x))=2x+2g(f(x)) = 2x + 2.

Preservation theorems

Theorem. Let f:A→Bf : A \to B and g:B→Cg : B \to C.

  1. If ff and gg are both one-one, then g∘fg \circ f is one-one.
  2. If ff and gg are both onto, then g∘fg \circ f is onto.
  3. If ff and gg are both bijective, then g∘fg \circ f is bijective.

Proof of (1). Suppose (g∘f)(x1)=(g∘f)(x2)(g \circ f)(x_1) = (g \circ f)(x_2). Then g(f(x1))=g(f(x2))g(f(x_1)) = g(f(x_2)). Since gg is one-one, f(x1)=f(x2)f(x_1) = f(x_2). Since ff is one-one, x1=x2x_1 = x_2.

Proof of (2). Let z∈Cz \in C. Since gg is onto, there is y∈By \in B with g(y)=zg(y) = z. Since ff is onto, there is x∈Ax \in A with f(x)=yf(x) = y. Then (g∘f)(x)=z(g \circ f)(x) = z. ■\blacksquare

A subtler theorem

Theorem. Let f:A→Bf : A \to B and g:B→Cg : B \to C.

  1. If g∘fg \circ f is one-one, then ff is one-one.
  2. If g∘fg \circ f is onto, then gg is onto.

Proof of (1). Suppose f(x1)=f(x2)f(x_1) = f(x_2). Apply gg: g(f(x1))=g(f(x2))g(f(x_1)) = g(f(x_2)), i.e., (g∘f)(x1)=(g∘f)(x2)(g \circ f)(x_1) = (g \circ f)(x_2). Since g∘fg \circ f is one-one, x1=x2x_1 = x_2.

Proof of (2). Let z∈Cz \in C. Since g∘fg \circ f is onto, there is xx with g(f(x))=zg(f(x)) = z. Setting y=f(x)∈By = f(x) \in B, g(y)=zg(y) = z. ■\blacksquare

Note the asymmetry: the hypothesis tells us about the outer map in one case and the inner in the other.

A common JEE trap

The converse of the above is false. g∘fg \circ f being one-one does not force gg to be one-one , only ff. Symmetrically, g∘fg \circ f onto does not force ff onto. The standard counter-example uses A={1}A = \{1\}, B={a,b}B = \{a, b\}, C={x}C = \{x\} with f(1)=af(1) = a and g(a)=g(b)=xg(a) = g(b) = x.

Worked examples

Example 1. f(x)=3x+1f(x) = 3x + 1, g(x)=x2g(x) = x^2. Find f∘gf \circ g and g∘fg \circ f.

(f∘g)(x)=f(x2)=3x2+1(f \circ g)(x) = f(x^2) = 3x^2 + 1. (g∘f)(x)=g(3x+1)=(3x+1)2=9x2+6x+1(g \circ f)(x) = g(3x + 1) = (3x + 1)^2 = 9x^2 + 6x + 1.

Example 2. f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=∣x∣f(x) = |x| and g(x)=5x−2g(x) = 5x - 2. Compute (f∘g)(3)(f \circ g)(3) and (g∘f)(−3)(g \circ f)(-3).

(f∘g)(3)=f(13)=13(f \circ g)(3) = f(13) = 13. (g∘f)(−3)=g(3)=13(g \circ f)(-3) = g(3) = 13. (Equal here by coincidence.)

Example 3. Let f(x)=11−xf(x) = \tfrac{1}{1 - x} for x≠1x \neq 1. Compute f∘ff \circ f and f∘f∘ff \circ f \circ f.

(f∘f)(x)=f(11−x)=11−11−x=1−x(1−x)−1=1−x−x=x−1x(f \circ f)(x) = f(\tfrac{1}{1 - x}) = \tfrac{1}{1 - \tfrac{1}{1 - x}} = \tfrac{1 - x}{(1 - x) - 1} = \tfrac{1 - x}{-x} = \tfrac{x - 1}{x}.

(f∘f∘f)(x)=f(x−1x)=11−x−1x=xx−(x−1)=x(f \circ f \circ f)(x) = f(\tfrac{x - 1}{x}) = \tfrac{1}{1 - \tfrac{x - 1}{x}} = \tfrac{x}{x - (x - 1)} = x.

So f3=If^3 = I on its domain. A function of period 33 under composition.

Example 4. f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x+7f(x) = x + 7. g:R→Rg : \mathbb{R} \to \mathbb{R}, g(x)=x−7g(x) = x - 7. Compute f∘gf \circ g and g∘fg \circ f.

Both equal xx, i.e., the identity. This is the prototype of an inverse pair.

Example 5. Show (g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1} for bijections ff and gg.

If ff and gg are bijections, so is g∘fg \circ f, by the preservation theorem. Compute:

(f−1∘g−1)∘(g∘f)=f−1∘(g−1∘g)∘f=f−1∘I∘f=f−1∘f=I.(f^{-1} \circ g^{-1}) \circ (g \circ f) = f^{-1} \circ (g^{-1} \circ g) \circ f = f^{-1} \circ I \circ f = f^{-1} \circ f = I.

Similarly on the other side. So f−1∘g−1f^{-1} \circ g^{-1} is the inverse of g∘fg \circ f.

The reversal of order is the most-tested formula in this chapter.

Example 6. Let f,g:R→Rf, g : \mathbb{R} \to \mathbb{R} with f(x)=sin⁡xf(x) = \sin x and g(x)=x2g(x) = x^2. Compute the four possible compositions.

(f∘g)(x)=sin⁡(x2)(f \circ g)(x) = \sin(x^2), (g∘f)(x)=(sin⁡x)2=sin⁡2x(g \circ f)(x) = (\sin x)^2 = \sin^2 x, (f∘f)(x)=sin⁡(sin⁡x)(f \circ f)(x) = \sin(\sin x), (g∘g)(x)=x4(g \circ g)(x) = x^4.

Try it yourself

  1. f(x)=2x−3,g(x)=(x+3)/2f(x) = 2x - 3, g(x) = (x + 3)/2. Compute f∘gf \circ g and g∘fg \circ f.
  2. f(x)=x2+1,g(x)=x−1f(x) = x^2 + 1, g(x) = \sqrt{x - 1}. State the domains where f∘gf \circ g and g∘fg \circ f are defined.
  3. Find a function ff with f∘f=If \circ f = I on R\mathbb{R}. (Hint: try f(x)=−xf(x) = -x or f(x)=c−xf(x) = c - x.)
  4. Prove f∘IA=ff \circ I_A = f for any f:A→Bf : A \to B.
  5. If f(x)=ax+bf(x) = ax + b, find conditions on a,ba, b so that f∘f=If \circ f = I.
  6. Let f(x)=xx−1f(x) = \tfrac{x}{x - 1} on R∖{1}\mathbb{R} \setminus \{1\}. Compute f∘ff \circ f.
  7. Show: if ff and gg both surjective from AA to AA, then g∘fg \circ f is surjective.
  8. Provide a counter-example: g∘fg \circ f surjective but ff not surjective.
  9. Compute (g∘f)(3)(g \circ f)(3) and (f∘g)(3)(f \circ g)(3) where f(x)=x+2,g(x)=x2f(x) = x + 2, g(x) = x^2.
  10. Given f:R→Rf : \mathbb{R} \to \mathbb{R} such that f(f(x))=x2+x+1f(f(x)) = x^2 + x + 1, find f(0)f(0).
  11. Prove associativity of composition rigorously by expanding each side at an arbitrary input.
  12. Find ff on R\mathbb{R} such that f∘f∘f=If \circ f \circ f = I, but f≠If \neq I.
  13. Let f,g:A→Af, g : A \to A with f∘g=IAf \circ g = I_A. Show ff is onto and gg is one-one.
  14. If f∘g=g∘ff \circ g = g \circ f for all gg, what can ff be?

Pitfalls / Tricks

  • Reading order matters: g∘fg \circ f means apply ff first, then gg. The notation reads right-to-left.
  • Composition is associative but never assume commutativity unless proved.
  • For finite sets the iteration fn=f∘f∘⋯∘ff^n = f \circ f \circ \dots \circ f (nn times) is eventually periodic; in JEE it is common to ask for f100f^{100} in disguise.
  • The reversal formula (g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1} is the same pattern as (AB)−1=B−1A−1(AB)^{-1} = B^{-1} A^{-1} for matrices, and is also a daily formula in the matrices chapter.

Once you trust composition, inverses become a one-line definition.

Test Your Knowledge

Quick MCQ check on this chapter

Start Quiz →

AI Summary

Summarize this page in your favorite LLM