Difference between revisions of "SP18:Lecture 5 Functions"

From CS2800 wiki
Line 5: Line 5:
 
* [[File:lec05-board.pdf]]
 
* [[File:lec05-board.pdf]]
  
= Proof techniques continues =
+
= Proof techniques continued =
 +
 
 +
[[TODO]]
  
 
= Functions =
 
= Functions =

Revision as of 10:44, 10 February 2018

We finished our list of proof techniques, adding implication ([math]\href{/cs2800/wiki/index.php?title=%5CRightarrow&action=edit&redlink=1}{\Rightarrow} [/math]) and existentials ([math]\href{/cs2800/wiki/index.php/%5Cexists}{\exists} [/math]). We then defined functions and discussed some examples.

Proof techniques continued

TODO

Functions

Function definition

Definition: Image
If [math]f : A \href{/cs2800/wiki/index.php/%E2%86%92}{→} B [/math], then the image of [math]f [/math] (written [math]\href{/cs2800/wiki/index.php?title=Im&action=edit&redlink=1}{im}(f) [/math]) is the set of values that are output by [math]f [/math]. Formally, [math]\href{/cs2800/wiki/index.php?title=Im&action=edit&redlink=1}{im}(f) \href{/cs2800/wiki/index.php/Definition}{:=} \href{/cs2800/wiki/index.php/Set_comprehension}{\{y ∈ B \mid} \href{/cs2800/wiki/index.php/%E2%88%83}{∃x} \href{/cs2800/wiki/index.php/%E2%88%88}{∈} A\text{ such that }y=f(x)\} [/math] or more succinctly, [math]\href{/cs2800/wiki/index.php?title=Im&action=edit&redlink=1}{im}(f) := \href{/cs2800/wiki/index.php/Set_comprehension}{\{f(x) \mid x ∈ A\}} [/math].

Function examples

  • let [math]f(x) : \href{/cs2800/wiki/index.php?title=%E2%84%9D&action=edit&redlink=1}{ℝ} \href{/cs2800/wiki/index.php/%E2%86%92}{→} \href{/cs2800/wiki/index.php?title=%E2%84%9D&action=edit&redlink=1}{ℝ} [/math] be given by [math]f(x) := x^2 [/math]. The domain and codomain of [math]f [/math] are both [math]\href{/cs2800/wiki/index.php?title=%E2%84%9D&action=edit&redlink=1}{ℝ} [/math]; the image is [math]\{y ∈ \href{/cs2800/wiki/index.php?title=%E2%84%9D&action=edit&redlink=1}{ℝ} \href{/cs2800/wiki/index.php/%5Cmid}{\mid} y ≥ 0\} [/math].
  • we often draw functions:

Fun-a2b1c3.svg The domain of [math]f [/math] is [math]\href{/cs2800/wiki/index.php/Enumerated_set}{\{a,b,c\}} [/math], and the codomain of [math]f [/math] is [math]\href{/cs2800/wiki/index.php/Enumerated_set}{\{1,2,3\}} [/math].

  • another way to draw a function is with a table:
x [math]f(x) [/math]
a 1
b 1
c 1

This almost describes a function; the domain is clearly [math]\{a,b,c\} [/math] (because if there were any other domain elements, [math]f [/math] would not be a function); and the rule is clear. However, the codomain is not clear: is it [math]\href{/cs2800/wiki/index.php?title=Enumerated_Set&action=edit&redlink=1}{\{1\}} [/math]? Or [math][[Enumerated Set|\{1,2,3\} [/math]? Or [math]\href{/cs2800/wiki/index.php/%E2%84%95}{ℕ} [/math], or [math]\href{/cs2800/wiki/index.php?title=%E2%84%9D&action=edit&redlink=1}{ℝ} [/math]? When describing a function with a table, the codomain should be specified somewhere.