Course contentsShow
← Computer Science
Lesson 77 of 2,8722. Discrete Mathematics for CSFree lesson

Function Properties: Injective (One-to-One)

Exploring injective functions where each element in the codomain has at most one pre-image.

Function Properties: Injective (One-to-One)

What You'll Learn

You'll learn what makes a function injective (one-to-one) and how to recognize when each output comes from at most one input.

The Core Idea

An injective function (also called one-to-one) is a function where different inputs always produce different outputs. In other words, no two elements from the domain map to the same element in the codomain.

Think of it like assigning student ID numbers: if the system is working correctly, no two students should share the same ID. Each ID uniquely identifies one student. That's an injective function.

More formally, a function f: A → B is injective if:

  • Whenever f(a₁) = f(a₂), then a₁ = a₂

Or equivalently:

  • If a₁ ≠ a₂, then f(a₁) ≠ f(a₂)

Recognizing Injective Functions

Example 1 (Injective): Consider the function f: {1, 2, 3} → {a, b, c, d} where:

  • f(1) = a
  • f(2) = c
  • f(3) = d

This is injective because each element in the domain maps to a different element in the codomain. Notice that b is unused—that's fine! Injective means "at most one pre-image," not exactly one.

Example 2 (Not Injective): Consider g: {1, 2, 3} → {x, y} where:

  • g(1) = x
  • g(2) = y
  • g(3) = x

This is not injective because both 1 and 3 map to x. The element x has two different pre-images.

Visual Check

Using a mapping diagram: draw arrows from domain to codomain. If any two arrows point to the same target, the function is not injective.

Key Takeaway: A function is injective when no element in the codomain is "hit" more than once—every input produces a unique output.