Discrete Structures

# Lecture Notes, 1 Nov 2010

 Last Update: 1 November 2010, 8:24 P.M. Note: or material is highlighted

## §2.3: Functions

1. Reminder: Last time, I introduced some notation that cannot easily be shown in HTML; I'll do my best.

1. Notation:

i = n
∪Ai =def A1 ∪ A2 ∪ … ∪ An
i = 1

= (alternative notation)

n
∪Ai
i = 1

= (alternative notation)

n
∪Ai
1

= (alternative notation) i ∈ {1,…, n}Ai = (alternative notation) iAi

• (which should remind you of ∃iA(i))

2. E.g.:

Suppose (∀i ∈ {1,…, n})[Ai = {i}]
∴ A1 = {1}, A2 = {2}, …

1. Then:

4
∪Ai = {1} ∪ {2} ∪ {3} ∪ {4} = {1,2,3,4}
i=1

and

n
∪Ai = {1,2,3,…, n}
i=1

and

∞
∪Ai = iWAi = {1} ∪ … ∪ {i} ∪ … = W
i=1

3. Similarly:

i=n
∩Ai = A1 ∩ … ∩ An
i=1

• E.g.:

i=4
∩Ai = {1} ∩ {2} ∩ {3} ∩ {4} = ∅
i=1

2. Be sure to read "Using Sets to Define the Natural Numbers",

3. Functions:

1. Note about the textbook:

• The book defines "function" in terms of an "assignment";
but "assignment" is never defined!

• Nor does the book define "function" in terms of "relations";
but I will :-)

2. Relations:

1. Informally, a binary relation between 2 objects is like a property that belongs to the ordered pair of the objects

E.g.:

1. x < y (e.g., 1 < 2)

• "<" is a 2-place relation between x & y
(or: it's a property of (x, y) )

2. x is a sibling of y (Kim is Pat's sibling)

• "being a sibling of" is a 2-place relation between x & y

3. x is a course that is taken by student y (191 is a course that you take)

4. x is between y and z (2 is between 1 and 3)

2. (Formal, Set-Theoretic) Definition:

Let A,B be sets.
Then R is a binary relation on A × B
or: R is a binary relation from A to B
or: R is a binary relation between A and B

=def R ⊆ A × B

• i.e., R ⊆ {(a, b) | (a ∈ A) ∧ (b ∈ B)}

3. Functions:

1. Basic idea: A function is a relation s.t. the same input (I/P) always has the same output (O/P)

• So, the graphs of curves like a straight line with slope = 1, or a parabola open at the top, or a sine wave are functions.
• But a circle is not a function.
• And √ is not a function (each input has two outputs).

2. Def:

Let A,B be sets.
Then f is a function from A to B

=def

1. f is a binary relation from A to B,
and
2. (∀a∈A)(∀b∈B)(∀b′∈B)[( (a,b) ∈ f  ∧  (a,b′) ∈ f ) → b=b′]

3. i.e., no two distinct members of f have the same first element (but different 2nd elements)

4. I.e., if "2" members of f have the same first element,
then they have the same second element.

• i.e., it only seems as if they are 2 members.
• i.e., "they" are one, not two

5. i.e., same I/P → same O/P

4. Notation & Terminology:

1. "f : A → B" for: f is a function from A to B

• Note: The "→" is NOT a material-conditional arrow!!!!!

2. "f(a) = b"
or                      for: (a, b) ∈ f
"f : a |→ b"

3. In the above, "a" and "b" are associated with different jargon in different academic disciplines:

disciplineab
social sciencesindependent
variable
dependent
variable
b is a function of a
b depends on a
mathematicspre-image of b image of a
computer scienceinputoutput

4. f "maps" A "to" B

f is a "transformation of" A "into" B

5. Def:

Let A,B be sets.
Let a,c ∈ A; b,d ∈ B.
Let f, g : A → B
Then f = g  =def  {(a, b) | (a, b) ∈ f} = {(c, d) | (c, d) ∈ g}

1. i.e., f = g  ↔  ∀ab[(a, b) ∈ f  ↔  (a, b) ∈ g]

2. i.e., f = g  ↔  ∀ab[f(a) = b  ↔  g(a) = b]

3. i.e, "2" functions are the same iff they are the same set

6. The So-Called "Function Machine"

1. Consider a machine f that:

• takes input a,
• you turn a crank,
• it grinds away at the input,
• and finally it outputs b (i.e., f(a)):

2. Despite what you may have been told elsewhere (e.g., in high school), this is NOT what a function is!

3. A function is merely the set of input-output (I/O) pairs.

4. What the machine really is is a computer!

• (And the "gears" are an algorithm that computes the function.)

• But: not all functions can be computed by algorithms!
• I.e., there are functions for which there are no such "function machines"

5. For more info, take CSE 396
6. or see "What Is Computation?"

Text copyright © 2010 by William J. Rapaport (rapaport@buffalo.edu)
Cartoon links and screen-captures appear here for your enjoyment. They are not meant to infringe on any copyrights held by the creators. For more information on any cartoon, click on it, or contact me.
http://www.cse.buffalo.edu/~rapaport/191/F10/lecturenotes-20101101.html-20101101-3