1. What is a function

What is a function?

Function

Let and be any sets. A function from to is a rule $f$ that associates each element of $A$ with exactly one element of $B$.

If associates with , then we write and say ” of is ” or ” maps to ” or the “value of at is ”.

If is a function from to , then we write: .

Function Rules

We call the domain of and the codomain of .

  • every element of the domain has to be mapped somewhere in the codomain (but this does not have to apply in reverse)
  • one element cannot be mapped to 2 different places (but it can happen that different elements are mapped to the same place)
Link to original

Example 1

Let be the set of all humans, alive or dead. Making associations, are the following functions or not:

  • Not a function: people have two parents
  • Function: each person has exactly one mother
  • Not a function: some people have no children
  • This is a function but it is not a function because each person is associated with a set of people. This is a function.
Link to original

2. Different ways of describing functions

Different ways of describing functions

 

By associations

Let and . We can describe a function by listing all its associations:

We can describe it by using points and arrows:

We can describe the same by drawing its graph:

A function is a rule, sometimes we can describe it by a single formula, let , for every , let:

Hence, for example .

By case distinction

Sometimes the rule can only be described by case distinction, let , for every , let:

Hence, for example and .

Without any formula

The rule may be described without any mathematical formula.

Let . Let .

For every , let .

Tuples

From topic 3. Some useful functions.

A tuple can be thought of as a function. For example, the 5-tuple can be thought of as a listing of the values of the function defined by:

Infinite Sequence

An infinite sequence of objects can be thought of as a function.

For example, take is an infinite sequnce of objects from a set . This sequence can be thought of as a listing of the values of the function defined by:

Link to original

3. Some useful functions

Useful functions

Floor function

Floor function

The floor function, , assigns any real number to the largest integer that is less than or equal to $x$.

Examples:

Link to original

Ceiling function

Ceiling function

The ceiling function, , assigns any real number to the smallest integer that is greater than or equal to $x$.

Examples:

Link to original

Properties of Floor and Ceil

Here are some simple properties of both floor and ceil functions.

Functions with multiple arguments

If the domain of a function is a Cartesian product , we can say that:

  • has arity

    Arity

    Arity is the number of arguments or operands taken by a function.

    Link to original
  • is an -ary function
  • has arguments

In this case, for each -tuple , denotes the value of .

Binary function

A binary function has two arguments.

For binary functions, we may write either of:

Link to original

Link to original

4. Functions and relations

Functions and relations

Functions are special binary relations.

A function can be considered as a relation from to :

Relations that are also functions have two special properties, following from function rules:

  • For every element , there is some with being in the relation.
  • No two ordered pairs in the relation have the same first element.

For example:

  • Not a function: is not mapped.
  • Function:
  • Not a function: and are both present in the relation.
  • Not a function: is not mapped.
  • Function:
Link to original

5-6. Properties of functions

Properties of functions

Injective function

Injective function

A function is called a one-to-one or injective function if it maps distinct elements of $A$ to distinct elements of $B$.

Example of a Injective mapping

Alternatively: is one-to-one if for all elements in , if then .

Link to original

Surjective function

Surjective function

A function is called onto or a surjective function if every element $b$ in $B$ can be obtained as $b = f(a)$ for some $a$ in $A$. To summarise, the entire codomain must be mapped to the domain.

Example of a Surjective mapping

In general, this might not be the case. If is an function, we know that for every , we have . If the range of can be a proper subset of (which is the codomain), then it is not onto.

Link to original

Bijection

Bijection (function)

A function is called a bijection if it is both an [[Injective function|injective]] and [[Surjective function|surjective]] function.

Example of a Bijection mappingExample of neither
injective or surjective mapping
Link to original

Inverse Functions

Inverse (function)

Bijections always come in pairs, if is a bijection, then there is a function , it is called the inverse of , defined by:

This also means is also a bijection, so we have:

For example, let Odd and Even be the sets of odd and even natural numbers, respectively. Define a function by . Then is a bijection and its inverse is defined as .

Link to original

Identity Function

Identity function

For every set , its identity function is defined for all as: $$ \text{id}_A(a) = a $$

is also a bijection and its inverse is itself.

Link to original

Characteristic function

Characteristic function

Let be a set. For every subset , its characteristic function, is defined for all by: $$ f_A(x) = \begin{cases} 1, &\text{if } x \in A, \\ 0, &\text{if } x \notin A \end{cases} $$

If then can be represented by an infinite 0-1 sequence.

For example, given , .

Link to original

Link to original

7. Describing functions by recursion

Describing functions by recursion

Factorial

Factorial

The factorial function, , defined recursively is: ?

  • Basis step: and .
  • Recursive step: If then .
Link to original

Fibonacci

Fibonacci function

Leonardo Fibonacci asked in 1202: Let’s start with a pair of rabbits that needs one month to mature, and assume that every month each pair produces a new pair that becomes productive after one month. How many new pairs are produced each month?

The Fibonacci function, defined recursively is:

  • Basis step: and .
  • Recursive step: If then .

This generates a series of integers:

Link to original

Link to original

8. Function composition

Function composition

Composition of functions

Let and be functions. The composition of and is the function $\boxed{ (f \circ g): A \rightarrow C }$, can also define this for all $a \in A$ as: $$ (f \circ g)(a) = f(g(a)) $$

We only define the composition when the codomain of is equal to the domain of .

Link to original

title: Example
Let $X = \{ a,b,c \}$ and $Y = \{ 1,2,3 \}$.
Let the function $g: X \rightarrow X$ be defined by:
 
$$
	g(a) = b, \hspace{12px} g(b) = c, \hspace{12px} g(c) = a
$$
 
Let the function $f: X \rightarrow Y$ be defined by:
 
$$
	f(a) = 3, \hspace{12px} f(b) = 2, \hspace{12px} f(c) = 1
$$
 
Then:
- $(f \circ g)(a) = f(g(a)) = f(b) = 2$
- $(f \circ g)(b) = 1$
- $(f \circ g)(c) = 3$
- $(g \circ g)(a) = c$
- $(g \circ g)(b) = a$
- $(g \circ g)(c) = b$

Properties of composition

  • Even if both and are defined, and can differ. Let and be both functions, defined by and , then:
  • is associative:
  • If is a bijection then and
  • For any function ,
Link to original

9. Countable sets

Countable sets

For finite sets, we can simply count the number of elements in each. If finite sets have the same number of elements, then there is always a bijection between them.

Two infinite sets have the same size if there is a bijection between them.

Countable set

We can call a set countable if it is either finite or there is a [[Bijection (function)|bijection]] between $A$ and $\mathbb N$.

For example:

  • is a bijection hence is countable.
  • Given Odd is the set of odd natural numbers, we find that even if , it still has the same size as . The function defined by is a bijection.
Link to original

is countable

title: Not in exam.

We need to describe a bijection between and . We arrange the ordered pairs in in such a way that they can be easily counted:

We can describe this bijection by

Link to original

10. Not all sets are countable

Not all sets are countable

title: Not in exam.

The power set of is not countable:

There are more subsets of numbers than numbers.

We can show that :

  • Let be an arbitrary function.
  • Then, for every , is a subset of .
  • Now take the following subset of :

We show that is not in the range of , that is, for every , : Take an arbitrary , then there are two cases, either or .

  • If , then shoudl have the property describing , so
  • If , then the property describing does not hold for , so
Link to original