Math Home

A function \(f\) from a set \(A\) to a set \(B\) is a relation \(AfB\) such that for every \(a \in A,\) there is exactly one pair \((a,b) \in f.\)

Instead of writing \(AfB,\) we write \(f:A \rightarrow B.\) Instead of writing \((a,b) \in f,\) we write \(f(a) = b.\)

Examples On Finite Sets

Let \(A = \{1,2,3\}\) and \(B = \{w,x,y,z\}.\) The relation \(f = \{(1,w), (2,y), (3,w)\}\) is a function from \(A\) to \(B.\) Using the notation above, we would define the function as follows: \[f:A \rightarrow B\] \(f(1) = w, f(2) = y, f(3) = w.\)


The relation \(f = \{(1,y),(2,z),(3,w),(1,x)\}\) is not a function. By definition, a function from \(A\) to \(B\) must have exactly one pair for each element of \(A\) but \(f\) has two pairs for the number \(1.\)


The relation \(f = \{(1,z),(2,x)\}\) is not a function. By definition, a function from \(A\) to \(B\) must have exactly one pair for each element of \(A\) but \(f\) has no pairs for the number \(3.\)

Examples On The Real Numbers

The relation \(f\) from \(\mathbb{R}\) to itself defined by \(\{(x,x^2) : x \in \mathbb{R}\}\) is a function. In particular, \[f: \mathbb{R} \rightarrow \mathbb{R}\] is defined by \(f(x) = x^2.\) You can compute \(f\) when given a particular number: \[f(2) = 4, f(-1) = 1, f(5) = 25\] Every input has exactly one output.


On the other hand, \(f(x) = \sqrt{x}\) is not a function on \(\mathbb{R}\) because there is no number \(y\) in \(\mathbb{R}\) such that \(f(-1) = y.\) By definition, a function on \(\mathbb{R}\) must have exactly one pair for element of \(\mathbb{R}.\)