Functions and Mappings

The term **map** or **mapping** is often used as a synonym for **function**, but tends to lack a formal definition. Many authors use it as a more general version of a function, including correspondences and cases where not every element of the 'domain' is assigned an element of the 'codomain' (hence, not a function).

A *function* from a set

X

{\displaystyle X}

 to a set

Y

{\displaystyle Y}

 assigns to each element in

X

{\displaystyle X}

 an element in

Y

{\displaystyle Y}

. The set

X

{\displaystyle X}

 is called the **domain** and the set

Y

{\displaystyle Y}

 the **codomain** of the function. The value of the function

f

{\displaystyle f}

 at an element in its domain

x
∈
X

{\displaystyle x \in X}

 is denoted as

f
(
x
)

{\displaystyle f(x)}

and called the **image** of

x

{\displaystyle x}

 under

f

{\displaystyle f}

.

## Definition

A function, its domain, and its codomain are declared by

f
:
X
→
Y

{\displaystyle f: X \to Y}

. Alternatively, this is denoted as

x
↦
f
(
x
)

{\displaystyle x \mapsto f(x) }

, ‘*x

{\displaystyle x}

 maps into

f
(
x
)

{\displaystyle f(x)}

‘* (note that this leaves the domain and codomain unspecified). There are two important aspects to this definition:

1. For *every single*

x
∈
X

{\displaystyle x \in X}

, the function must assign an element

y
∈
Y

{\displaystyle y \in Y}

.
2. The function assigns *a single/unique* element in

Y

{\displaystyle Y}

 to

x
∈
X

{\displaystyle x \in X}

Formally, this translates to

∀
x
∈
X
,
∃
!
y
∈
Y

s.t.

f
(
x
# )
y
.

{\displaystyle \forall x \in X, \exists! y \in Y ~\text{s.t.}~ f(x) = y.}

 The first part of the definition means that if not every element in

X

{\displaystyle X}

 is mapped to

Y

{\displaystyle Y}

 it is not a function (!). The second part means that an argument can not have a non-singleton set as its image, which distinguishes it from a correspondence.

## Domain, Codomain, Image, and Range

Given a function

f
:
X
→
Y

{\displaystyle f: X \to Y}

:

* **Domain**: is the set

X

{\displaystyle X}

 of inputs/arguments that the function accepts.
* **Codomain**: is the set

Y

{\displaystyle Y}

 into which all of the output of the function is constrained to fall.
* **Range**: is the set of all outputs from the function. Hence, is it is a subset of the codomain,

f
(
X
)
:=
{
y
∈
Y

# y
f
(
x
)
,

x
∈
X
}
⊂
Y

{\displaystyle f(X):= \{y \in Y ~|~ y = f(x),~ x \in X\} \subset Y}

.
* **Image**: of

X
′

⊆
X

{\displaystyle X' \subseteq X}

 under the function is the set of outputs for a given set of inputs. So,

f
(

X
′

)
:=
{
y
∈
Y

# y
f
(
x
)
,

x
∈

X
′

}

{\displaystyle f(X') := \{ y \in Y ~|~ y = f(x),~ x \in X' \}}

.

For example, if

f
:

R

→

R

{\displaystyle f:\mathbb{R} \to \mathbb{R}}

 where

f
(
x
# )

x
2

{\displaystyle f(x)=x^2}

 then the output/image of the function is never a negative number, while these are included in

R

{\displaystyle \R}

. Hence, the domain is

R

{\displaystyle \R}

, the codomain is

R

{\displaystyle \R}

, and the range/image is

R

{\displaystyle \mathbb{R}\_+}

.

There is often confusion between the codomain, range and image. The former two are often used interchangeably. In addition, the image of a function without specifying a subset is often used to refer implicitly to the domain as the subset, making it mean the same as the range in the above definition. However, more properly we think about the image of a function as its value.

## Injection, Surjection, and Bijection

These are different classes of *functions* classified by how inputs/arguments are mapped to outputs/images. Given a function

f
:
X
→
Y

{\displaystyle f: X \to Y}

:

* **Surjective Function** (a.k.a. **onto**): each element of the codomain is mapped to by *at least* one element of the domain. That is,

f
(
X
# )
Y

{\displaystyle f(X) = Y}

, the range and codomain are the same

∀
y
∈
Y
,

∃
x
∈
X

s.t.

f
(
x
# )
y

{\displaystyle \forall y \in Y, ~\exists x \in X ~\text{s.t.}~ f(x) = y}

.
* **Injective Function** (a.k.a. **one-to-one**): each element of the codomain is mapped to by *at most* one element of the domain. That is,

f
(
x
# )
f
(

x
′

)

⟹

# x

x
′

,

∀
x
,

x
′

∈
X

{\displaystyle f(x) = f(x') \implies x = x', ~\forall x, x' \in X}

.
* **Bijective Function**: a function that is both surjective and injective. Each element of the codomain is mapped to by *exactly one* element of the domain. That is,

∀
y
∈
Y
,
∃
!
x
∈
X

s.t.

f
(
x
# )
y

{\displaystyle \forall y \in Y, \exists! x \in X ~\text{s.t.}~ f(x) = y}

.

## Inverse Function

Given a function

f
:
X
→
Y

{\displaystyle f: X \to Y}

, it is sometimes possible to define the **inverse function**,

f

−
1

:
Y
→
X

{\displaystyle f^{-1}: Y \to X}

, where

f

−
1

(
b
)
:=
{
a
∈
A

f
(
a
# )
b
}

{\displaystyle f^{-1} (b) := \{ a \in A ~|~ f(a) = b \}}

. Informally, the inverse of a function undoes the operation of the function. Since the inverse is a function, it must be that

∀
y
∈
Y
,

∃
!
x
∈
X

s.t.

f

−
1

(
y
# )
x

{\displaystyle \forall y \in Y, ~\exists! x \in X ~\text{s.t.}~ f^{-1}(y) = x}

.

A function

f
:
X
→
Y

{\displaystyle f: X \to Y}

 is invertible if there exists a function

g
:
Y
→
X

{\displaystyle g:Y \to X}

 such that:

g
(
f
(
x
)
# )
x
,

∀
x
∈
X

{\displaystyle g(f(x)) = x, ~\forall x \in X}

, and

f
(
g
(
y
)
# )
y
,

∀
y
∈
Y

{\displaystyle f(g(y)) = y, ~\forall y \in Y}

.

Some properties of inverse functions include: (INCLUDE PROOFS OF THESE, proof of iff bijective is in my math notes)

* A function is invertible if and only if it is bijective.
	+ **Proof**:
		- Invertible implies bijective: by contradiction, shows that if invertible and not bijective, then contradiction. Note that

		¬
		bijective

		⟺

		¬
		injective

		or

		¬
		surjective

		{\displaystyle \neg \text{bijective} \iff \neg\text{injective}~\text{or}~\neg\text{surjective}}

		. (1) If not injective,

		∃
		y
		∈
		Y

		s.t.

		f
		(
		x
		)
		=
		f
		(

		x
		′

		)

		{\displaystyle \exists y \in Y ~\text{s.t.}~ f(x) = f(x')}

		 while

		x
		≠

		x
		′

		{\displaystyle x \neq x'}

		. Then,

		g
		(
		y
		)
		=
		{
		x
		,

		x
		′

		}

		{\displaystyle g(y) = \{x, x'\}}

		 hence it is not a function. (2) If not surjective,

		∃
		y
		∈
		Y

		s.t.

		g
		(
		y
		)
		=
		∅

		{\displaystyle \exists y \in Y ~\text{s.t.}~ g(y) = \varnothing}

		. Since it does not map to anything, it is not a function. Only (1) or (2) is needed to see that if the inverse function

		g
		(
		⋅
		)

		{\displaystyle g(\cdot) }

		 exists, it is not possible that

		f
		(
		⋅
		)

		{\displaystyle f(\cdot)}

		 is not bijective.
		- Bijective implies invertible: by the definition of a bijection, we have

		∀
		y
		∈
		Y
		,

		∃
		!
		x
		∈
		X

		s.t.

		f
		(
		x
		)
		=
		y

		{\displaystyle \forall y \in Y,~ \exists! x \in X ~\text{s.t.}~ f(x) = y}

		. Let

		g
		(
		y
		)
		:=
		{
		x
		∈
		X

		f
		(
		x
		)
		=
		y
		}

		{\displaystyle g(y) := \{x \in X ~|~ f(x) = y \}}

		. Then,

		f
		(

		x
		¯

		)
		=

		y
		¯

		,

		g
		(

		y
		¯

		)
		=

		x
		¯

		⟹

		g
		(
		f
		(

		x
		¯

		)
		)
		=
		g
		(

		y
		¯

		)
		=

		x
		¯

		and

		f
		(
		g
		(

		y
		¯

		)
		)
		=
		f
		(

		x
		¯

		)
		=

		y
		¯

		{\displaystyle f(\bar{x}) = \bar{y},~ g(\bar{y}) = \bar{x} \implies g(f(\bar{x})) = g(\bar{y})= \bar{x} ~\text{and}~ f(g(\bar{y})) = f(\bar{x}) = \bar{y} }

		, which is the definition of invertibility.
* If the inverse of a function exists, it is unique.
	+ **Proof**: by definition:

	g
	∘
	f
	=

	I
	X

	=

	g
	′

	∘
	f

	{\displaystyle g \circ f = I\_X = g' \circ f }

	 and

	f
	∘
	g
	=

	I
	Y

	=
	f
	∘

	g
	′

	{\displaystyle f \circ g = I\_Y = f \circ g' }

	 where

	I

	{\displaystyle I}

	 is the identity function. Then,

	g
	=
	g
	∘

	I
	Y

	=
	g
	∘
	(
	f
	∘

	g
	′

	)
	=
	(
	g
	∘
	f
	)
	∘

	g
	′

	=

	I
	X

	∘

	g
	′

	=

	g
	′

	{\displaystyle g = g \circ I\_Y = g \circ (f \circ g') = (g \circ f) \circ g' = I\_X \circ g' = g' }

	.
* (

f

−
1

)

−
1

=
f

{\displaystyle (f^{-1})^{-1} = f}

	+ **Proof**: a function

	g
	(
	⋅
	)

	{\displaystyle g(\cdot) }

	 is the inverse of

	f

	−
	1

	{\displaystyle f^{-1}}

	 when

	g
	∘

	f

	−
	1

	=

	I
	Y

	{\displaystyle g \circ f^{-1} = I\_Y }

	, where

	g
	=
	(

	f

	−
	1

	)

	−
	1

	{\displaystyle g = (f^{-1})^{-1} }

	. Since the inverse is unique,

	g
	=
	f

	⟹

	f
	=
	(

	f

	−
	1

	)

	−
	1

	{\displaystyle g = f \implies f = (f^{-1})^{-1} }

	.

## Function Composition

Given two functions

f
:
X
→
Y

{\displaystyle f: X \to Y}

 and

g
:
Y
→
Z

{\displaystyle g: Y \to Z}

 such that the domain of the latter is the codomain of the former, their **composition** is the function

f
∘
g
:
X
→
Z

{\displaystyle f \circ g : X \to Z}

 defined by:

(
f
∘
g
)
(
x
# )
f
(
g
(
x
)
)

{\displaystyle (f \circ g)(x)=f(g(x))}

.

## Graph of a Function

A function is uniquely represented by the set of all pairs

(
x
,
f
(
x
)
)

{\displaystyle (x, f(x))}

, called the **graph** of the function. When the domain and codomain are sets of real numbers, each such pair may be thought of as the Cartesian coordinates of a point in the plane, giving the familiar visual representation of the graph of a function.

1. ↑ Note, this does not mean two elements in the domain can not map to the same element in the codomain. Just that a single element in the domain maps to a single element in the codomain (which would be a correspondence).