The Timpson Lyceum · Discrete Math (2025)
Functions and Function Composition - Lecture 12 (Discrete Math)
Functions and Function Composition – Lecture 12
Overview
This lecture builds the formal, set-theoretic definition of a function as a special kind of relation, then develops the language we use to describe and combine functions. We define domain and image, the notation , and what it means for to be a function from one set to another. From there we count how many functions exist between finite sets, classify functions as one-to-one, onto, or bijections, and connect one-to-one-ness to invertibility. Finally we introduce function composition, prove it is associative (but not commutative), and examine identity functions and how an inverse undoes its function. These ideas underpin nearly all later work with mappings, so the goal is to recognize the familiar algebra-class function as nothing more than an (often infinite) set of ordered pairs with a special property.
Key Concepts
Relation vs. function. A relation is just a set of ordered pairs. A relation is a function provided that whenever and , we must have . In words: every left-hand element is paired with exactly one right-hand element. The same element may appear as a right-hand value many times, and duplicate ordered pairs collapse (sets ignore repeats), but no left-hand value may map to two different things.
Function notation. Writing is shorthand for "" — i.e., is the right-hand element paired with . This notation is only valid when is genuinely a function; do not use it for arbitrary relations. An infinite function such as is written compactly as .
Domain and image.
- Domain, — the set of all first (left-hand) elements: .
- Image, — the set of all second (right-hand) elements: . (Advanced texts say image; elementary texts say range — same thing. We use image.)
Function from to . We say provided and . Intuitively: maps everything in to something in . Leftover unused elements in are fine; leftover unmapped elements in are not. (Example: as has domain all of but image only .)
Counting functions. If and , then there are functions from to . Each of the inputs may be sent to any of the outputs independently, giving .
Inverse of a relation. The inverse swaps every ordered pair: . The inverse of a function is always a relation, but not always a function.
One-to-one (injective). is one-to-one if whenever and , then . Equivalently, equal outputs force equal inputs: . (Mnemonic: a function gives equal outputs for equal inputs; a one-to-one function additionally forces equal inputs for equal outputs.) A function is one-to-one if and only if its inverse is also a function.
Onto (surjective). is onto if — every element of is hit by something in .
Bijection. A function that is both one-to-one and onto. A bijection's inverse is itself a function.
Function composition. If and (note: must start where ends), then is defined by . You read right to left: apply first, then . Composition is not commutative ( in general) but is associative: .
Identity function. For a set , the identity maps every element to itself: . It satisfies for any .
Inverse composition. If is one-to-one, then and — the inverse undoes the function.
Worked Example
Prove that given by is a bijection.
One-to-one. Assume and derive :
Equal outputs force equal inputs, so is one-to-one.
Onto. Given any , find an input mapping to it. Take (a real number, since is closed under subtraction and nonzero division). Then:
Every real output is achieved, so is onto. Being both one-to-one and onto, is a bijection. (The choice of comes from inverting: swap in and solve, giving .)
Summary
- A function is a relation (set of ordered pairs) in which every left-hand element is paired with exactly one right-hand element; just means .
- The domain is the set of all inputs (must equal for ); the image is the set of all outputs (need only be a subset of ).
- There are functions from a set of size to a set of size .
- is one-to-one when equal outputs force equal inputs, onto when its image is all of , and a bijection when it is both; a function is one-to-one exactly when its inverse is also a function.
- Composition requires to begin where ends; it is associative and has identity functions as neutral elements, but it is not commutative.
- For a one-to-one , the inverse satisfies and ; to prove two functions equal, show they share a domain and map every input identically.