Skip to content

Relations and Functions

Learning objectives
  • Relations and Functions

Entry conditions

Use relations and functions only when you can:

  • List or decide all relevant pairs of elements.
  • Decide whether a specific ordered pair is included.
  • For functions, assign exactly one output to each input.

Definitions

  • A relation RR on a set SS is a subset of S×SS \times S.
  • A function f:STf:S \to T assigns exactly one output in TT to each input in SS.

Vocabulary (plain language)

  • Ordered pair: a two-item list where order matters, written (x,y)(x,y).
  • Relation: a list of ordered pairs saying which items are related.
  • Function: a rule that gives one output for each input.
  • Domain: the set of allowed inputs.
  • Codomain: the set of possible outputs.

Symbols used

  • S×SS \times S: all ordered pairs of elements of SS.
  • (x,y)R(x,y) \in R: the pair (x,y)(x,y) is in the relation.
  • f:STf:S \to T: a function from SS to TT.

Intuition

A relation is a declared list of which items go with which. A function is a stricter relation: each input must have one, and only one, output.

Worked examples

Example 1: A relation

Let S={1,2,3}S = \{1,2,3\}. Define

R={(1,1),(1,2),(2,3)}. R = \{(1,1), (1,2), (2,3)\}.

Then 11 is related to 22, but 22 is not related to 11 unless (2,1)(2,1) is also listed.

Example 2: A function

Let S={a,b,c}S=\{a,b,c\} and T={0,1}T=\{0,1\}. Define

f(a)=0,f(b)=1,f(c)=1. f(a)=0,\quad f(b)=1,\quad f(c)=1.

Every input in SS has exactly one output in TT, so this is a function.

Example 3: Not a function

Let gg map aa to both 00 and 11. Then gg is not a function because one input has two outputs.

How to recognize the structure

  • Relation: you can answer “is (x,y)(x,y) in RR?” for any pair.
  • Function: you can answer “what is f(x)f(x)?” for any xx and the answer is unique.

Common mistakes

  • Treating “similarity” as a function when one item can be similar to many.
  • Treating “can influence” as a function when it can target many outputs.
  • Failing to define the domain or codomain.

Minimal data

  • A set SS.
  • A list of ordered pairs for RR.
  • For a function, a total mapping from SS to TT.

Relations

Date created

Cite

@misc{emsenn2025-relations-functions,
  author    = {emsenn},
  title     = {Relations and Functions},
  year      = {2025},
  url       = {https://emsenn.net/library/math/domains/sets/texts/relations-functions/},
  publisher = {emsenn.net},
  license   = {CC BY-SA 4.0}
}