Composition of Functions

Definition 1.4.1. Let f: XY and g: YZ be two functions. Then the function gf: XZ given by

(gf) (x) = g(f(x))

is called the composition of the function f and g.  □

gf reads as g composed with f, or as f followed by g.

Example 1.4.2. Consider the functions f : ℤ ⟶ ℤ and g: ℚ ⟶ ℚ, given by f(x) = 2x/3 ∀ x ∈ ℤ and g(x) = x2x ∈ ℚ. Observe that gf : ℤ ⟶ ℚ is given by (gf) (x) = g(f(x)) = g(2x/3) = 4x2/9 ∀ x ∈ ℤ. But fg is not defined as for example 1/4 ∈ ℚ, g(1/4) = 1/16 ∉ ℤ and hence f(1/16) makes no sense. The reason for this is that Im(g) ⊈ D(f). ■

Example 1.4.3. Consider the functions f : ℤ ⟶ ℤ and g: ℤ ⟶ ℤ, defined by f(n) = (−1)n, n ∈ ℤ and g(n) = 2n, n ∈ ℤ. Then gf: ℤ ⟶ ℤ is given by (gf)(n) = g(f(n)) = g((−1)n) = 2(−1)n, n ∈ ℤ, i.e. (gf)(n) = 2 or −2, according as n is even or odd. Observe that, here one may define as well (fg)(n) = f(g(n)) = f(2n) = (−1)2n, n ∈ ℤ, i.e. (fg)(n) = 1, ∀n ∈ ℤ. This example shows that gffg in general, even when both are defined, i.e. composition of functions is noncommutative.  ■

Exanoke 1.4.4. Let f(x) = x2 and g(x) = sin (x). The composite function gf is

h(x) = g[f(x)] = sin(x2)

Since g is well-defined over all ℝ, also h is. The function k = fg is also well defined by the relation

k(x) = f[g(x)] = [sin(x)]2  ■

A basic fact about functional composition is that it satisfies the associative law. First let us agree that two functions f and g are to be considered equal − in symbols f = g if they have the same domain and codomain and if f(g) = g(x) for all x.

Theorem 1.4.5. Let f: XY, g: UV and h: RS be functions such tha Im(h) is contained in U and Im(g) is contained in X. Then

f ∘ (gh) = (fg) ∘ h

Proof. First observe that the various composited in the formula make sense; this is is because of the assumptions about Im(h) and Im(g). Let x be an element of X. Then, by the definition of a compositive,

f ∘ (gh) = f((gg)(x)) = f(g(h(x))

In a similar manner we find that (fh) ∘ h(x) is also equal to this element. Therefore f ∘ (gh) = (fg) ∘ h, as claimed.  □

Another basic result asserts that a function is unchanged when it is composed with an identity function.

Theorem 1.4.6. If f: XY is any function, then f ∘ 1X = f = 1Yf.

Proof. Left as an exercise.  □

«Functions Index Inverse Function »