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›Function Composition
    Discrete StructuresTopic 26 of 67

    Function Composition

    10 minread
    1,746words
    Intermediatelevel

    Function Composition

    Function composition is the process of combining two or more functions to create a new function. If we have two functions f:A→Bf: A \to Bf:A→B and g:B→Cg: B \to Cg:B→C, their composition, denoted (g∘f)(g \circ f)(g∘f), is a function from set AAA to set CCC, defined by:

    (g∘f)(x)=g(f(x))for all x∈A.(g \circ f)(x) = g(f(x)) \quad \text{for all } x \in A.(g∘f)(x)=g(f(x))for all x∈A.

    This means that you first apply the function fff to xxx, and then apply the function ggg to the result of f(x)f(x)f(x).


    1. Formal Definition of Function Composition

    Let f:A→Bf: A \to Bf:A→B and g:B→Cg: B \to Cg:B→C be two functions. The composition of fff and ggg, denoted as g∘fg \circ fg∘f, is a function from AAA to CCC defined by:

    (g∘f)(x)=g(f(x))for all x∈A.(g \circ f)(x) = g(f(x)) \quad \text{for all } x \in A.(g∘f)(x)=g(f(x))for all x∈A.

    Here, f(x)f(x)f(x) produces an element in BBB, and then g(f(x))g(f(x))g(f(x)) produces an element in CCC.


    2. Composition of Functions and Their Domains

    For the composition g∘fg \circ fg∘f to be defined:

    • The codomain of fff, i.e., the set BBB, must match the domain of ggg, i.e., the set BBB must be a subset of the domain of ggg.
    • Therefore, the result of f(x)f(x)f(x) must always lie within the domain of ggg.

    3. Example of Function Composition

    Let’s consider two functions:

    • f:R→Rf: \mathbb{R} \to \mathbb{R}f:R→R, defined by f(x)=2x+1f(x) = 2x + 1f(x)=2x+1,
    • g:R→Rg: \mathbb{R} \to \mathbb{R}g:R→R, defined by g(x)=x2g(x) = x^2g(x)=x2.

    To find (g∘f)(x)(g \circ f)(x)(g∘f)(x), we first apply f(x)f(x)f(x) and then apply ggg to the result of f(x)f(x)f(x):

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

    Thus, the composition g∘fg \circ fg∘f is:

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

    4. Properties of Function Composition

    Function composition has several important properties that are useful in mathematical proofs and problem-solving:

    a. Associativity

    Function composition is associative, meaning that if we have three functions f:A→Bf: A \to Bf:A→B, g:B→Cg: B \to Cg:B→C, and h:C→Dh: C \to Dh:C→D, then:

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

    This property allows us to compose multiple functions without worrying about the grouping of functions.

    b. Identity Function

    The identity function idA\text{id}_AidA​ on a set AAA is the function that maps every element to itself. It has the property that for any function f:A→Bf: A \to Bf:A→B:

    f∘idA=fandidB∘f=f.f \circ \text{id}_A = f \quad \text{and} \quad \text{id}_B \circ f = f.f∘idA​=fandidB​∘f=f.

    Thus, composing a function with the identity function leaves the original function unchanged.

    c. Non-Commutativity

    Function composition is not commutative, meaning that in general:

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

    In other words, the order in which we apply the functions matters. Changing the order can lead to different results.


    5. Composing Functions with Different Domains and Codomains

    If the functions f:A→Bf: A \to Bf:A→B and g:B→Cg: B \to Cg:B→C are composed, we are guaranteed that the domain of fff is AAA, and the codomain of ggg is CCC. However, sometimes you might want to compose functions with different domains and codomains:

    Example:

    Let’s say f:A→Bf: A \to Bf:A→B and g:C→Dg: C \to Dg:C→D are two functions with different domains and codomains. In order to compose them, you need to find a suitable domain and codomain such that composition is valid. This is less common but can occur in specialized contexts.


    6. Inverse Functions and Composition

    If fff is a bijection, meaning it is both injective (one-to-one) and surjective (onto), it has an inverse function f−1:B→Af^{-1}: B \to Af−1:B→A. The composition of a function with its inverse satisfies:

    f−1∘f=idAandf∘f−1=idB.f^{-1} \circ f = \text{id}_A \quad \text{and} \quad f \circ f^{-1} = \text{id}_B.f−1∘f=idA​andf∘f−1=idB​.

    This shows that the inverse function "undoes" the operation of the original function, essentially returning the original input.


    7. Example of Composing with an Inverse

    Let’s take an example where f:R→Rf: \mathbb{R} \to \mathbb{R}f:R→R is defined by f(x)=3x+4f(x) = 3x + 4f(x)=3x+4, and its inverse function is f−1(x)=x−43f^{-1}(x) = \frac{x - 4}{3}f−1(x)=3x−4​.

    • Composition with the inverse: f−1∘f(x)f^{-1} \circ f(x)f−1∘f(x): f−1(f(x))=f−1(3x+4)=(3x+4)−43=x.f^{-1}(f(x)) = f^{-1}(3x + 4) = \frac{(3x + 4) - 4}{3} = x.f−1(f(x))=f−1(3x+4)=3(3x+4)−4​=x.
    • Composition in the opposite direction: f∘f−1(x)f \circ f^{-1}(x)f∘f−1(x): f(f−1(x))=f(x−43)=3(x−43)+4=x.f(f^{-1}(x)) = f\left( \frac{x - 4}{3} \right) = 3\left( \frac{x - 4}{3} \right) + 4 = x.f(f−1(x))=f(3x−4​)=3(3x−4​)+4=x.

    In both cases, the result is just xxx, confirming that the composition of a function with its inverse gives the identity function.


    8. Real-World Applications of Function Composition

    Function composition is widely used in many areas, including:

    • Mathematics: In calculus, when dealing with transformations, mappings, or solving equations.
    • Computer Science: In functional programming, where functions are combined and manipulated to build complex algorithms.
    • Physics: In modeling complex systems where multiple processes or phenomena are combined (e.g., transformations in space and time).
    • Economics: To model the impact of multiple variables and their interactions (e.g., cost functions, demand functions, etc.).

    Conclusion

    Function composition is a fundamental concept in mathematics that allows the combination of functions to create new ones. It is essential for building more complex relationships between variables, solving problems, and understanding how different mathematical structures interact. Function composition is associative, involves inverse functions, and has important applications in various fields such as mathematics, computer science, and economics.

    Previous topic 25
    Special Types of Functions
    Next topic 27
    Inverse Functions

    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 time10 min
      Word count1,746
      Code examples0
      DifficultyIntermediate