A function \(f\) is a relation on \(A\) and \(B\) that maps each \(a\) from \(A\) to exactly one element \(b=f(a)\) from \(B\).
Relation \(f\subseteq A\times B\) is
a function iff
\[\forall a\in A\ \exists b_1\in
B\ \bigl((a,b_1)\in f
\bigr)\land \bigl(\forall b_2\in B\ ({(a,b_2)\in f} \rightarrow {b_2 =
b_1}) \bigr).\]
Let’s break this down…
For, \(f: A \to B\) and \(g: B \to C\),
\(h = g \circ f\) is the composition of \(g\) and \(f\)
which can also be written as \(h(a) = g(f(a))\)
Note that the output of \(f\) has to be in the same set as the input for \(g\)!
We will demonstrate this with an example…
\(f(x) = x\) and \(g(x) = \frac{1}{x}\)
Say we define both the domain and range of \(f\) as the integers, \(\mathbb{Z}\), so \(f: \mathbb{Z} \to \mathbb{Z}\)
And we define the domain of \(g\) to be \(\mathbb{Z}^{+}\) (aka the positive integers)
(Note the domain can’t be \(\mathbb{Z}\) because \(0 \in \mathbb{Z}\), and you can’t divide by zero!)
And we can define the range of g as the rational numbers, \(\mathbb{Q}\), because it returns a fraction
so \(g: \mathbb{Z}^{+} \to \mathbb{Q}\)
Can you make a composition \(h = g \circ f\)?
We can apply functions to tuples.
A common example is the Pythagorean Theorem.
\[ f(x,y) = \sqrt{x^2 + y^2}\]
Note that \(f: \mathbb{R} \times \mathbb{R} \to \mathbb{R}\)
We can also apply functions to sets.
Say that we have \(f: X \to Y\)
\[f(X) = \{f(x) | x \in X \}\]
This is called the image of \(X\) under \(f\).
We can also say,
\[f^{-1}(Y) = \{ x \in X | f(x) \in Y \}\]
This is called the pre-image of \(Y\) under \(f\).
Reminder: A function \(f\) is a relation on \(A\) and \(B\) that maps each \(a\) from \(A\) to exactly one element \(b=f(a)\) from \(B\).
Recall…
A function \(f\) is a relation on \(A\) and \(B\) that maps each \(a\) from \(A\) to exactly one element \(b=f(a)\) from \(B\).
\(\forall a\in A\ \exists b_1\in B\ \bigl((a,b_1)\in f \bigr)\land \bigl(\forall b_2\in B\ ({(a,b_2)\in f} \rightarrow {b_2 = b_1}) \bigr).\)
Actually, the full term for this definition is a total function.
Recall…
A function \(f\) is a relation on \(A\) and \(B\) that maps each \(a\) from \(A\) to exactly one element \(b=f(a)\) from \(B\).
\(\forall a\in A\ \exists b_1\in B\ \bigl((a,b_1)\in f \bigr)\land \bigl(\forall b_2\in B\ ({(a,b_2)\in f} \rightarrow {b_2 = b_1}) \bigr).\)
Actually, the full term for this definition is a total function.
A partial function \(f\) is a relation on \(A\) and \(B\) that maps each \(a\) from \(A\) to at most one element \(b=f(a)\) from \(B\).
\(\forall a\in A\ \exists b_1\in B \cancel{\bigl((a,b_1)\in f \bigr)\land} \bigl(\forall b_2\in B ({(a,b_2)\in f} \rightarrow {b_2 = b_1}) \bigr).\)
In other words, If \(x \in A\), \(f(x)\) doesn’t necessarily evaluate.
A common example of this is a computer program that only accepts certain inputs, and returns ERROR (or crashes) if it’s not an acceptable input.
A function \(f: A \to B\) is an injection iff each element of \(B\) is hit by at most one element in \(A\).
\(\forall x_1,x_2\in A, ~ \bigl(f(x_1)=f(x_2)\bigr) \rightarrow (x_1=x_2).\)
Another logically equivalent way to state this is:
\(\forall x_1,x_2\in A, ~ (x_1{\neq}x_2)\rightarrow \bigl(f(x_1){\ne}f(x_2)\bigr).\)
This logical definition inspires the other term for an injection which is one-to-one because one input maps to one output.
This term doesn’t quite capture the full meaning though because, by definition, all functions map one input to one output.
A function \(f: A\to B\) is a surjection, or onto, if and only if every element of \(B\) is hit by at least one element in \(A\).
\(\forall y \in B ~ \exists x \in A, ~ f(x)=y\).
In other words, \(f(A)=B\).
A function \(f: A\to B\) is a bijection if and only if it is an injection and a surjection.
\(\forall b\in B, ~ \exists a_1 \in A, ~ \bigl(f(a_1)=b \bigr)\land \bigl(\forall_{a_2\in A}\ ({f(a_2)= b}) \rightarrow ({a_2 = a_1}) \bigr).\)
We are going to demonstrate how to prove a function is a bijection. We are also going to demonstrate how we can use what we’ve learned to prove other things!
The pigeonhole principle states: You can not fit \(n+1\) pigeons into \(n\) holes without having two pigeons share a hole.
Bringing it back to functions…
If you are mapping \(f: A \to B\) and \(|A|>|B|\), then there is no way to map from every element in \(A\) without two of them hitting the same element in \(B\).
An airport with 1,500 landings a day must be able to accommodate two planes landing in the same minute.
In a class of \(35\) students, if a majority are women and a majority are majoring in computer science, then at least one is both.