UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 2.7 Free with a free account
Injective Functions: One-to-One Mappings and Their Properties
Discrete Mathematics · Chapter 2: Set Theory and FunctionsSection 2.7 · lesson 15 of 878 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Discrete Mathematics.
Lesson complete
Earn the 4 college credits for Discrete Mathematics
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Surjective and Bijective Functions →← Functions: Definitions and TerminologyNext lesson: Surjective and Bijective Functions →
In this lesson
Never sending 2 different inputs to the same output.
- Define an injective (one-to-one) function
- Read injectivity from an arrow diagram
- Prove injectivity algebraically - and disprove it with one counterexample
- See how restricting the domain can create injectivity
Transcript
Everything said in the video, section by section (1,196 words). Read along, or search it.
Set Theory and Functions
Injective Functions
Section two point six defined functions. This section studies functions with a stronger guarantee. They never send two different inputs to the same output. They're called injective, or one-to-one. We'll define them precisely, read the property from an arrow diagram, prove it algebraically, and see how a single counterexample is enough to show it fails.
The Opening Problem
Hash Collisions Are a Certainty
A hash function that indexes database records maps an essentially unlimited set of possible keys, down to a small, fixed set of bucket numbers. Two different keys landing in the same bucket is called a hash collision. It isn't a bug that shows up in one unlucky case. It's a mathematical certainty, whenever the possible keys outnumber the buckets. This course returns to that idea as the Pigeonhole Principle, in section five point three. Designers can't avoid it, so they engineer around it, with collision resolution, more buckets, or hash functions that spread keys evenly. But when a function's domain and codomain happen to be evenly matched, it can aspire to something stronger. Never sending two different inputs to the same output at all.
Definition 2.7.1
Injective, or One-to-One
A function f from A to B is injective, or one-to-one, under one condition. For all a one and a two in A, f of a one equals f of a two, implies a one equals a two. In words, if two inputs produce the same output, they must have been the same input. There's an equivalent form, the contrapositive, from section one point five. If a one and a two are different, then f of a one and f of a two are different. Distinct inputs always produce distinct outputs.
Figure 2.7.1
The Discrete Horizontal-Line Test
A calculus course tests injectivity with the horizontal line test. If some horizontal line crosses a graph more than once, the function isn't injective. For functions between finite sets, arrow diagrams give the exact analogue. A function is injective precisely when no element of the codomain receives more than one incoming arrow. On the left, f is injective. Every codomain element gets at most one arrow. d gets none, and that's fine. Injectivity says nothing about whether every codomain element is used. On the right, g isn't injective. Both one and two point to a, so a receives two arrows.
Checking Every Pair
Confirming f Is Injective
Let's confirm f is injective directly from the definition. A is one, two, three, and B is a, b, c, d, with f of one equals a, f of two equals b, and f of three equals c. Every pair of distinct inputs must be checked. One and two give a and b, which differ. One and three give a and c, which differ. Two and three give b and c, which differ. Every one of the three pairs produces distinct outputs. So f is injective, exactly as the diagram shows. But checking every pair by hand is only possible when the domain is small and finite.
The Algebraic Method
Proving Injectivity
When the domain is infinite, like all the reals or all the integers, injectivity must be shown for every pair at once. That's exactly the direct-proof template from section one point seven. Assume f of a equals f of b, for arbitrary a and b, and use algebra to derive a equals b. Claim. f of x equals three x minus five is injective on the reals. Let a and b be arbitrary real numbers, and assume f of a equals f of b. Then three a minus five equals three b minus five. Add five to both sides, so three a equals three b. Divide both sides by three, so a equals b. f of a equals f of b forces a equals b. That's exactly the definition, so f is injective.
Disproving Injectivity
One Counterexample Is Enough
Disproving injectivity doesn't need a general argument at all. Claim. g of x equals x squared is not injective on the reals. A single counterexample suffices. g of two is four, and g of minus two is also four. But two isn't equal to minus two. So g fails the definition, and isn't injective. The asymmetry is worth stating plainly. Proving a function is injective needs an argument that works for arbitrary a and b. Proving it's not injective needs only one specific pair. A claim about every pair fails the moment one pair breaks it.
More Examples
The Same Shape, Different Answers
Claim. h of n equals two n plus one is injective on the integers. Assume h of a equals h of b. Then two a plus one equals two b plus one. Subtract one, so two a equals two b. Divide by two, so a equals b. It's injective. Not every function of this shape behaves the same way. Let k of n be n mod five, the remainder when n is divided by five. k of zero is zero, and k of five is also zero. But zero isn't five. So k isn't injective. And this is exactly the hash-collision phenomenon from the opening. k folds infinitely many integers onto only five possible outputs, zero through four. Collisions like this are unavoidable.
Domain Restriction
Repairing the Squaring Function
Whether a function is injective can depend on its domain, not only its formula. The squaring function failed on all the reals, because it collapses each pair of opposites, x and minus x, onto one output. Restrict the domain to the non-negative numbers, zero to infinity, and no such pair can appear. Claim. On that restricted domain, x squared is injective. Let a and b be non-negative, and assume a squared equals b squared. Rearrange and factor. a squared minus b squared equals a minus b, times a plus b, which is zero. A product is zero only if one factor is zero. If a minus b is zero, then a equals b directly. If a plus b is zero, then since both are non-negative, the only way is a and b both zero. Again, a equals b. In every case a equals b, so x squared is injective on the non-negative numbers.
Table 2.7.1
Every Function in This Section
This table collects all five functions from this section. Three x minus five on the reals is injective, by algebra. x squared on the reals isn't, because g of two equals g of minus two. x squared on the non-negative numbers is injective, by the factoring argument. Two n plus one on the integers is injective, by algebra. And n mod five isn't, because k of zero equals k of five. Every yes came from a general argument. Every no came from a single counterexample.
Takeaways
Distinct In, Distinct Out
To summarize. A function is injective if f of a one equals f of a two, always forces a one equals a two. Equivalently, distinct inputs give distinct outputs. In an arrow diagram, no codomain element may receive more than one arrow. Proving injectivity needs a general argument. Disproving it needs a single counterexample. And whether a function is injective can depend on its stated domain. Hash functions show the real stakes. A collision is exactly a failure of injectivity, unavoidable once the domain outgrows the codomain. Here's something to think about. Is there another way to restrict the domain, other than the non-negative numbers, that makes x squared injective? Is there a single largest domain on which it's injective, or could two different largest domains work equally well?
About Discrete Mathematics at UPI Study
Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus Every course with PRO →
Why take it here
Why students take Discrete Mathematics with UPI Study
Where the credit goes
Universities that work with NCCRS
Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Injective Functions: One-to-One Mappings and Their Properties
What does it mean for a function to be injective (one-to-one)?
How can you tell from an arrow diagram whether a function is one-to-one?
How do you prove that f(x) = 3x - 5 is injective, and how do you show a function is not?
Can restricting the domain make a function injective?
About the Discrete Mathematics course
How many college credits is Discrete Mathematics?
How much does Discrete Mathematics cost and what is included?
Which universities accept UPI Study credits?
How long does Discrete Mathematics take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 4 credits in Discrete Mathematics.
87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
4 credits · NCCRSEnroll →