Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Composition of Functions of Set
Two functions f: A → B and g: B → C can be composed to give a composition g o f. This is a function from A to C defined by −
(g o f)(x) = g(f(x))
In composition, the output of the first function becomes the input of the second function. The function on the right (f) is applied first, and then the function on the left (g) is applied to the result.
Example
Let f(x) = x + 2 and g(x) = 2x + 1. Find (f o g)(x) and (g o f)(x) ?
Solution
(f o g)(x) = f(g(x))
= f(2x + 1)
= (2x + 1) + 2
= 2x + 3
(g o f)(x) = g(f(x))
= g(x + 2)
= 2(x + 2) + 1
= 2x + 5
Since (f o g)(x) = 2x + 3 and (g o f)(x) = 2x + 5, we can see that (f o g)(x) ≠ (g o f)(x). This demonstrates that function composition is not commutative − the order in which functions are composed matters.
Properties of Composition
- If f and g are one-to-one (injective), then the composition (g o f) is also one-to-one.
- If f and g are onto (surjective), then the composition (g o f) is also onto.
- Composition is associative − meaning h o (g o f) = (h o g) o f for functions f, g, and h.
- Composition is not commutative − meaning g o f ≠ f o g in general, as shown in the example above.
Conclusion
Function composition combines two functions by feeding the output of one into the input of another. The key rule is (g o f)(x) = g(f(x)) − apply f first, then g. Always remember that composition is associative but not commutative.
