# Lecture 4: proofs and functions

• define 'jectivity (injectivity, bijectivity, surjectivity)
• define composition, inverses.
• discuss connection between 'jectivity and inverses

## 'jectivity

Definitions: let $$f : A → B$$. Then $$f$$ is

• injective (or "one to one") if for all $$x_1$$, $$x_2 \in A$$, if $$f(x_1) = f(x_2)$$ then $$x_1 = x_2$$
• surective (or "onto") if for all $$y \in B$$, there exists an $$x \in A$$ such that $$f(x) = y$$
• bijective if it is both injective and surjective

## composition

Definition: if $$f : A → B$$ and $$g : B → C$$ then the composition of g with f (written $$g \circ f$$) is the function $$(g \circ f) : A → C$$ is given by $$(g \circ f)(x) = g(f(x))$$.

Note that $$g \circ f$$ is different from $$f \circ g$$.

## inverses

Definition: The identity function on X is the function $$id : X → X$$ given by $$id(x) = x$$.

Definition: If $$f : A → B$$ then $$g$$ is a left inverse of $$f$$ if $$g \circ f = id$$. In other words, if for all $$x \in A$$, $$g(f(x)) = x$$ (Note: $$g$$ is a left inverse because you write it on the left).

Similarly, $$g$$ is a right inverse if $$f \circ g = id$$.

## 'jectivity and inverses

Claim: $$f$$ has a right inverse if and only if it is surjective.

Proof: We must prove that if $$f$$ has a right inverse, then it is surjective, and also that if $$f$$ is surjective, then it has a right inverse.

(RI ⇒ surj) Suppose that $$f$$ has a right inverse $$g$$. We will show that $$f$$ is surjective by contradiction. Suppose that $$f$$ is not surjective. Then there exists some $$y$$ such that for all $$x$$, $$f(x) \neq y$$ (). Now, since $$g$$ is a right inverse of $$x$$, $$f(g(y)) = y$$. But this contradicts (), so our original assumption (that $$f$$ is not surjective) must be false.

(surj ⇒ RI) Suppose $$f$$ is surjective. We will show that $$f$$ has a right inverse by constructing it. Let $$g : B → A$$ be defined as follows. Given any $$y \in B$$ we know that there exists some $$x \in A$$ such that $$f(x) = y$$ (since $$f$$ is surjective). Choose one of them, and define $$g(y)$$ to be $$x$$.

I claim $$g$$ is a right inverse of $$f$$. Indeed, for any $$y \in B$$, we have $$f(g(y)) = y$$ by the definition of $$g$$.

This concludes the proof.

Note: it turns out that $$f$$ is injective if and only if it has a left inverse, and $$f$$ is bijective if and only if it has a two-sided inverse. This will be on the next homework.