girgit.org

Relations and Functions

One function after another: composition of functions

The big ideaIf f takes A to B and g takes B to C, the composition g∘f (NCERT writes gof) does f first and then g: \( (g \circ f)(x) = g(f(x)) \), and changing the order usually changes the answer.

In simple words

Making lemonade: first squeeze the lemons, then add sugar and water. The juice from step one is what step two works on. Joining two steps like this gives one bigger step that goes straight from lemons to lemonade. Doing the steps in the other order, adding sugar to whole lemons and then squeezing, gives something quite different.

Doing one function, then another

Let f : A → B and g : B → C. The composition of f and g is the function \( g \circ f : A \to C \) given by

\[ (g \circ f)(x) = g\big(f(x)\big) \quad \text{for every } x \in A. \]

Read it from the inside out: f acts first, then g acts on f's output. NCERT writes it without the small circle, as gof; both mean the same. The co-domain of f must sit inside the domain of g, or g would be handed outputs it can't use.

Worked example: arrows

f : {1, 2, 3, 4} → {a, b, c} with f(1) = a, f(2) = f(3) = b, f(4) = c. g : {a, b, c} → {5, 10} with g(a) = 10, g(b) = 5, g(c) = 10. Follow each arrow, then the next:

  • (g∘f)(1) = g(a) = 10
  • (g∘f)(2) = g(b) = 5, and (g∘f)(3) = g(b) = 5
  • (g∘f)(4) = g(c) = 10

So g∘f : {1, 2, 3, 4} → {5, 10} sends 1, 4 to 10 and 2, 3 to 5. Here f∘g makes no sense at all: g's outputs 5 and 10 are not in f's domain.

Order matters

Take f, g : \( \mathbf{R} \to \mathbf{R} \) with f(x) = x + 2 and g(x) = x².

  • \( (g \circ f)(x) = g(x + 2) = (x + 2)^2 \): add 2, then square.
  • \( (f \circ g)(x) = f(x^2) = x^2 + 2 \): square, then add 2.

At x = 1: \( (g \circ f)(1) = 9 \) but \( (f \circ g)(1) = 3 \). So \( g \circ f \neq f \circ g \). With f(x) = sin x and g(x) = 2x: \( (g \circ f)(x) = 2\sin x \) and \( (f \circ g)(x) = \sin 2x \), which differ at \( x = \frac{\pi}{2} \) (2 against 0). Composition is not commutative.

Try it: guess first, then swap the machines and drag x along both curves.

When are two functions equal?

To claim \( g \circ f = f \circ g \) (or that any two functions are equal) you need the same domain, the same co-domain, and the same output for every input. Two different formulas can still give equal functions: on A = {0, 1}, f(x) = x² and g(x) = x agree at both points, so f = g on A.

What composition does to one-one and onto

Not in the current textbook, but JEE asks it: older NCERT editions proved these, and JEE still uses them.

  1. Associative: \( h \circ (g \circ f) = (h \circ g) \circ f \). Doing f, then g, then h gives the same result however you bracket it.
  2. Identity: with \( I_X(x) = x \), \( f \circ I_X = f \) and \( I_Y \circ f = f \) for f : X → Y.
  3. If f and g are both one-one, so is \( g \circ f \): different inputs stay different through both steps.
  4. If f and g are both onto, so is \( g \circ f \): any z in C comes from some y in B, which comes from some x in A.
  5. So the composition of two bijections is a bijection.
  6. Going backwards: if \( g \circ f \) is one-one, then f is one-one; if \( g \circ f \) is onto, then g is onto. The other function need not be. Example: A = {1}, B = {1, 2}, C = {1}, f(1) = 1, g(1) = g(2) = 1. Then \( g \circ f \) is a bijection of {1}, yet f is not onto and g is not one-one.

Try it: guess first, then wire f and g yourself and check every pair at once.

Don't mix these up

  • g∘f means f first. The function written nearer to x acts first.
  • g∘f can exist while f∘g does not, and when both exist they are usually different.
  • From "g∘f is one-one" conclude f is one-one, not g. From "g∘f is onto" conclude g is onto, not f.

Try it. f(x) = 3x − 1 and g(x) = x² + 1 on \( \mathbf{R} \). Find \( (g \circ f)(x) \), \( (f \circ g)(x) \) and \( (f \circ f)(2) \).

Answer
\( (g \circ f)(x) = (3x - 1)^2 + 1 = 9x^2 - 6x + 2 \). \( (f \circ g)(x) = 3(x^2 + 1) - 1 = 3x^2 + 2 \). \( f(2) = 5 \), so \( (f \circ f)(2) = f(5) = 14 \).

Words to know

Composition g∘f (gof)
Do f, then do g to the result.
Identity function \( I_X \)
Leaves every element of X where it is: \( I_X(x) = x \).
Commutative
Order doesn't matter; composition is not.
Associative
Brackets don't matter; composition is.
Equal functions
Same domain, same co-domain, same output at every input.

f(x) = 2x and g(x) = x − 3 on \( \mathbf{R} \). What is \( (g \circ f)(5) \)?

  1. 4
  2. 7
  3. 20

If f(x) = x² and g(x) = x + 1 on \( \mathbf{R} \), which is \( (f \circ g)(x) \)?

  1. \( x^2 + 1 \)
  2. \( (x + 1)^2 \)
  3. \( x^2(x + 1) \)

f : A → B and g : B → C, and g∘f is onto. What must be true?

  1. f is onto
  2. g is onto
  3. g is one-one