discrete.

STEP-BY-STEP LESSON · §1.3

The Language of Relations and Functions

Distinguish a relation from a function.

Before you begin

The Language of Sets

A set specifies which objects are included. Listing order and repetition do not change it.

{2,5}={5,2,2}

5∈A asks about the number 5. {5}⊆A asks whether every element of {5} belongs to A.

5∈{2,5}; {5}⊆{2,5}

Symbols

R⊆A×B
relation
f:A→B
function from A to B
Definitions and notation for this topic
Cartesian product
A × B

The set of all ordered pairs (a,b) with a ∈ A and b ∈ B.

The order of the entries in a pair matters.

Separate glossary example

{1} × {2,3} = {(1,2),(1,3)}

Open glossary card
Function
f: A → B

Assigns exactly one element of B to each element of A.

Every allowed input must have exactly one output.

Separate glossary example

Let f:ℤ→ℤ be defined by f(x)=x+1. Then f(2)=3.

f(x)=x+1

Open glossary card
Domain / codomain
f:A→B

In f:A→B, A is the domain of allowed inputs and B is the declared codomain. The image is the set of outputs actually attained.

Changing the codomain can change whether a function is onto. A/B is not notation for these two roles.

Separate glossary example

For f:ℤ→ℤ with f(x)=2x, both domain and codomain are ℤ, but f(ℤ) is the set of even integers.

f:ℤ→ℤ, f(x)=2x

Open glossary card
Relation
R ⊆ A×B

A set of ordered pairs describing which objects are related.

A function is a special kind of relation.

The notation aRb means (a,b)∈R. A relation on A has R⊆A×A; reflexivity, symmetry and transitivity below concern that setting.

Separate glossary example

On ℤ, define aRb to mean a≤b.

Open glossary card

Step by step

Step 1 / 6

A relation selects pairs

A relation from A to B is a set of selected pairs in A×B. An object may relate to several objects or none.

R⊆A×B

A relation does not itself require a unique output.

Worked example

A={1,2}, B={a,b}; R={(1,a),(2,a)}. Decide whether R is a function from A to B.

  1. Check the domain, not just the pairs: its inputs are 1 and 2.
  2. Input 1 occurs once, paired with a. Input 2 also occurs once, paired with a. Thus both existence and uniqueness hold.
  3. Both outputs belong to B. Therefore R is a function; two inputs sharing a and unused b are allowed.
Optional self-check

What does adding (1,b) violate?

Show answer

Input 1 has two different outputs, violating uniqueness.

Source / textbook · approved access required

Open source: printed p. 15 · PDF 39