Tutorials › Topology (Undergraduate) › Images and Preimages of Subsets

Sets, Functions and Relations for Topology · Tutorial 9 of 799

Images and Preimages of Subsets

Learn to compute images and preimages by checking which elements belong to the function’s domain and which values are attained.

Beginner 9 min read

What You'll Learn

  • Define the image and preimage of a subset under a function.
  • Distinguish the domain and codomain sets in each construction.
  • Compute images and preimages for a function between finite sets.
  • Find images and preimages under squaring on the integers and real line.
  • Use an affine formula to compute images and preimages of intervals.
  • Check a proposed answer by evaluating the function on its elements.

Sending Sets Forward and Pulling Them Back

A function assigns one output to each element of its domain. It can also be used to move subsets between its domain and codomain in two different ways. The image collects outputs produced by elements of a chosen domain subset. The preimage collects all domain elements whose outputs belong to a chosen codomain subset. These constructions are related, but they start with subsets of different sets.

Let \(f:X\to Y\) be a function, where \(X\) is the domain and \(Y\) is the codomain. For this tutorial the sets \(X\) and \(Y\) are considered without any topology; the definitions depend only on the function and the sets.

Definition: If \(A\subseteq X\), the image of \(A\) under \(f\) is the subset of \(Y\) $$ f[A]=\{f(x):x\in A\}. $$ If \(B\subseteq Y\), the preimage of \(B\) under \(f\) is the subset of \(X\) $$ f^{-1}[B]=\{x\in X:f(x)\in B\}. $$ The notation \(f^{-1}[B]\) denotes a preimage, not necessarily an inverse function: it is defined whether or not \(f\) has an inverse.

The brackets help keep track of the input set. An image starts with a subset \(A\) of the domain \(X\) and produces a subset of the codomain \(Y\). A preimage starts with a subset \(B\) of the codomain and produces a subset of the domain. In particular, the preimage is not made by applying an inverse function to the elements of \(B\); it is made by testing which elements of \(X\) map into \(B\).

Membership Tests

Proposition: Let \(f:X\to Y\), \(A\subseteq X\), and \(B\subseteq Y\). For \(y\in Y\) and \(x\in X\), $$ y\in f[A]\quad\text{if and only if}\quad \text{there is an }a\in A\text{ with }f(a)=y, $$ and $$ x\in f^{-1}[B]\quad\text{if and only if}\quad f(x)\in B. $$

Proof. By definition, \(f[A]\) consists exactly of values \(f(a)\) as \(a\) ranges over \(A\). Thus \(y\in f[A]\) precisely when at least one \(a\in A\) satisfies \(f(a)=y\). Also by definition, \(f^{-1}[B]\) consists exactly of those \(x\in X\) for which \(f(x)\in B\). These establish both equivalences. \(\square\)

Proposition: For \(x\in X\) and \(y\in Y\), \(f[\{x\}]=\{f(x)\}\), and $$ f^{-1}[\{y\}]=\{x\in X:f(x)=y\}. $$

Proof. The only element of \(\{x\}\) is \(x\), so the only output used to form \(f[\{x\}]\) is \(f(x)\). Therefore \(f[\{x\}]=\{f(x)\}\). For the second equality, an element \(z\) belongs to \(f^{-1}[\{y\}]\) exactly when \(z\in X\) and \(f(z)\in\{y\}\). The latter condition means \(f(z)=y\), giving precisely the set on the right. \(\square\)

The preimage of a singleton can contain no elements, one element, or several elements. The function assigns one output to each input, but distinct inputs are allowed to have the same output. The examples below use these membership tests directly.

Worked Example: A Function Between Finite Sets

Let \(X=\{a,b,c,d\}\), \(Y=\{0,1,2\}\), and define \(f:X\to Y\) by \(f(a)=1\), \(f(b)=1\), \(f(c)=0\), and \(f(d)=2\). For \(A=\{a,c,d\}\subseteq X\) and \(B=\{1,2\}\subseteq Y\), compute \(f[A]\) and \(f^{-1}[B]\).

Image. Evaluate \(f\) at each element of \(A\): $$ f(a)=1,\qquad f(c)=0,\qquad f(d)=2. $$ The set of these output values is \(\{1,0,2\}\). A set lists each element only once, so \(f[A]=\{0,1,2\}=Y\).

Preimage. Test each element of the domain against the condition \(f(x)\in B\). The outputs are \(f(a)=1\in B\), \(f(b)=1\in B\), \(f(c)=0\notin B\), and \(f(d)=2\in B\). Thus \(f^{-1}[B]=\{a,b,d\}\).

Check: The outputs of \(a,c,d\) are \(1,0,2\), so the image is exactly \(\{0,1,2\}\). The outputs of \(a,b,d\) belong to \(\{1,2\}\), while the output of \(c\) does not, confirming the preimage \(\{a,b,d\}\). Notice that \(b\) belongs to the preimage even though \(b\notin A\): the preimage is determined by \(B\), not by \(A\).

Squaring on the Integers

Worked Example: An Integer-Valued Function

Let \(f:\mathbb{Z}\to\mathbb{Z}\) be \(f(n)=n^2\). Take \(A=\{-3,-1,0,2,4\}\subseteq\mathbb{Z}\) and \(B=\{-1,0,4,9\}\subseteq\mathbb{Z}\). Compute \(f[A]\) and \(f^{-1}[B]\).

Image. Evaluate the formula at every element of \(A\): $$ f(-3)=(-3)^2=9,\quad f(-1)=(-1)^2=1,\quad f(0)=0^2=0,\quad f(2)=2^2=4,\quad f(4)=4^2=16. $$ Collecting the distinct results gives \(f[A]=\{0,1,4,9,16\}\).

Preimage. We seek integers \(n\) whose square is one of \(-1,0,4,9\). No integer has square \(-1\). The equation \(n^2=0\) gives \(n=0\); \(n^2=4\) gives \(n=-2\) or \(n=2\); and \(n^2=9\) gives \(n=-3\) or \(n=3\). Therefore $$ f^{-1}[B]=\{-3,-2,0,2,3\}. $$ The set \(A\) and the preimage are different: \(A\) asks for outputs from five specified inputs, whereas the preimage asks for every integer that maps into \(B\).

Check: The listed preimage elements give \((-3)^2=9\), \((-2)^2=4\), \(0^2=0\), \(2^2=4\), and \(3^2=9\), all in \(B\). Conversely, any integer whose square is in \(B\) must solve one of the four equations just considered, so no other integers belong to the preimage.

Images and Preimages of Real Intervals

Worked Example: Squaring on the Real Line

Let \(f:\mathbb{R}\to\mathbb{R}\) be \(f(x)=x^2\). Compute the image of \(A=[-2,1]\) and the preimage of \(B=[1,4]\). The brackets in these intervals include their endpoints.

Image. If \(x\in[-2,1]\), then \(-2\le x\le1\), so \(0\le x^2\le4\). Hence every output lies in \([0,4]\). For the reverse inclusion, let \(y\in[0,4]\). The nonnegative square root \(\sqrt y\) satisfies \(0\le\sqrt y\le2\). Set \(x=-\sqrt y\). Then \(-2\le x\le0\), so \(x\in A\), and \(f(x)=(-\sqrt y)^2=y\). Every \(y\in[0,4]\) is attained, so \(f[A]=[0,4]\).

Preimage. We need all real \(x\) such that \(x^2\in[1,4]\), or equivalently \(1\le x^2\le4\). This is equivalent to \(1\le |x|\le2\), which holds exactly when \(-2\le x\le-1\) or \(1\le x\le2\). Therefore $$ f^{-1}[B]=[-2,-1]\cup[1,2]. $$ Both endpoints of each interval are included because their squares are \(1\) or \(4\), both of which belong to \(B\).

Check: Squaring the endpoints gives \((-2)^2=4\), \((-1)^2=1\), \(1^2=1\), and \(2^2=4\), all in \(B\). If \(-1<x<1\), then \(x^2<1\); if \(x<-2\) or \(x>2\), then \(x^2>4\). Such \(x\) cannot belong to the preimage, confirming that no values outside the stated intervals are included.

Worked Example: An Affine Function on the Real Line

Let \(g:\mathbb{R}\to\mathbb{R}\) be \(g(x)=2x+1\). Compute \(g[A]\) for \(A=[-1,2]\) and \(g^{-1}[B]\) for \(B=[1,5]\).

Image. At the endpoints, \(g(-1)=2(-1)+1=-2+1=-1\), and \(g(2)=2(2)+1=4+1=5\). To check every value between them, let \(y\in[-1,5]\) and set \(x=(y-1)/2\). The inequalities \(-1\le y\le5\) give \(-2\le y-1\le4\), and division by \(2\) gives \(-1\le x\le2\). Thus \(x\in A\), and \(g(x)=2((y-1)/2)+1=y\). It follows that \(g[A]=[-1,5]\).

Preimage. Solve the membership condition \(g(x)\in[1,5]\): $$ 1\le 2x+1\le5. $$ Subtracting \(1\) gives \(0\le2x\le4\). Dividing by the positive number \(2\) gives \(0\le x\le2\), so \(g^{-1}[B]=[0,2]\).

Check: For \(x=0\), \(g(0)=2(0)+1=1\); for \(x=2\), \(g(2)=2(2)+1=5\). Both endpoint outputs belong to \(B\), and the solved inequalities show that every \(x\in[0,2]\) maps into \(B\), with no other real \(x\) doing so.

A Common Mix-Up

Common pitfall. The image and preimage can be confused because both involve the same function, but their inputs are subsets of different sets. In the finite example, it would be incorrect to write \(f^{-1}[\{2\}]=\{2\}\): the number \(2\) is an output in \(Y\), and a preimage must be a subset of the domain \(X\). The correct calculation tests each domain element: \(f(a)=1\), \(f(b)=1\), \(f(c)=0\), and \(f(d)=2\). Exactly \(d\) maps to \(2\), so \(f^{-1}[\{2\}]=\{d\}\). By contrast, \(f[\{d\}]=\{2\}\). One construction starts with the input \(d\) and reports its output; the other starts with the output \(2\) and finds its input.

These set constructions are useful whenever a function is used to compare portions of its domain and codomain. In topology, for example, later questions ask what happens when one takes the image or preimage of open and closed sets. The domain-and-codomain bookkeeping established here is essential: before asking whether such a set has a topological property, one must first identify which set the function produces.

Check Your Understanding

For each question, first identify whether the chosen set is a subset of the domain or the codomain.

  1. Let \(h:\{p,q,r\}\to\{0,1\}\) satisfy \(h(p)=0\), \(h(q)=1\), and \(h(r)=0\). Find \(h[\{p,r\}]\) and \(h^{-1}[\{1\}]\).
  2. For \(f:\mathbb{Z}\to\mathbb{Z}\), \(f(n)=n^2\), find \(f[\{-2,1,3\}]\) and \(f^{-1}[\{1,4\}]\).
  3. For \(g:\mathbb{R}\to\mathbb{R}\), \(g(x)=x^2\), find \(g^{-1}[[0,9]]\). State explicitly whether the endpoints are included.
  4. For \(k:\mathbb{R}\to\mathbb{R}\), \(k(x)=3x-2\), find \(k^{-1}[\{1,4\}]\) by solving the two equations.
  5. Explain why the notation \(f^{-1}[B]\) makes sense even when \(f\) is not one-to-one.