ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Discrete Structures
    GE-167
    Progress0 / 67 topics
    Topics
    1. Mathematical Reasoning: Propositional and Predicate Logic2. Propositional Logic: Logical Operators3. Translations Between Symbolic Expressions and Formal English Expression4. Logical Equivalences5. Predicate Logic: Quantifiers6. Nested Quantification7. Equivalences in Predicate Logic8. Translations Between Symbolic Forms and Formal English9. Rules of Inference: Proof Methods and Strategies10. Direct Proof11. Proof by Contraposition12. Proof by Induction13. Proof by Implication14. Existence Proof15. Uniqueness Proofs16. Trivial Proofs17. Vacuous Proofs18. Sets: Notations and Set Operations19. Venn Diagrams20. Countable and Uncountable Sets21. Relations: Equivalence Relations and Partitions22. Partial Orderings23. Recurrence Relations24. Functions: Injective, Surjective, Bijective25. Special Types of Functions26. Function Composition27. Inverse Functions28. Recursive Functions29. Compositions30. Number Theory: Sequences and Series31. Counting: Inclusion and Exclusion Principle32. Pigeonhole Principle33. Permutations and Combinations34. Integers and Divisibility: Division Theorem35. Modular Arithmetic36. LCM and GCD37. Euclidean and Extended Euclidean Method38. Finding Solutions to Congruence39. Primes: Fundamental Theorem of Arithmetic40. Characterizations of Primes41. Mersenne Primes42. Induction: Weak Induction43. Strong Induction44. Recursion and Recurrences: Formulation of Recurrences45. Closed Formulas46. Counting: Product Rule and Sum Rule47. Principle of Inclusion-Exclusion48. Binomial Coefficients49. Pascal's Identity and Pascal’s Triangle50. Binomial Theorem51. Relations: Reflexive, Symmetric, Transitive, and Antisymmetric52. Equivalence Relations and Equivalence Classes53. Partial Orders54. Graph Theory: Terminologies55. Elements of Graph Theory56. Planar Graphs57. Graph Coloring58. Euler Graph59. Hamiltonian Path60. Rooted Trees61. Graph Traversals62. Handshaking Lemma and Corollary63. Special Families of Graphs64. Graph Isomorphism65. Planarity in Graphs66. Eulerian and Hamiltonian Graphs67. Trees in Graph Theory
    GE-167›Compositions
    Discrete StructuresTopic 29 of 67

    Compositions

    14 minread
    2,388words
    Intermediatelevel

    Compositions of Functions

    In mathematics, composition of functions refers to the process of combining two functions to create a new function. If you have two functions f:A→Bf: A \to Bf:A→B and g:B→Cg: B \to Cg:B→C, their composition, denoted g∘fg \circ fg∘f, is a new function that maps elements from set AAA to set CCC through the intermediate set BBB. The composition g∘fg \circ fg∘f is defined as:

    (g∘f)(x)=g(f(x)),(g \circ f)(x) = g(f(x)),(g∘f)(x)=g(f(x)),

    where f(x)f(x)f(x) is applied first, and then ggg is applied to the result of f(x)f(x)f(x). In other words, the output of f(x)f(x)f(x) becomes the input to g(x)g(x)g(x).


    1. Formal Definition of Function Composition

    Let’s consider two functions:

    • f:A→Bf: A \to Bf:A→B is a function from set AAA to set BBB,
    • g:B→Cg: B \to Cg:B→C is a function from set BBB to set CCC.

    The composition of ggg and fff, denoted by g∘fg \circ fg∘f, is defined as:

    (g∘f)(x)=g(f(x)),(g \circ f)(x) = g(f(x)),(g∘f)(x)=g(f(x)),

    where f(x)f(x)f(x) is applied first, and then g(x)g(x)g(x) is applied to the result.

    Conditions for Composition:

    • The domain of the composition g∘fg \circ fg∘f is the domain of fff, and the codomain is the codomain of ggg.
    • For g∘fg \circ fg∘f to be defined, the codomain of fff must be the same as the domain of ggg, i.e., f:A→Bf: A \to Bf:A→B and g:B→Cg: B \to Cg:B→C.

    2. Properties of Function Composition

    Several important properties govern the composition of functions. Here are some of them:

    a. Associativity of Composition

    Function composition is associative. This means that for any three functions fff, ggg, and hhh, the composition of f∘(g∘h)f \circ (g \circ h)f∘(g∘h) is the same as (f∘g)∘h(f \circ g) \circ h(f∘g)∘h:

    f∘(g∘h)=(f∘g)∘h.f \circ (g \circ h) = (f \circ g) \circ h.f∘(g∘h)=(f∘g)∘h.

    This property allows for multiple compositions to be grouped in any way without changing the result.

    b. Identity Function

    The identity function III on a set AAA is a function that always returns the same value as its input, i.e., I(x)=xI(x) = xI(x)=x for all x∈Ax \in Ax∈A. The identity function has a special property with respect to composition:

    f∘I=fandI∘f=f.f \circ I = f \quad \text{and} \quad I \circ f = f.f∘I=fandI∘f=f.

    That is, composing any function fff with the identity function leaves fff unchanged.

    c. Composition is not Commutative

    In general, function composition is not commutative, meaning that the order of composition matters:

    g∘f≠f∘g.g \circ f \neq f \circ g.g∘f=f∘g.

    For example, if f(x)=x+1f(x) = x + 1f(x)=x+1 and g(x)=x2g(x) = x^2g(x)=x2, then:

    (g∘f)(x)=g(f(x))=(x+1)2,(g \circ f)(x) = g(f(x)) = (x + 1)^2,(g∘f)(x)=g(f(x))=(x+1)2, (f∘g)(x)=f(g(x))=x2+1.(f \circ g)(x) = f(g(x)) = x^2 + 1.(f∘g)(x)=f(g(x))=x2+1.

    Clearly, (x+1)2≠x2+1(x + 1)^2 \neq x^2 + 1(x+1)2=x2+1, so g∘f≠f∘gg \circ f \neq f \circ gg∘f=f∘g.


    3. Examples of Function Composition

    Let’s explore some concrete examples to better understand the composition of functions.

    Example 1: Basic Composition

    Consider two functions:

    f(x)=2x+3andg(x)=x2.f(x) = 2x + 3 \quad \text{and} \quad g(x) = x^2.f(x)=2x+3andg(x)=x2.

    The composition g∘fg \circ fg∘f is:

    (g∘f)(x)=g(f(x))=g(2x+3)=(2x+3)2.(g \circ f)(x) = g(f(x)) = g(2x + 3) = (2x + 3)^2.(g∘f)(x)=g(f(x))=g(2x+3)=(2x+3)2.

    So the composition g∘fg \circ fg∘f is (2x+3)2(2x + 3)^2(2x+3)2.

    Now, let’s compute f∘gf \circ gf∘g:

    (f∘g)(x)=f(g(x))=f(x2)=2x2+3.(f \circ g)(x) = f(g(x)) = f(x^2) = 2x^2 + 3.(f∘g)(x)=f(g(x))=f(x2)=2x2+3.

    Thus, the composition f∘gf \circ gf∘g is 2x2+32x^2 + 32x2+3, which is clearly different from g∘fg \circ fg∘f.

    Example 2: Identity Function Composition

    Let’s say we have the function f(x)=3x−5f(x) = 3x - 5f(x)=3x−5. The identity function I(x)=xI(x) = xI(x)=x satisfies:

    (f∘I)(x)=f(I(x))=f(x)=3x−5,(f \circ I)(x) = f(I(x)) = f(x) = 3x - 5,(f∘I)(x)=f(I(x))=f(x)=3x−5, (I∘f)(x)=I(f(x))=f(x)=3x−5.(I \circ f)(x) = I(f(x)) = f(x) = 3x - 5.(I∘f)(x)=I(f(x))=f(x)=3x−5.

    In this case, composing fff with the identity function leaves f(x)f(x)f(x) unchanged.

    Example 3: Composition with Piecewise Functions

    Let’s define two piecewise functions:

    • f(x)={x+1if x≥0,2xif x<0.f(x) = \begin{cases} x + 1 & \text{if } x \geq 0, \\ 2x & \text{if } x < 0. \end{cases}f(x)={x+12x​if x≥0,if x<0.​
    • g(x)={x2if x≥0,∣x∣if x<0.g(x) = \begin{cases} x^2 & \text{if } x \geq 0, \\ |x| & \text{if } x < 0. \end{cases}g(x)={x2∣x∣​if x≥0,if x<0.​

    Now let’s compute the compositions for x≥0x \geq 0x≥0:

    • (g∘f)(x)=g(f(x))=g(x+1)=(x+1)2(g \circ f)(x) = g(f(x)) = g(x + 1) = (x + 1)^2(g∘f)(x)=g(f(x))=g(x+1)=(x+1)2.
    • (f∘g)(x)=f(g(x))=f(x2)=x2+1(f \circ g)(x) = f(g(x)) = f(x^2) = x^2 + 1(f∘g)(x)=f(g(x))=f(x2)=x2+1.

    Thus, for x≥0x \geq 0x≥0, g∘f≠f∘gg \circ f \neq f \circ gg∘f=f∘g. The compositions give different results.


    4. Composition of More Than Two Functions

    It is possible to compose more than two functions. If you have three functions fff, ggg, and hhh, the composition h∘g∘fh \circ g \circ fh∘g∘f is defined as:

    (h∘g∘f)(x)=h(g(f(x))).(h \circ g \circ f)(x) = h(g(f(x))).(h∘g∘f)(x)=h(g(f(x))).

    Since composition is associative, you can write this as:

    h∘(g∘f).h \circ (g \circ f).h∘(g∘f).

    For example, if f(x)=2xf(x) = 2xf(x)=2x, g(x)=x+1g(x) = x + 1g(x)=x+1, and h(x)=x2h(x) = x^2h(x)=x2, the composition h∘g∘fh \circ g \circ fh∘g∘f is:

    h(g(f(x)))=h(g(2x))=h(2x+1)=(2x+1)2.h(g(f(x))) = h(g(2x)) = h(2x + 1) = (2x + 1)^2.h(g(f(x)))=h(g(2x))=h(2x+1)=(2x+1)2.

    This demonstrates that compositions can be extended to multiple functions in a straightforward manner.


    5. Applications of Function Composition

    Composition of functions is widely used in many areas of mathematics and its applications:

    • In Calculus: Composition is crucial in the chain rule for differentiating composite functions. If h(x)=g(f(x))h(x) = g(f(x))h(x)=g(f(x)), the derivative of hhh is: h′(x)=g′(f(x))⋅f′(x).h'(x) = g'(f(x)) \cdot f'(x).h′(x)=g′(f(x))⋅f′(x).
    • In Computer Science: Function composition is a common technique in programming, especially in functional programming languages where functions are often composed to build more complex functions.
    • In Probability and Statistics: Composition is used in probability theory when working with conditional probabilities, and in statistical transformations.
    • In Physics: In certain physical models, transformations of variables can be expressed using the composition of functions, such as when converting between coordinate systems.

    6. Conclusion

    The composition of functions is a fundamental operation in mathematics where two functions are combined to produce a new function. It involves applying one function to the result of another. Composition is associative but generally not commutative. Understanding how to compose functions and the properties of function composition is important in areas ranging from algebra to calculus and computer science.

    Previous topic 28
    Recursive Functions
    Next topic 30
    Number Theory: Sequences and Series

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time14 min
      Word count2,388
      Code examples0
      DifficultyIntermediate