Sei sulla pagina 1di 26

Chapter 1: Speaking Mathematically

Hao Zheng

Department of Computer Science and Engineering


University of South Florida
Tampa, FL 33620
Email: zheng@cse.usf.edu
Phone: (813)974-4757
Fax: (813)974-5456

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
1 / 25
Why is it Called “Discrete”

• Discrete mathematics is the study of mathematical structures


that are fundamentally discrete in the sense of not supporting or
requiring the notion of continuity.
• Objects studied in discrete mathematics are largely countable sets
such as integers, finite graphs, and sets.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
2 / 25
Topics to Cover

• Logic and proof


• Induction and recursion
• Number theory
• Set theory
• Functions/relations
• Boolean algebra,
• And more
• Learn the properties and proof methods.
• Lay the foundation for future CS study.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
3 / 25
How is it Related to Real World

• Propositional logic - hardware (including VLSI) design


• Predicate logic - Artificial Intelligence, compilers, automated
program verification
• Algorithm correctness - programming, debugging
• Sets/relations - databases (Oracle, MS Access, etc.)
• Proofs - Artificial Intelligence, VLSI, compilers, theoretical
physics/chemistry

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
4 / 25
1.1 Variables

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
5 / 25
Variables

• Variable, a symbolic name associated with an object whose


associated value may be changed.
• Constant, has a fixed value all the time.

• Consider this:
Are there two numbers with the property that the sum of
their squares equals the square of their sum?

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
6 / 25
Important Mathematical Statements

• A statement is a sentence that is either true or false.


• Universal statement
• Existential statement
• Conditional statement
• Universal existential statement
• Existential universal statement

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
7 / 25
Universal Statement vs. Existential
Statement

• A universal statement says that a certain property is true for all


elements in a set.
• Given a property that may or may not be true, an existential
statement says that there is at least one thing for which the
property is true.
• Examples:
• All students in COT 3100-1 are junior.
• Some students in COT 3100-1 are junior.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
8 / 25
Conditional Statement

• A conditional statement says that if one thing is true then some


other thing also has to be true.
• If an animal is a dog, it is a mammal.
• If 378 is divisible by 18, then 378 is divisible by 6.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
9 / 25
Universal Conditional Statement

• A universal conditional statement is a statement that is both


universal and conditional.
• For all animal a, if a is a dog, it is mammal.
• If a is a dog, then a is a mammal.
• For all dogs a, a is a mammal.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
10 / 25
1.2 The Language of Sets

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
11 / 25
Sets

• A set is a collection of things called elements or members.


• A set may be specified using the set-roster notation by writing
all of its elements between braces. For example, {1, 3, 5}.
• A variation of the notion is sometimes used to describe a very
large set, as when we write {1, 2, 3, . . . 100} to refer to the set of
all integer from 1 to 100.
• A similar notation can also describe an infinite set, as when we
write {1, 2, 3, . . . } to refer to the set of all positive integers.
(The symbol . . . is called an ellipsis and is read “and so forth.”)

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
12 / 25
Example

• Consider a group of students, Ann, Bob, Carl, and David. Let set
X = {Ann, Bob, Carl}, Y = {Bob, Ann, Carl}, and
Z = {Ann, Ann, Bob, Carl, Carl}.
• What are the elements of X, Y , and Z? How are X, Y , and Z
related?
• How many elements are in {1, {1}}?

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
13 / 25
Axiom of Extensions

• A set is completely determined by what its distinct elements are,


not the order in which they might be listed or the fact that some
elements might be listed more than once.
• Order of elements does not matter.
• No duplicate elements.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
14 / 25
Set Builder Notations

• Let S denote a set and let P (x) be a property that elements of S


satisfy. We may define a new set to be the set of all elements x in
S such that P (x) is true. We denote this set as follows:

{x | P (x)}

It reads as “the set of elements x such that P (x) is true.


• Example:
Z1 = {x ∈ Z | x ≥ 5}

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
15 / 25
Subsets

• If A and B are sets, A is called a subset of B, written as A ⊆ B


(or A is contained in B or B contains A), if, and only if, every
element of A is also an element of B.
• Not a subset: A 6⊆ B (there is at least one element of A that is
not an element of B).
• Proper subset: let A and B be sets, A is a proper subset of B,
written as A ⊂ B, if and only if, every element of A is in B but
there is at least one element of B that is not in A.
• Symbolically, A ⊆ B and B 6⊆ A.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
16 / 25
Exercise
• Which one of the following is true or valid? If not true, rewrite it
to make it true.
1 {1} ∈ {1, 2}
2 1 ∈ {1, 2}
3 {1} ⊆ {1, 2}
4 1 ⊆ {1, 2}
5 {1} ⊆ {{1}, {2}}
• Let A = {e, f, g}, B = {f, t}, C = {f, g}, D = {f, g}. which
one of the following is true?
1 B ⊆A
2 C ⊆A
3 C ⊆D
4 C ⊂D
• Write all subset relations between the following two sets.
A = {n ∈ Z | 0 ≤ n ≤ 1000}, B = {100, 200, 300, 400, 500}
Hao Zheng ( Department of Computer Science Chapter
and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
17 / 25
Commonly Used Sets

R set of all real numbers


Z set of all integer numbers
Q set of all rational numbers

• R+ , Z+ , Q+ : the set of all positive real/integer/rational numbers.


• Rnonneg , Znonneg , Qnonneg : the of all non-negative numbers.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
18 / 25
Cartesian Products

• Given two sets A and B, the Cartesian product (also called


cross product)) of A and B, denoted A × B (read “A cross B”),
is the set of all ordered pairs (a, b), where a ∈ A and b ∈ B.

A × B = {(a, b) | a ∈ A and b ∈ B}

• Exercise: Let A = {4, 6}, B = {3, 4, 5}, What is A × B?

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
19 / 25
The Cartesian Plane
• R × R: the set of all ordered pairs (x, y) where both x and y are
real numbers.
• The Cartesian plane: horizontal and vertical axes are drawn on a
plane, each pair (x, y) in R × R corresponds to a unique point in
the plane.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
20 / 25
1.3 The Language of Relations

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
21 / 25
Relation

• Let A and B be sets. A relation R from A to B is a subset of


A × B. Give an ordered pair (x, y) in A × B, x is related to y by
R, written xRy, if, and only if, (x, y) is in R. Symbolically,

xRy means (x, y) ∈ R

• A - domain of R.
• B - co-domain of R.
• Exercise: Let E = {1, 2, 3, 4} and F = {−2, −1, 0} and define a
relation T from E to F as follows: For all (x, y) ∈ E × F ,
(x, y) ∈ T means that (x − y)/2 is an integer. Write T as a set
of ordered pairs.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
22 / 25
Arrow Diagram of a Relation
• Arrow diagrams are a more intuitive way to explain relations.
• Example: Let E = {1, 2, 3, 4} and F = {−2, −1, 0} and define a
relation T from E to F as follows: For all (x, y) ∈ E × F ,
(x, y) ∈ T means that (x − y)/2 is an integer. Draw T as an
arrow diagram.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
23 / 25
Functions
• A function F from a set A to a set B is a relation between
elements of A and elements of B with the property that each
input is related to one and only one output.
• A − domain of F .
• B − co-domain of F .
• Given an input element x ∈ A, there is a unique output element
y ∈ B that is related to x by F . The unique element y to which
F sends x is denoted F (x) and is called F of x.
• Example: decide if the relation below is a function.

C ⊆ R × R such that x2 + y 2 = 1 for every (x, y) ∈ C.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
24 / 25
Functions
• A function F from a set A to a set B is a relation between
elements of A and elements of B with the property that each
input is related to one and only one output.
• A − domain of F .
• B − co-domain of F .
• Given an input element x ∈ A, there is a unique output element
y ∈ B that is related to x by F . The unique element y to which
F sends x is denoted F (x) and is called F of x.
• Example: decide if the relation below is a function.

C ⊆ R × R such that y = x − 1 for every (x, y) ∈ C.

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
24 / 25
Equality of Functions
• If f and g are functions from set A to set B, then f equals g,
written f = g, if, and only if,

f (x) = g(x) for all x ∈ A

• Exercise: Define functions f and g from R to R by the following


formulas:

For all x ∈ R, f (x) = (x − 8)(x + 2) + 25 and g(x) = (x − 3)2

Does f = g? Explain

Hao Zheng ( Department of Computer Science Chapter


and Engineering
1: Speaking
University
Mathematically
of South Florida Tampa, FL 33620 Email: zheng@cse.usf.
25 / 25

Potrebbero piacerti anche