Composition of Functions
In mathematics, the composition of functions is a fundamental operation that allows us to combine two or more functions to create a new function. It's like nesting functions within each other. When we compose functions, the output of one function becomes the input for another. This concept is crucial for understanding more complex mathematical ideas and is frequently tested in competitive exams like JEE Main.
Definition of Composition of Functions
Let's consider two functions, say $f$ and $g$. The composition of $f$ with $g$, denoted as $f \circ g$, is a function that takes an input $x$, applies $g$ to $x$ first, and then applies $f$ to the result of $g(x)$.
Mathematically, this is expressed as:
$(f \circ g)(x) = f(g(x))$
For this composition to be defined, the range of the function $g$ must be a subset of the domain of the function $f$. In simpler terms, the output values that $g$ can produce must be valid input values for $f$.
Understanding the Order of Operations
It is extremely important to remember that the order in which functions are composed matters. Generally, $f \circ g$ is not the same as $g \circ f$.
$(f \circ g)(x) = f(g(x))$
$(g \circ f)(x) = g(f(x))$
Let's illustrate this with an example:
Suppose $f(x) = x^2$ and $g(x) = x + 1$.
Then, $(f \circ g)(x) = f(g(x)) = f(x+1) = (x+1)^2$.
And, $(g \circ f)(x) = g(f(x)) = g(x^2) = x^2 + 1$.
Clearly, $(x+1)^2 \neq x^2 + 1$ for most values of $x$. This confirms that the order of composition is significant.
Conditions for Composition
For the composition of two functions, $f \circ g$, to exist, the following condition must be met:
Domain($f \circ g$) = { $x \in$ Domain($g$) | $g(x) \in$ Domain($f$) }
In essence, every input $x$ must first be a valid input for $g$, and the output $g(x)$ must then be a valid input for $f$.
Properties of Composite Functions
Composition of functions exhibits several important properties:
1. Associativity
If we have three functions $f$, $g$, and $h$, and their compositions are defined, then the composition is associative. This means:
$(f \circ g) \circ h = f \circ (g \circ h)$
This property allows us to group the functions in any order when composing three or more functions, simplifying calculations.
2. Identity Function
The identity function, denoted by $I(x) = x$, plays a special role in function composition. When composed with any function $f$, it leaves $f$ unchanged:
$f \circ I = f$ and $I \circ f = f$
Here, $I$ can be the identity function on the domain of $f$ or the codomain of $f$, depending on which side it's composed.
3. Composition and Invertibility
If a function $f$ has an inverse function $f^{-1}$, then composing $f$ with its inverse results in the identity function:
$f \circ f^{-1} = I$ and $f^{-1} \circ f = I$
This is a direct consequence of the definition of an inverse function.
4. Composition and Injectivity/Surjectivity
- If $f$ and $g$ are both injective (one-to-one) functions, then their composition $f \circ g$ is also injective.
- If $f$ and $g$ are both surjective (onto) functions, then their composition $f \circ g$ is also surjective.
- Consequently, if $f$ and $g$ are both bijective (both injective and surjective) functions, then $f \circ g$ is also bijective.
Examples of Function Composition
Example 1: Basic Composition
Let $f(x) = 2x + 3$ and $g(x) = x^2$. Find $(f \circ g)(x)$ and $(g \circ f)(x)$.
Solution:
To find $(f \circ g)(x)$:
$(f \circ g)(x) = f(g(x))$
Substitute $g(x)$ into $f(x)$:
$f(g(x)) = f(x^2) = 2(x^2) + 3 = 2x^2 + 3$.
To find $(g \circ f)(x)$:
$(g \circ f)(x) = g(f(x))$
Substitute $f(x)$ into $g(x)$:
$g(f(x)) = g(2x+3) = (2x+3)^2$.
We can expand $(2x+3)^2$ to $4x^2 + 12x + 9$.
As expected, $(f \circ g)(x) = 2x^2 + 3$ and $(g \circ f)(x) = 4x^2 + 12x + 9$ are different.
Example 2: Domain and Range Considerations
Let $f(x) = \sqrt{x}$ and $g(x) = x - 5$. Find $(f \circ g)(x)$ and determine its domain.
Solution:
First, let's find the composition $(f \circ g)(x)$:
$(f \circ g)(x) = f(g(x)) = f(x-5) = \sqrt{x-5}$.
Now, let's consider the domain.
The domain of $g(x) = x - 5$ is all real numbers ($\mathbb{R}$).
The domain of $f(x) = \sqrt{x}$ is $x \ge 0$.
For $(f \circ g)(x) = f(g(x))$ to be defined, $x$ must be in the domain of $g$, and $g(x)$ must be in the domain of $f$.
So, $x \in \mathbb{R}$ (which is always true) and $g(x) \ge 0$.
This means $x - 5 \ge 0$, which implies $x \ge 5$.
Therefore, the domain of $(f \circ g)(x) = \sqrt{x-5}$ is $[5, \infty)$.
Example 3: Composition with Rational Functions
Let $f(x) = \frac{1}{x}$ and $g(x) = \frac{x+1}{x-2}$. Find $(f \circ g)(x)$ and its domain.
Solution:
First, find the composition:
$(f \circ g)(x) = f(g(x)) = f\left(\frac{x+1}{x-2}\right) = \frac{1}{\frac{x+1}{x-2}} = \frac{x-2}{x+1}$.
Now, let's determine the domain.
The domain of $g(x) = \frac{x+1}{x-2}$ requires $x-2 \neq 0$, so $x \neq 2$. The domain of $g$ is $\mathbb{R} \setminus \{2\}$.
The domain of $f(x) = \frac{1}{x}$ requires $x \neq 0$.
For $(f \circ g)(x)$ to be defined, $x$ must be in the domain of $g$ (i.e., $x \neq 2$), and $g(x)$ must be in the domain of $f$ (i.e., $g(x) \neq 0$).
So, we need $g(x) = \frac{x+1}{x-2} \neq 0$. This implies $x+1 \neq 0$, so $x \neq -1$.
Combining the conditions, $x$ cannot be $2$ (from the domain of $g$) and $x$ cannot be $-1$ (from the condition $g(x) \neq 0$).
Therefore, the domain of $(f \circ g)(x) = \frac{x-2}{x+1}$ is $\mathbb{R} \setminus \{2, -1\}$.
Composition of More Than Two Functions
We can extend the concept of composition to three or more functions. For example, the composition of $f$, $g$, and $h$ can be written as $(f \circ g \circ h)(x)$. Due to the associative property, we can group them as $(f \circ g) \circ h$ or $f \circ (g \circ h)$.
$(f \circ g \circ h)(x) = f(g(h(x)))$
To evaluate this, we start from the innermost function, $h(x)$, then apply $g$ to its result, and finally apply $f$ to that result.
Example 4: Composition of Three Functions
Let $f(x) = x+1$, $g(x) = 2x$, and $h(x) = x^2$. Find $(f \circ g \circ h)(x)$.
Solution:
We need to find $f(g(h(x)))$.
Start with the innermost function, $h(x) = x^2$.
Next, apply $g$ to $h(x)$: $g(h(x)) = g(x^2) = 2(x^2) = 2x^2$.
Finally, apply $f$ to the result $2x^2$: $f(g(h(x))) = f(2x^2) = (2x^2) + 1 = 2x^2 + 1$.
So, $(f \circ g \circ h)(x) = 2x^2 + 1$.
Composition with Piecewise Functions
Composition can also involve piecewise functions. When composing with a piecewise function, you need to consider how the input values fall into different intervals defined by the piecewise function and apply the correct piece.
Example 5: Composition with a Piecewise Function
Let $f(x) = |x|$ and $g(x) = \begin{cases} x+1 & \text{if } x \ge 0 \\ 2x & \text{if } x < 0 \end{cases}$. Find $(f \circ g)(x)$.
Solution:
We need to find $f(g(x))$. The definition of $g(x)$ depends on whether $x \ge 0$ or $x < 0$. We must consider these two cases separately.
Case 1: $x \ge 0$
If $x \ge 0$, then $g(x) = x+1$.
Now, we apply $f$ to $g(x)$: $f(g(x)) = f(x+1) = |x+1|$.
Since $x \ge 0$, $x+1$ will always be positive ($x+1 \ge 1$). Therefore, $|x+1| = x+1$.
So, for $x \ge 0$, $(f \circ g)(x) = x+1$.
Case 2: $x < 0$
If $x < 0$, then $g(x) = 2x$.
Now, we apply $f$ to $g(x)$: $f(g(x)) = f(2x) = |2x|$.
Since $x < 0$, $2x$ will always be negative ($2x < 0$). Therefore, $|2x| = -(2x) = -2x$.
So, for $x < 0$, $(f \circ g)(x) = -2x$.
Combining both cases, the composite function is:
$(f \circ g)(x) = \begin{cases} x+1 & \text{if } x \ge 0 \\ -2x & \text{if } x < 0 \end{cases}$
Composition and Inverse Functions
Understanding the relationship between composition and inverse functions is crucial. If $f: A \to B$ and $g: B \to C$ are invertible functions, then their compositions are also invertible.
The inverse of the composition $(g \circ f)$ is $(g \circ f)^{-1} = f^{-1} \circ g^{-1}$.
Let's verify this. We know that $(g \circ f)^{-1}$ is the function such that $(g \circ f) \circ (g \circ f)^{-1} = I$ (identity function).
Consider $(f^{-1} \circ g^{-1})$. Let's compose it with $(g \circ f)$:
$(g \circ f) \circ (f^{-1} \circ g^{-1})$
Using associativity:
$g \circ (f \circ f^{-1}) \circ g^{-1}$
Since $f \circ f^{-1} = I$ (identity on the appropriate domain/codomain):
$g \circ I \circ g^{-1}$
Since $g \circ I = g$:
$g \circ g^{-1}$
And $g \circ g^{-1} = I$ (the identity function).
Thus, $(f^{-1} \circ g^{-1})$ is indeed the inverse of $(g \circ f)$.
Example 6: Inverse of a Composite Function
Let $f(x) = 2x$ and $g(x) = x+3$. Find the inverse of $(g \circ f)(x)$.
Solution:
First, find the composite function $(g \circ f)(x)$:
$(g \circ f)(x) = g(f(x)) = g(2x) = (2x) + 3 = 2x + 3$.
Let $y = 2x + 3$. To find the inverse, swap $x$ and $y$ and solve for $y$:
$x = 2y + 3$
$x - 3 = 2y$
$y = \frac{x-3}{2}$
So, $(g \circ f)^{-1}(x) = \frac{x-3}{2}$.
Now, let's use the property $(g \circ f)^{-1} = f^{-1} \circ g^{-1}$.
Find the inverse of $f(x) = 2x$:
Let $y = 2x$. Swap $x$ and $y$: $x = 2y$. Solve for $y$: $y = \frac{x}{2}$.
So, $f^{-1}(x) = \frac{x}{2}$.
Find the inverse of $g(x) = x+3$:
Let $y = x+3$. Swap $x$ and $y$: $x = y+3$. Solve for $y$: $y = x-3$.
So, $g^{-1}(x) = x-3$.
Now, compute $f^{-1} \circ g^{-1}$:
$(f^{-1} \circ g^{-1})(x) = f^{-1}(g^{-1}(x)) = f^{-1}(x-3)$.
Substitute $(x-3)$ into $f^{-1}(x) = \frac{x}{2}$:
$f^{-1}(x-3) = \frac{x-3}{2}$.
This matches the result obtained by finding the inverse of the composite function directly.
Common Pitfalls to Avoid
- Confusing $f \circ g$ with $g \circ f$: Always write out $f(g(x))$ and $g(f(x))$ to ensure you are applying the functions in the correct order.
- Ignoring Domain Restrictions: The domain of the composite function is not simply the domain of the "outer" function or the "inner" function. It's the set of all $x$ in the domain of the inner function such that the output of the inner function is in the domain of the outer function.
- Errors in Algebraic Simplification: Especially when dealing with square roots, fractions, or exponents, be meticulous with your algebra.
- Misapplying Inverse Properties: Remember that $(f \circ g)^{-1} = g^{-1} \circ f^{-1}$, not $f^{-1} \circ g^{-1}$.
Summary Table of Composition Rules
| Operation | Notation | Definition | Condition |
|---|---|---|---|
| Composition of $f$ with $g$ | $f \circ g$ | $(f \circ g)(x) = f(g(x))$ | Range($g$) $\subseteq$ Domain($f$) |
| Composition of $g$ with $f$ | $g \circ f$ | $(g \circ f)(x) = g(f(x))$ | Range($f$) $\subseteq$ Domain($g$) |
| Associativity | $(f \circ g) \circ h = f \circ (g \circ h)$ | $f(g(h(x)))$ | Compositions must be defined |
| Inverse of Composition | $(g \circ f)^{-1}$ | $f^{-1} \circ g^{-1}$ | $f$ and $g$ must be invertible |