Introduction to Composition

Composition is the process of applying one function to the result of another. It's like an assembly line 🏭 where the output of one machine becomes the input for the next.

If we have two functions, ff and gg, the composition of ff with gg (denoted as fgf \circ g) is a new function that maps an element from the domain of gg directly to an element in the codomain of ff.

1. Composition of Functions

Let f:ABf: A \to B and g:BCg: B \to C be two functions. The composition of f and g, denoted by gfg \circ f (read as "g composed with f" or "g of f"), is a new function that maps an element from set A directly to an element in set C.

(gf)(x)=g(f(x)),for all xA(g \circ f)(x) = g(f(x)), \quad \text{for all } x \in A

  • How it works: To find (gf)(x)(g \circ f)(x), you first compute the inner function f(x)f(x), and then you use that result as the input for the outer function gg.

  • Condition for Existence: For the composition gfg \circ f to be defined, the range of f must be a subset of the domain of g. In our factory analogy, this means the parts produced by the first machine (ff) must fit into the second machine (gg).

  • Non-Commutative: The order of composition matters. In general, fggff \circ g \ne g \circ f.

Example: Let f(x)=x2f(x) = x^2 and g(x)=2x+3g(x) = 2x+3.

  • (gf)(x)=g(f(x))=g(x2)=2(x2)+3=2x2+3(g \circ f)(x) = g(f(x)) = g(x^2) = 2(x^2)+3 = \mathbf{2x^2+3}.
  • (fg)(x)=f(g(x))=f(2x+3)=(2x+3)2=4x2+12x+9(f \circ g)(x) = f(g(x)) = f(2x+3) = (2x+3)^2 = \mathbf{4x^2+12x+9}.

As you can see, (gf)(x)(fg)(x)(g \circ f)(x) \ne (f \circ g)(x).


2. Invertible Functions

A function is invertible if we can define an "undo" operation that takes any output and maps it back to its original input. This "undo" function is called the inverse, denoted by f1f^{-1}.

f(x)=y    f1(y)=xf(x) = y \iff f^{-1}(y) = x

  • Condition for Invertibility: A function f:ABf: A \to B is invertible if and only if it is a bijective function (i.e., it must be both one-one and onto).

    • Why One-one? For the inverse to be a function, each output must map back to a single, unique input. If the original function were many-one, its inverse would have to map one input to multiple outputs, which violates the definition of a function.
    • Why Onto? For the inverse to be defined for every element in its domain (which is the codomain of ff), the original function's range must be equal to its codomain. If ff is 'into', there would be elements in the inverse's domain with nowhere to map to.
  • Properties of Inverse Functions:

    • If ff is invertible, then f1f^{-1} is also bijective.
    • The domain of f1f^{-1} is the range (codomain) of ff.
    • The range of f1f^{-1} is the domain of ff.
    • (f1)1=f(f^{-1})^{-1} = f.
    • (gf)1=f1g1(g \circ f)^{-1} = f^{-1} \circ g^{-1} (the "socks and shoes" rule - you undo the last operation first).
  • Graphical Property: The graph of y=f1(x)y=f^{-1}(x) is the reflection of the graph of y=f(x)y=f(x) across the line y=xy=x.


3. How to Find the Inverse of a Function ↔️

To find the inverse of a function f(x)f(x) algebraically:

  1. Check for Bijectivity: First, verify that the function is both one-one and onto in its given domain and codomain.
  2. Replace f(x) with y: Write the equation as y=f(x)y = f(x).
  3. Swap x and y: Interchange the variables xx and yy in the equation. This is the key step that represents the inversion.
  4. Solve for y: Make yy the subject of the new equation. This new expression for yy is the inverse function, f1(x)f^{-1}(x).

Example: Find the inverse of the bijective function f(x)=2x+1x3f(x) = \frac{2x+1}{x-3}.

  1. Replace f(x) with y: y=2x+1x3y = \frac{2x+1}{x-3}.

  2. Swap x and y: x=2y+1y3x = \frac{2y+1}{y-3}.

  3. Solve for y:

    x(y3)=2y+1x(y-3) = 2y+1

    xy3x=2y+1xy - 3x = 2y+1

    xy2y=3x+1xy - 2y = 3x+1

    y(x2)=3x+1y(x - 2) = 3x+1

    y=3x+1x2y = \frac{3x+1}{x-2}.

  4. State the Inverse: f1(x)=3x+1x2f^{-1}(x) = \frac{3x+1}{x-2}.

Example 1: Finding Compositions

Question: Let f(x)=xf(x) = |x| and g(x)=[x]g(x) = [x] (Greatest Integer Function). Find (gf)(2.5)(g \circ f)(-2.5) and (fg)(3.7)(f \circ g)(3.7).

Explanation: Function composition (gf)(x)(g \circ f)(x) means we apply the inner function ff first, and then apply the outer function gg to the result.

Part 1: Find (gf)(2.5)(g \circ f)(-2.5)

  1. Evaluate the inner function: First, find f(2.5)f(-2.5). f(2.5)=2.5=2.5f(-2.5) = |-2.5| = 2.5.

  2. Evaluate the outer function: Now, use the result from step 1 as the input for gg.

    (gf)(2.5)=g(f(2.5))=g(2.5)=[2.5]=2(g \circ f)(-2.5) = g(f(-2.5)) = g(2.5) = [2.5] = 2.

Part 2: Find (fg)(3.7)(f \circ g)(3.7)

  1. Evaluate the inner function: First, find g(3.7)g(3.7).

    g(3.7)=[3.7]=3g(3.7) = [3.7] = 3.

  2. Evaluate the outer function: Now, use the result from step 1 as the input for ff.

    (fg)(3.7)=f(g(3.7))=f(3)=3=3(f \circ g)(3.7) = f(g(3.7)) = f(3) = |3| = 3.

Example 2: Proving a Function is Bijective

Question: Show that the function f:RRf: \mathbb{R} \to \mathbb{R} defined by f(x)=4x+3f(x)=4x+3 is bijective.

Explanation: A function is bijective if it is both one-one (injective) and onto (surjective).

1. Check for One-one (Injective): We must show that if f(x1)=f(x2)f(x_1) = f(x_2), then x1=x2x_1 = x_2.

  • Assume f(x1)=f(x2)f(x_1) = f(x_2).
  • 4x1+3=4x2+34x_1+3 = 4x_2+3
  • 4x1=4x24x_1 = 4x_2
  • x1=x2x_1 = x_2. Since the condition holds, the function is one-one.

2. Check for Onto (Surjective): We must show that for any yy in the codomain R\mathbb{R}, there exists a pre-image xx in the domain R\mathbb{R} such that f(x)=yf(x)=y.

  • Let y=4x+3y = 4x+3.
  • Solve for xx: y3=4x    x=y34y-3 = 4x \implies x = \frac{y-3}{4}.
  • For any real number yy, the expression y34\frac{y-3}{4} produces a valid real number xx. Thus, every element in the codomain has a pre-image.
  • The function is onto.

Conclusion: Since f is both one-one and onto, it is bijective.

Example 3: Finding the Inverse of a Linear Function

Question: Find the inverse of the function f(x)=4x+3f(x)=4x+3.

Explanation: From the previous example, we know this function is bijective, so an inverse exists.

  1. Replace f(x)f(x) with y: y=4x+3y = 4x+3.
  2. Swap the variables x and y: x=4y+3x = 4y+3.
  3. Solve for the new y: x3=4yx-3 = 4y y=x34y = \frac{x-3}{4}.
  4. State the inverse function: The new expression for y is the inverse function, f1(x)f^{-1}(x). f1(x)=x34f^{-1}(x) = \frac{x-3}{4}

Example 4: Finding the Inverse of a Rational Function

Question: Let f:R{2}R{1}f: \mathbb{R}-\{2\} \to \mathbb{R}-\{1\} be defined by f(x)=x1x2f(x) = \frac{x-1}{x-2}. Find its inverse.

Explanation: We assume the function is bijective as defined by its specific domain and codomain.

  1. Replace f(x)f(x) with y: y=x1x2y = \frac{x-1}{x-2}.
  2. Swap x and y: x=y1y2x = \frac{y-1}{y-2}.
  3. Solve for y:
    • x(y2)=y1x(y-2) = y-1
    • xy2x=y1xy - 2x = y-1
    • xyy=2x1xy - y = 2x - 1
    • y(x1)=2x1y(x-1) = 2x - 1
    • y=2x1x1y = \frac{2x-1}{x-1}.
  4. State the inverse function: f1(x)=2x1x1f^{-1}(x) = \frac{2x-1}{x-1}

Example 5: Composition of a Function and its Inverse

Question: Let f(x)=4x+3f(x)=4x+3. Verify that (ff1)(x)=x(f \circ f^{-1})(x) = x.

Explanation: An important property of inverse functions is that composing a function with its inverse (in either order) results in the identity function, I(x)=xI(x)=x.

  1. Recall the Functions:

    • f(x)=4x+3f(x) = 4x+3
    • From Example 3, we know f1(x)=x34f^{-1}(x) = \frac{x-3}{4}.
  2. Perform the Composition: (ff1)(x)=f(f1(x))(f \circ f^{-1})(x) = f(f^{-1}(x)) This means we substitute the entire expression for f1(x)f^{-1}(x) into the 'x' of f(x)f(x).

    f(x34)=4(x34)+3f\left(\frac{x-3}{4}\right) = 4\left(\frac{x-3}{4}\right) + 3.

  3. Simplify: The '4's cancel out: (x3)+3=x(x-3) + 3 = x.

Conclusion: We have verified that (ff1)(x)=x(f \circ f^{-1})(x) = x.

Example 6: Finding Inverse of a Quadratic Function

Question: Let f:[0,)[4,)f: [0, \infty) \to [4, \infty) be a function defined by f(x)=x2+4f(x)=x^2+4. Find the inverse of f.

Explanation: 1. Check Bijectivity:

  • The standard function f(x)=x2f(x)=x^2 is many-one. However, by restricting the domain to [0,)[0, \infty), we ensure that no two x-values produce the same y-value, making it one-one.
  • The range of x2+4x^2+4 on this domain is [4,)[4, \infty), which is equal to the given codomain. This makes the function onto.

Since the function is bijective on the given domain/codomain, an inverse exists.

2. Find the Inverse:

  • Set y=f(x): y=x2+4y = x^2+4.
  • Swap x and y: x=y2+4x = y^2+4.
  • Solve for y: y2=x4    y=±x4y^2 = x-4 \implies y = \pm\sqrt{x-4}.

3. Choose the Correct Root: The range of the inverse function, f1f^{-1}, must be the domain of the original function, ff. The domain of ff was given as [0,)[0, \infty). Therefore, the output of our inverse function (yy) must be non-negative. To ensure this, we must choose the positive root.

y=+x4y = +\sqrt{x-4}.

Answer: f1(x)=x4f^{-1}(x) = \sqrt{x-4}.

Example 6: Finding Inverse of a Quadratic Function

Question: Let f:[0,)[4,)f: [0, \infty) \to [4, \infty) be a function defined by f(x)=x2+4f(x)=x^2+4. Find the inverse of f.

Explanation: 1. Check Bijectivity:

  • The standard function f(x)=x2f(x)=x^2 is many-one. However, by restricting the domain to [0,)[0, \infty), we ensure that no two x-values produce the same y-value, making it one-one.
  • The range of x2+4x^2+4 on this domain is [4,)[4, \infty), which is equal to the given codomain. This makes the function onto. Since the function is bijective on the given domain/codomain, an inverse exists.

2. Find the Inverse:

  • Set y=f(x): y=x2+4y = x^2+4.
  • Swap x and y: x=y2+4x = y^2+4.
  • Solve for y: y2=x4    y=±x4y^2 = x-4 \implies y = \pm\sqrt{x-4}.

3. Choose the Correct Root: The range of the inverse function, f1f^{-1}, must be the domain of the original function, ff. The domain of ff was given as [0,)[0, \infty). Therefore, the output of our inverse function (yy) must be non-negative. To ensure this, we must choose the positive root. y=+x4y = +\sqrt{x-4}.

Answer: f1(x)=x4f^{-1}(x) = \sqrt{x-4}.

Example 7: Composition with Itself

Question: If f(x)=11xf(x) = \frac{1}{1-x}, find (fff)(x)(f \circ f \circ f)(x).

Explanation: We solve this by composing the function in stages.

Stage 1: Calculate (ff)(x)(f \circ f)(x)

(ff)(x)=f(f(x))=f(11x)(f \circ f)(x) = f(f(x)) = f\left(\frac{1}{1-x}\right).

Substitute this into the function's definition: f(11x)=1111x=1(1x)11x=1xx=x1xf\left(\frac{1}{1-x}\right) = \frac{1}{1 - \frac{1}{1-x}} = \frac{1}{\frac{(1-x)-1}{1-x}} = \frac{1-x}{-x} = \frac{x-1}{x}

Stage 2: Calculate (fff)(x)(f \circ f \circ f)(x)

This is the same as f((ff)(x))f( (f \circ f)(x) ). We use the result from Stage 1 as the input.

f(x1x)=11x1x=1x(x1)x=xxx+1=x1=xf\left(\frac{x-1}{x}\right) = \frac{1}{1 - \frac{x-1}{x}} = \frac{1}{\frac{x-(x-1)}{x}} = \frac{x}{x-x+1} = \frac{x}{1} = x

Answer: (fff)(x)=x(f \circ f \circ f)(x) = x.

Example 8: Finding Domain of a Composition

Question: Let f(x)=xf(x) = \sqrt{x} and g(x)=x2g(x) = x-2. Find the domain of fgf \circ g.

Explanation: 1. Define the Composite Function:

(fg)(x)=f(g(x))=f(x2)=x2(f \circ g)(x) = f(g(x)) = f(x-2) = \sqrt{x-2}.

2. Determine the Condition for the Domain: The expression x2\sqrt{x-2} is defined in the real numbers only if the quantity inside the square root is non-negative.

Condition: x20x-2 \ge 0.

3. Solve the Inequality: x2x \ge 2.

Formal Approach: The domain of fgf \circ g is the set of all xx in the domain of gg such that the output g(x)g(x) is in the domain of ff.

  • Domain of g(x)=x2g(x)=x-2 is R\mathbb{R}.
  • Domain of f(x)=xf(x)=\sqrt{x} is [0,)[0, \infty).
  • We need the output of gg, which is x2x-2, to be in the domain of ff. So, x2[0,)x-2 \in [0, \infty), which means x20x-2 \ge 0. This gives x2x \ge 2.

Answer: The domain is [2,)[2, \infty).

Example 9: Finding a Value in a Composition

Question: If f(x)=x21f(x)=x^2-1 and g(x)=2x+1g(x)=2x+1, find a value of x for which (fg)(x)=(gf)(x)(f \circ g)(x) = (g \circ f)(x).

Explanation: 1. Calculate (fg)(x)(f \circ g)(x):

(fg)(x)=f(g(x))=f(2x+1)=(2x+1)21(f \circ g)(x) = f(g(x)) = f(2x+1) = (2x+1)^2-1 =(4x2+4x+1)1=4x2+4x= (4x^2+4x+1)-1 = 4x^2+4x

2. Calculate (gf)(x)(g \circ f)(x): (gf)(x)=g(f(x))=g(x21)=2(x21)+1(g \circ f)(x) = g(f(x)) = g(x^2-1) = 2(x^2-1)+1 =2x22+1=2x21= 2x^2-2+1 = 2x^2-1

3. Set the Expressions Equal and Solve: 4x2+4x=2x214x^2+4x = 2x^2-1 2x2+4x+1=02x^2+4x+1 = 0 This is a quadratic equation. We use the quadratic formula x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2-4ac}}{2a} Here, a=2,b=4,c=1a=2, b=4, c=1. x=4±424(2)(1)2(2)=4±1684=4±84=4±224x = \frac{-4 \pm \sqrt{4^2-4(2)(1)}}{2(2)} = \frac{-4 \pm \sqrt{16-8}}{4} = \frac{-4 \pm \sqrt{8}}{4} = \frac{-4 \pm 2\sqrt{2}}{4} x=1±22x = -1 \pm \frac{\sqrt{2}}{2}.

Answer: Two possible values are 1+22-1 + \frac{\sqrt{2}}{2} and 122-1 - \frac{\sqrt{2}}{2}.

Example 10: Inverse of a Bijective Piecewise Function

Question: Find the inverse of the function f(x)={x,x<1x2,1x4f(x) = \begin{cases} x, & x < 1 \\ x^2, & 1 \le x \le 4 \end{cases}.

Explanation: We find the inverse for each piece separately, paying close attention to the domains and ranges.

1. Analyze the First Piece:

  • Function: y=xy=x for the domain (,1)(-\infty, 1).
  • Range: For this domain, the range is also (,1)(-\infty, 1).
  • Inverse: Swapping xx and yy gives x=yx=y, so f1(x)=xf^{-1}(x)=x. The domain of this inverse piece is the range of the original piece, so this is valid for x<1x < 1.

2. Analyze the Second Piece:

  • Function: y=x2y=x^2 for the domain [1,4][1, 4].
  • Range: For this domain, the range is [12,42]=[1,16][1^2, 4^2] = [1, 16].
  • Inverse: Swapping xx and yy gives x=y2x=y^2, so y=±xy=\pm\sqrt{x}. Since the range of the inverse must be the domain of the original ([1,4][1,4]), we choose the positive root. So, f1(x)=xf^{-1}(x)=\sqrt{x}. The domain of this inverse piece is the range of the original piece, so this is valid for 1x161 \le x \le 16.

3. Combine the Inverse Pieces: We combine the results from each part to define the complete inverse function.

Answer: f1(x)={x,x<1x,1x16f^{-1}(x) = \begin{cases} x, & x < 1 \\ \sqrt{x}, & 1 \le x \le 16 \end{cases}