Labs ICT
โญ Pro Login

Function Composition

Learn how to compose functions and their properties.

Function Composition

If f: A โ†’ B and g: B โ†’ C, the composition g โˆ˜ f is a function from A to C defined by (g โˆ˜ f)(x) = g(f(x)).

g โˆ˜ f means: first apply f, then apply g

Example: f(x) = 2x, g(x) = x + 3
  (g โˆ˜ f)(x) = g(f(x)) = g(2x) = 2x + 3
  (f โˆ˜ g)(x) = f(g(x)) = f(x + 3) = 2(x + 3) = 2x + 6

Composition Is Not Commutative

In general, g โˆ˜ f โ‰  f โˆ˜ g. The order matters!

Example:
  f(x) = xยฒ, g(x) = x + 1
  (g โˆ˜ f)(x) = xยฒ + 1
  (f โˆ˜ g)(x) = (x + 1)ยฒ = xยฒ + 2x + 1

  g โˆ˜ f โ‰  f โˆ˜ g

Composition Is Associative

(h โˆ˜ g) โˆ˜ f = h โˆ˜ (g โˆ˜ f)

This is always true. You can compose in any grouping:
  h(g(f(x))) = (h โˆ˜ g โˆ˜ f)(x)

Properties Preserved by Composition

If f and g are both injective, then g โˆ˜ f is injective.
If f and g are both surjective, then g โˆ˜ f is surjective.
If f and g are both bijective, then g โˆ˜ f is bijective.

๐Ÿงช Quick Quiz

Given f(x) = 2x + 1 and g(x) = xยฒ, what is (f โˆ˜ g)(3)?