Composing Maps Without Losing Track of Their Domains
Composition lets us treat a sequence of maps as one map, but it is only meaningful when the outputs of the first map belong to the domain of the next. Once the maps are composed, images and inverse images can be computed in stages. The order of those stages is important: images follow the maps forward, while inverse images are taken in reverse order.
Throughout, a map \(f:X\to Y\) assigns to every \(x\in X\) a unique value \(f(x)\in Y\). For \(A\subseteq X\), its image is \(f[A]=\{f(x):x\in A\}\subseteq Y\). For \(B\subseteq Y\), its inverse image is \(f^{-1}(B)=\{x\in X:f(x)\in B\}\subseteq X\). Here \(f^{-1}(B)\) denotes an inverse image of a set; it does not require \(f\) to have an inverse map.
The shared set \(Y\) matters: \(f(x)\) must be an input that \(g\) can accept. For the usual composition \(g\circ f\), we therefore specify \(f:X\to Y\) and \(g:Y\to Z\). The value of the composite at \(x\) is \(g(f(x))\), not \(f(g(x))\). If \(X\) is empty, the composite is the unique map from the empty set to \(Z\); the defining rule has no inputs to check and is still well-defined.
The Image Formula
Proof. Both sides are subsets of \(Z\). To prove equality, we show that each side has exactly the same elements. Let \(z\in(g\circ f)[A]\). By the definition of image, there is \(x\in A\) with \(z=(g\circ f)(x)=g(f(x))\). Since \(x\in A\), the value \(f(x)\) belongs to \(f[A]\); hence \(z=g(f(x))\in g[f[A]]\). Conversely, let \(z\in g[f[A]]\). There is \(y\in f[A]\) with \(z=g(y)\). Since \(y\in f[A]\), there is \(x\in A\) with \(y=f(x)\). Therefore \(z=g(f(x))=(g\circ f)(x)\), so \(z\in(g\circ f)[A]\). The two inclusions prove the equality. If \(A=\varnothing\), both images are empty by the definition of image, so the equality holds in that case as well. \(\square\)
This formula gives a practical rule: to find the image of a subset under a composite, find its image under \(f\) first, then take the image of that result under \(g\). The intermediate set lies in \(Y\), where \(g\) is defined.
Worked Example: Images Under Two Real Maps
Let \(f:\mathbb{R}\to\mathbb{R}\) be \(f(x)=2x-1\), and let \(g:\mathbb{R}\to\mathbb{R}\) be \(g(y)=y^2\). Find \(g\circ f\) and the image of \(A=[0,2]\) under the composite.
For any \(x\in\mathbb{R}\), substitute \(f(x)\) into \(g\): \[ (g\circ f)(x)=g(2x-1)=(2x-1)^2. \] First find \(f[A]\). If \(0\le x\le2\), multiplying by \(2\) and subtracting \(1\) gives \(-1\le2x-1\le3\). Every value in \([-1,3]\) occurs, since for \(y\in[-1,3]\), the choice \(x=(y+1)/2\) belongs to \([0,2]\) and satisfies \(f(x)=y\). Thus \(f[A]=[-1,3]\).
Next apply \(g\) to this interval. The squares of numbers in \([-1,3]\) range from \(0\) to \(9\): all squares are nonnegative and at most \(9\), while every \(r\in[0,9]\) is obtained by taking \(y=\sqrt r\in[0,3]\subseteq[-1,3]\). Hence \(g[f[A]]=[0,9]\).
Check: the composite formula gives \((2x-1)^2\). At \(x=1/2\), its value is \(0\); at \(x=2\), its value is \(9\). For any \(x\in[0,2]\), we have \(-1\le2x-1\le3\), so \(0\le(2x-1)^2\le9\). The range is therefore exactly \([0,9]\), as the staged calculation found.
The Inverse-Image Formula
The sets in this equation have different roles. First \(g^{-1}(C)\subseteq Y\), because \(g\) maps \(Y\) to \(Z\). Then \(f^{-1}(g^{-1}(C))\subseteq X\). The order is forced by these domains: take the inverse image through \(g\), then the inverse image through \(f\).
Proof. We show that an arbitrary \(x\in X\) belongs to the left side exactly when it belongs to the right side. By the definition of inverse image, \(x\in(g\circ f)^{-1}(C)\) if and only if \((g\circ f)(x)\in C\). By the definition of composition, this is equivalent to \(g(f(x))\in C\). By the definition of \(g^{-1}(C)\), the last condition is equivalent to \(f(x)\in g^{-1}(C)\). Finally, by the definition of \(f^{-1}\), this is equivalent to \(x\in f^{-1}(g^{-1}(C))\). Thus the two sets have the same elements. If \(C=\varnothing\), no value of \(g\circ f\) lies in \(C\), and \(g^{-1}(\varnothing)=\varnothing\), so both sides are empty. \(\square\)
Unlike the image formula, the inverse-image formula does not require choosing preimages or checking that the maps are one-to-one. It follows directly from the membership condition defining inverse image.
Worked Example: A Finite Composite
Let \(X=\{a,b,c,d\}\), \(Y=\{0,1,2\}\), and \(Z=\{u,v\}\). Define \(f:X\to Y\) by \(f(a)=0\), \(f(b)=0\), \(f(c)=1\), \(f(d)=2\); define \(g:Y\to Z\) by \(g(0)=u\), \(g(1)=u\), \(g(2)=v\). Find the image of \(A=\{b,d\}\) under \(g\circ f\), and the inverse image of \(C=\{u\}\).
The composite values, computed by applying \(f\) and then \(g\), are \[ (g\circ f)(a)=u,\quad (g\circ f)(b)=u,\quad (g\circ f)(c)=u,\quad (g\circ f)(d)=v. \] For the image, \(f[A]=\{f(b),f(d)\}=\{0,2\}\). Applying \(g\) gives \(g[f[A]]=\{g(0),g(2)\}=\{u,v\}\). Directly, the composite sends \(b\) to \(u\) and \(d\) to \(v\), so \((g\circ f)[A]=\{u,v\}\), in agreement with the image formula.
For the inverse image, first compute \(g^{-1}(C)\). The elements of \(Y\) sent to \(u\) are \(0\) and \(1\), so \(g^{-1}(\{u\})=\{0,1\}\). Now take the inverse image under \(f\): \(f^{-1}(\{0,1\})=\{a,b,c\}\), since \(f(a)=0\), \(f(b)=0\), and \(f(c)=1\), while \(f(d)=2\notin\{0,1\}\). Thus \(f^{-1}(g^{-1}(C))=\{a,b,c\}\).
Check: from the four composite values listed above, exactly \(a,b,c\) are sent to \(u\). Hence \((g\circ f)^{-1}(\{u\})=\{a,b,c\}\), confirming the staged calculation.
Worked Example: Inverse Images of a Two-Point Set
Let \(f:\mathbb{R}\to\mathbb{R}\) be \(f(x)=x+2\), and \(g:\mathbb{R}\to\mathbb{R}\) be \(g(t)=3t-1\). Find \(g\circ f\), its inverse image of \(C=\{2,8\}\), and verify the inverse-image formula.
Substitution gives \((g\circ f)(x)=3(x+2)-1=3x+5\). To find the inverse image directly, solve \(3x+5=2\) and \(3x+5=8\). The first equation gives \(3x=-3\), hence \(x=-1\); the second gives \(3x=3\), hence \(x=1\). Therefore \((g\circ f)^{-1}(C)=\{-1,1\}\).
Now compute in stages. For \(g(t)=3t-1\), the equation \(3t-1=2\) gives \(t=1\), and \(3t-1=8\) gives \(t=3\). Thus \(g^{-1}(C)=\{1,3\}\). Taking the inverse image through \(f\), solve \(x+2=1\) and \(x+2=3\); these give \(x=-1\) and \(x=1\), respectively. Hence \(f^{-1}(g^{-1}(C))=\{-1,1\}\), matching the direct result.
Check: \((g\circ f)(-1)=3(-1)+5=2\), and \((g\circ f)(1)=3(1)+5=8\). These are precisely the two elements of \(C\); any \(x\) in the inverse image must solve one of those two equations, whose solutions were \(-1\) and \(1\).
Order, Domains, and a Common Pitfall
These formulas are useful in different ways. The image formula moves a subset forward through the maps, while the inverse-image formula moves a target set backward. The intermediate sets also provide a check on the types of the expressions.
| Operation | Start with | First step | Second step |
|---|---|---|---|
| Image under \(g\circ f\) | \(A\subseteq X\) | \(f[A]\subseteq Y\) | \(g[f[A]]\subseteq Z\) |
| Inverse image under \(g\circ f\) | \(C\subseteq Z\) | \(g^{-1}(C)\subseteq Y\) | \(f^{-1}(g^{-1}(C))\subseteq X\) |
Common pitfall. Reversing the order in the inverse-image formula may look plausible, especially when every set happens to be \(\mathbb{R}\), but it is not the same operation. With the maps in the preceding example, a mistaken calculation would give \(g^{-1}(f^{-1}(C))\). First \(f^{-1}(\{2,8\})=\{0,6\}\), since \(x+2=2\) gives \(x=0\) and \(x+2=8\) gives \(x=6\). Then \(g^{-1}(\{0,6\})=\{1/3,7/3\}\), since \(3t-1=0\) gives \(t=1/3\), and \(3t-1=6\) gives \(t=7/3\). This differs from the correct answer \(\{-1,1\}\). The correction is to start with the map applied last: take \(g^{-1}(C)\) first, and then take \(f^{-1}\).
Domains and codomains can catch this mistake before any arithmetic. In general, \(g^{-1}(C)\) is a subset of \(Y\), so it is a valid input to the inverse-image operation for \(f:X\to Y\). By contrast, \(f^{-1}(C)\) is not generally a valid input to \(g^{-1}\), because it is a subset of \(X\), whereas \(g^{-1}\) takes subsets of \(Z\). The reversed expression in the example was numerically writable only because all three underlying sets were \(\mathbb{R}\); its calculation still did not describe the inverse image under the composite.
Check Your Understanding
For each question, keep track of the set containing the input at every stage.
- If \(f:X\to Y\) and \(g:Y\to Z\), what are the domain and codomain of \(g\circ f\), and how is its value at \(x\in X\) defined?
- Let \(f:\mathbb{R}\to\mathbb{R}\) be \(f(x)=x-1\) and \(g:\mathbb{R}\to\mathbb{R}\) be \(g(t)=t^2\). Find \((g\circ f)(x)\) and the image of \([1,3]\).
- For the maps in question 2, find \((g\circ f)^{-1}(\{0,4\})\) by taking inverse images in stages.
- Prove directly from the definition that \((g\circ f)^{-1}(\varnothing)=\varnothing\).
- Explain why \(g^{-1}(C)\) must be computed before \(f^{-1}\) in the inverse-image formula.