Mappings as Generalized Functions
Learning objectives
- Define a mapping between finite sets
- Determine the image of an element and the preimage of an element
- Distinguish functions from non-functions among set correspondences
- Identify the image of a mapping
A mapping is a function without the numbers. The definition you learnt in 13.1 was phrased in terms of real numbers because that is the setting of high-school algebra. The same definition works just as well for arrows between any two sets, people to phone numbers, countries to capitals, vectors to vectors. The word "mapping" is the term mathematicians use when they want to emphasise that the inputs and outputs need not be numbers.
Definition
A mapping (or map) is a rule that assigns to each element of exactly one element of . The set is the domain, the set is the codomain. If we say is the image of and is a preimage of .
Two things are worth noticing immediately: (i) every element of gets exactly one image, the function rule from 13.1 still applies; (ii) an element of can have any number of preimages, including zero. Think of it as arrows leaving : each element of has one arrow leaving it, but a target in may receive several arrows or none at all.
Image of a subset
For a subset , the image of under is
The image of (with no qualifier) is , the set of elements in that actually get hit by something. The image is always a subset of the codomain; equality means the mapping is surjective, a concept you will meet in the next section.
Three small examples
- Squaring on the integers. Let , , . The image is the set of non-negative perfect squares . The preimage of is , two arrows arrive at . The preimage of is empty.
- Mod 3 on a finite set. Let , , . The image is all of , and each element of has exactly two preimages.
- Person to country. Let be all people, be all countries, assign each person their country of birth. The image is the set of countries with at least one citizen alive; preimages have wildly different sizes (China has billions, Vatican City has very few).
- Databases: A foreign key from one table to another is a mapping: each row in "Orders" maps to a row in "Customers" via the customer ID; the preimage of one customer is the set of all orders by that customer.
- Programming: A
HashMap<K, V>IS a mapping from keys to values; the image of the map is exactly the set of currently-stored values. - Cryptography: An encryption function maps plaintext to ciphertext; for decryption to work, the map must be a bijection (every ciphertext has exactly one preimage).
(Click any element on the left oval (the domain X), then click an element on the right oval (the codomain Y) to attach an arrow. The widget reports whether the current diagram is a valid function, that is, whether every element of X has exactly one arrow out. Try the "Partial" preset to see what a non-mapping looks like.)
What is NOT a mapping
Two failure modes a mapping must avoid:
- Some input has no image. Defining "the assignment " on is not a mapping, the element has no arrow leaving it.
- Some input has two images. Defining " and where " is not a mapping, the rule is ambiguous for input .
Try it
- Let and . List the image and find the preimage of each element of .
- Construct a mapping whose image equals the codomain. How many such mappings are there?
- For , , compute and .
A trap to watch for
It is tempting to say " is not a function because nothing in maps to ." That is not a problem. The mapping rule only demands that each element of the domain has an image; it places no constraints on the codomain. If no element of maps to , then simply has an empty preimage, the mapping is still a perfectly good mapping, just not surjective. The "every element has exactly one image" rule applies to the domain, not the codomain.
What you now know
You can recognise a rule as a mapping (or reject it because some input is unspecified or ambiguous), compute the image of an element or subset, find the preimage of an element, and distinguish image from codomain. The next section formalises the toolbox, composition, identity, inverse, and introduces the three properties (injective, surjective, bijective) that the rest of mathematics relies on.
Quick check
Mark section complete →
References
- Lang, S. (1971). Basic Mathematics. Springer. Chapter 14 §1, mappings as the abstract generalisation of functions.
- Halmos, P. (1974). Naive Set Theory. Springer. Section 8: functions and mappings between sets, image, preimage.
- Rudin, W. (1976). Principles of Mathematical Analysis, 3rd ed. McGraw-Hill. Chapter 2: mappings, images, and inverse images at the level used in analysis.