0% found this document useful (0 votes)
22 views79 pages

Introduction

The Capitalist Society will destroy the world

Uploaded by

lezlie0814
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views79 pages

Introduction

The Capitalist Society will destroy the world

Uploaded by

lezlie0814
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 79

Discrete Structure II:

Introduction

Discrete Structure II, Fordham Univ., Fall 2015, Dr. Zhang


Outline
– Overview of the course
– Getting started, “speaking mathematically”
– variables
– universal, existential and conditional statements
– set
– relations and functions
Course Organization
– What is the purpose of lab sections?
– really problem solving sections, or recitations
– working on problems (paper and pencils) under the
guidance of the instructor, sometimes in groups
– VERY important for your successful mastery of
concepts/methods/skills taught in lectures.
– Syllabus
– Web site: http://storm.cis.fordham.edu/zhang/cs2100
– Email is the best way to reach me
– Office hours are open (just stop by)
– Assessment: academic integrity
Course Overview
– a more in-depth, rigorous study of following mathematical
subjects that are important to computer science
– Logic:
– arguments, digital logic circuits,
– quantified statements
– Proof: how to construct a carefully reasoned argument
to convince someone that a given statement is true
– various methods: direct proof, proof by
contradiction…
– Mathematical induction: a powerful proof technique
– Example: can we replace pennies with 3 cent
coins?
– Correctness of algorithms: reasoning about loops
Course Overview (2)
– Recursion: recursively defined sequence and sets,
recursive function
– ex: recurrence relation, e.g., Pn=Pn-1+Pn-2
– Recursive algorithms, e.g., Tower of Hanoi, merge
sort, …
– Set theory: go beyond basics,
– Halting problem (Alan Turing): something that
computers cannot do… (to be revisited in Theory
of Computation)
– Functions:
– cardinality and computability
– e.g., Are there more rationals than integers?
Course Overview (3)
– Relations:
– modular arithmetic and cryptography
– PERT and CPM
– Counting and Probability
– Monty Hall Problem
– Bayes’ Theorem, …
– Analysis of algorithm efficiency
– e.g., running time of binary search algorithm,
merge sort algorithm? …
Outline
– Overview of the course
– Getting started, “speaking mathematically”
– variables
– universal, existential and conditional statements
– set
– relations and functions
Variables
There are two uses of a variable. To illustrate the first use,
consider asking

Is there a number with the following property: doubling it and


adding 3 gives the same result as squaring it?

In this sentence you can introduce a variable to replace the


potentially ambiguous word “it”:

Is there a number x with the property that 2x + 3 = x2?


Variables
The advantage of using a variable is that it allows you to give
a temporary name to what you are seeking so that you can
perform concrete computations with it to help discover its
possible values.

To illustrate the second use of variables, consider the


statement:

No matter what number might be chosen, if it is greater than


2, then its square is greater than 4.
Variables
In this case introducing a variable to give a temporary name
to the (arbitrary) number you might choose enables you to
maintain the generality of the statement, and replacing all
instances of the word “it” by the name of the variable
ensures that possible ambiguity is avoided:

No matter what number n might be chosen, if n is greater


than 2, then n2 is greater than 4.
Example 1 – Writing Sentences Using Variables

Use variables to rewrite the following sentences more


formally.

a. Are there numbers with the property that the sum of their
squares equals the square of their sum?

b. Given any real number, its square is nonnegative.

Solution:
a. Are there numbers a and b with the property that
a2 + b2 = (a + b)2?

Or : Are there numbers a and b such that a2 + b2 = (a + b)2?


Example 1 – Solution cont’d

Or : Do there exist any numbers a and b such that


a2 + b2 = (a + b)2?

b. Given any real number r, r2 is nonnegative.

Or : For any real number r, r2 ≥ 0.


Or : For all real numbers r, r2 ≥ 0.
Some Important Kinds of
Mathematical Statements
Some Important Kinds of Mathematical Statements

Three of the most important kinds of sentences in


mathematics are universal statements, conditional
statements, and existential statements:
Some Important Kinds of Mathematical Statements

Universal Condition Statements

Universal statements contain some variation of the words


“for all” and conditional statements contain versions of the
words “if-then.”
Some Important Kinds of Mathematical Statements

A universal conditional statement is a statement that is


both universal and conditional. Here is an example:

For all animals a, if a is a dog, then a is a mammal.

One of the most important facts about universal conditional


statements is that they can be rewritten in ways that make
them appear to be purely universal or purely conditional.
Example 2 – Rewriting an Universal Conditional Statement

Fill in the blanks to rewrite the following statement:


For all real numbers x, if x is nonzero then x2 is positive.

a. If a real number is nonzero, then its square _____.

b. For all nonzero real numbers x, ____.

c. If x ____, then ____.

d. The square of any nonzero real number is ____.

e. All nonzero real numbers have ____.


Example 2 – Solution
a. is positive

b. x2 is positive

c. is a nonzero real number; x2 is positive

d. Positive

e. positive squares (or: squares that are positive)


Some Important Kinds of Mathematical Statements

Universal Existential Statements

A universal existential statement is a statement that is


universal because its first part says that a certain property is
true for all objects of a given type, and it is existential
because its second part asserts the existence of something.
For example:

Every real number has an additive inverse.

In this statement the property “has an additive inverse”


applies universally to all real numbers.
Some Important Kinds of Mathematical Statements

“Has an additive inverse” asserts the existence of something


—an additive inverse—for each real number.

However, the nature of the additive inverse depends on the


real number; different real numbers have different additive
inverses.
Example 3 – Rewriting an Universal Existential Statement

Fill in the blanks to rewrite the following statement:


Every pot has a lid.
a. All pots _____.
b. For all pots P, there is ____.

c. For all pots P, there is a lid L such that _____.

Solution:
a. have lids

b. a lid for P

c. L is a lid for P
Some Important Kinds of Mathematical Statements

Existential Universal Statements

An existential universal statement is a statement that is


existential because its first part asserts that a certain object
exists and is universal because its second part says that the
object satisfies a certain property for all things of a certain
kind.
Some Important Kinds of Mathematical Statements

For example:

There is a positive integer that is less than or equal to every


positive integer:

This statement is true because the number one is a positive


integer, and it satisfies the property of being less than or
equal to every positive integer.
Example 4 – Rewriting an Existential Universal Statement

Fill in the blanks to rewrite the following statement in three


different ways:

There is a person in my class who is at least as old as every


person in my class.

a. Some _____ is at least as old as _____.

b. There is a person p in my class such that p is _____.

c. There is a person p in my class with the property that for


every person q in my class, p is _____.
Example 4 – Solution
a. person in my class; every person in my class

b. at least as old as every person in my class

c. at least as old as q
Some Important Kinds of Mathematical Statements

Some of the most important mathematical concepts, such as


the definition of limit of a sequence, can only be defined
using phrases that are universal, existential, and conditional,
and they require the use of all three phrases “for all,” “there
is,” and “if-then.”
Some Important Kinds of Mathematical Statements

For example, if a1, a2, a3, . . . is a sequence of real numbers,


saying that

the limit of an as n approaches infinity is L

means that

for all positive real numbers ε, there is an integer N such that


for all integers n, if n > N then –ε < an – L < ε.
Outline
– Overview of the course
– Getting started, “speaking mathematically”
– variables
– universal, existential and conditional statements
– set
– relations and functions
The Language of Sets
Use of the word set as a formal mathematical term was
introduced in 1879 by Georg Cantor (1845–1918). For most
mathematical purposes we can think of a set intuitively, as
Cantor did, simply as a collection of elements.

For instance, if C is the set of all countries that are currently


in the United Nations, then the United States is an element
of C, and if I is the set of all integers from 1 to 100, then the
number 57 is an element of I.
The Language of Sets

The axiom of extension says that a set is completely


determined by what its elements are—not the order in
which they might be listed or the fact that some elements
might be listed more than once.
Example 1 – Using the Set-Roster Notation

a. Let A = {1, 2, 3}, B = {3, 1, 2}, and C = {1, 1, 2, 3, 3, 3}.


What are the elements of A, B, and C? How are A, B, and
C related?
b. Is {0} = 0?
c. How many elements are in the set {1, {1}}?
d. For each nonnegative integer n, let Un = {n, –n}. Find U1,
U2, and U0.

Solution:
a. A, B, and C have exactly the same three elements: 1, 2,
and 3. Therefore, A, B, and C are simply different ways
to represent the same set.
Example 1 – Solution cont’d

b. {0} ≠ 0 because {0} is a set with one element, namely 0,


whereas 0 is just the symbol that represents the number
zero.

c. The set {1, {1}} has two elements: 1 and the set whose
only element is 1.

d. U1 = {1, –1}, U2 = {2, –2}, U0 = {0, –0} = {0, 0} = {0}.


The Language of Sets
Certain sets of numbers are so frequently referred to that
they are given special symbolic names. These are
summarized in the following table:
The Language of Sets
The set of real numbers is usually pictured as the set of all
points on a line, as shown below.

The number 0 corresponds to a middle point, called the


origin.

A unit of distance is marked off, and each point to the right of


the origin corresponds to a positive real number found by
computing its distance from the origin.
The Language of Sets
Each point to the left of the origin corresponds to a negative
real number, which is denoted by computing its distance
from the origin and putting a minus sign in front of the
resulting number.

The set of real numbers is therefore divided into three parts:


the set of positive real numbers, the set of negative real
numbers, and the number 0.

Note that 0 is neither positive nor negative.


The Language of Sets
Labels are given for a few real numbers corresponding to
points on the line shown below.

The real number line is called continuous because it is


imagined to have no holes.

The set of integers corresponds to a collection of points


located at fixed intervals along the real number line.
The Language of Sets
Thus every integer is a real number, and because the
integers are all separated from each other, the set of
integers is called discrete. The name discrete mathematics
comes from the distinction between continuous and discrete
mathematical objects.

Another way to specify a set uses what is called the set-


builder notation.
Example 2 – Using the Set-Builder Notation

Given that R denotes the set of all real numbers, Z the set of
all integers, and Z+ the set of all positive integers, describe
each of the following sets.
a.

b.

c.
Example 2 – Solution
a. is the open interval of real numbers
(strictly) between –2 and 5. It is pictured as follows:

b. is the set of all integers (strictly)


between –2 and 5. It is equal to the set
{–1, 0, 1, 2, 3, 4}.

c. Since all the integers in Z+ are positive,


Subsets
A basic relation between sets is that of subset.
Subsets
It follows from the definition of subset that for a set A not to
be a subset of a set B means that there is at least one
element of A that is not an element of B.

Symbolically:
Example 4 – Distinction between ∈ and ⊆
Which of the following are true statements?

a. 2 ∈ {1, 2, 3} b. {2} ∈ {1, 2, 3} c. 2 ⊆ {1, 2, 3}


d. {2} ⊆ {1, 2, 3} e. {2} ⊆ {{1}, {2}} f. {2} ∈ {{1}, {2}}

Solution:
Only (a), (d), and (f) are true.

For (b) to be true, the set {1, 2, 3} would have to contain the
element {2}. But the only elements of {1, 2, 3} are 1, 2, and
3, and 2 is not equal to {2}. Hence (b) is false.
Example 4 – Solution cont’d

For (c) to be true, the number 2 would have to be a set and


every element in the set 2 would have to be an element of
{1, 2, 3}. This is not the case, so (c) is false.

For (e) to be true, every element in the set containing only


the number 2 would have to be an element of the set whose
elements are {1} and {2}. But 2 is not equal to either {1} or
{2}, and so (e) is false.
Cartesian Products
Example 5 – Ordered Pairs
a. Is (1, 2) = (2, 1)?

b. Is ?

c. What is the first element of (1, 1)?

Solution:
a. No. By definition of equality of ordered pairs,
(1, 2) = (2,1) if, and only if, 1 = 2 and 2 = 1.
But 1 ≠ 2, and so the ordered pairs are not equal.
Example 5 – Solution cont’d

b. Yes. By definition of equality of ordered pairs,


if, and only if, and

Because these equations are both true, the ordered


pairs are equal.

c. In the ordered pair (1, 1), the first and the second
elements are both 1.
Cartesian Products
Example 6 – Cartesian Products
Let A = {1, 2, 3} and B = {u, v}.
a. Find A × B

b. Find B × A

c. Find B × B

d. How many elements are in A × B, B × A, and B × B?

e. Let R denote the set of all real numbers. Describe R × R.


Example 6 – Solution
a. A × B = {(1, u), (2, u), (3, u), (1, v), (2, v), (3, v)}

b. B × A = {(u, 1), (u, 2), (u, 3), (v, 1), (v, 2), (v, 3)}

c. B × B = {(u, u), (u, v), (v, u), (v, v)}

d. A × B has six elements. Note that this is the number of


elements in A times the number of elements in B.

B × A has six elements, the number of elements in B


times the number of elements in A. B × B has four
elements, the number of elements in B times the number
of elements in B.
Example 6 – Solution cont’d

e. R × R is the set of all ordered pairs (x, y) where both x


and y are real numbers.

If horizontal and vertical axes are drawn on a plane and


a unit length is marked off, then each ordered pair in
R × R corresponds to a unique point in the plane, with
the first and second elements of the pair indicating,
respectively, the horizontal and vertical positions of the
point.
Example 6 – Solution cont’d

The term Cartesian plane is often used to refer to a plane


with this coordinate system, as illustrated in Figure 1.2.1.

A Cartesian Plane
Figure 1.2.1
Outline
– Overview of the course
– Getting started, “speaking mathematically”
– variables
– universal, existential and conditional statements
– set
– relations and functions
The Language of Relations and Functions
The objects of mathematics may be related in various ways.

A set A may be said to be related to a set B if A is a subset


of B, or if A is not a subset of B, or if A and B have at least
one element in common.

A number x may be said to be related to a number y if


x < y, or if x is a factor of y, or if x2 + y2 = 1.

Let A = {0, 1, 2} and B = {1, 2, 3} and let us say that an


element x in A is related to an element y in B if, and only if, x
is less than y.
The Language of Relations and Functions
Let us use the notation x R y as a shorthand for the
sentence “x is related to y.” Then

On the other hand, if the notation represents the


sentence “x is not related to y,” then
The Language of Relations and Functions
The Cartesian product of A and B, A × B, consists of all
ordered pairs whose first element is in A and whose second
element is in B:

In this case,

The elements of some ordered pairs in A × B are related,


whereas the elements of other ordered pairs are not.
Consider the set of all ordered pairs in A × B whose
elements are related
The Language of Relations and Functions
Observe that knowing which ordered pairs lie in this set is
equivalent to knowing which elements are related to which.

The relation itself can therefore be thought of as the totality


of ordered pairs whose elements are related by the given
condition.
The Language of Relations and Functions

The notation for a relation R may be written symbolically as


follows:

x R y means that (x, y ) ∈ R.

The notation x y means that x is not related to y by R:

x y means that (x, y ) ∉ R.


Example 1 – A Relation as a Subset
Let A = {1, 2} and B = {1, 2, 3} and define a relation R from A
to B as follows: Given any (x, y) ∈ A × B,

a. State explicitly which ordered pairs are in A × B and


which are in R.

b. Is 1 R 3? Is 2 R 3? Is 2 R 2?

c. What are the domain and co-domain of R?


Example 1 – Solution
a. A × B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}. To
determine explicitly the composition of R, examine each
ordered pair in A × B to see whether its elements satisfy

the defining condition for R.


Example 1 – Solution cont’d

Thus

b.

c.
Arrow Diagram of a Relation
Arrow Diagram of a Relation
Suppose R is a relation from a set A to a set B. The arrow
diagram for R is obtained as follows:

1.Represent the elements of A as points in one region and


the elements of B as points in another region.

2.For each x in A and y in B, draw an arrow from x to y if,


and only if, x is related to y by R. Symbolically:

Draw an arrow from x to y


if, and only if, xRy
if, and only if, (x, y) ∈ R.
Example 3 – Arrow Diagrams of Relations
Let A = {1, 2, 3} and B = {1, 3, 5} and define relations S and
T from A to B as follows:
For all (x, y ) ∈ A × B,

Draw arrow diagrams for S and T.


Example 3 – Solution

These example relations illustrate that it is possible to have


several arrows coming out of the same element of A pointing
in different directions.

Also, it is quite possible to have an element of A that does


not have an arrow coming out of it.
Outline
– Overview of the course
– Getting started, “speaking mathematically”
– variables
– universal, existential and conditional statements
– set
– relations and functions
Functions
Functions
Properties (1) and (2) can be stated less formally as follows:
A relation F from A to B is a function if, and only if:

1. Every element of A is the first element of an ordered pair


of F.

2. No two distinct ordered pairs in F have the same first


element.
Example 4 – Functions and Relations on Finite Sets

Let A = {2, 4, 6} and B = {1, 3, 5}. Which of the relations R,


S, and T defined below are functions from A to B?

a. R = {(2, 5), (4, 1), (4, 3), (6, 5)}

b. For all (x, y ) ∈ A × B, (x, y ) ∈ S means that y = x + 1.

c. T is defined by the arrow diagram


Example 4(a) – Solution
R is not a function because it does not satisfy property (2).
The ordered pairs (4, 1) and (4, 3) have the same first
element but different second elements.

You can see this graphically if you draw the arrow diagram
for R. There are two arrows coming out of 4: One points to 1
and the other points to 3.
Example 4(b) – Solution cont’d

S is not a function because it does not satisfy property (1). It


is not true that every element of A is the first element of an
ordered pair in S.

For example, 6 ∈ A but there is no y in B such that


y = 6 + 1 = 7. You can also see this graphically by drawing
the arrow diagram for S.
Example 4(c) – Solution cont’d

T is a function: Each element in {2, 4, 6} is related to some


element in {1, 3, 5} and no element in {2, 4, 6} is related to
more than one element in {1, 3, 5}.

When these properties are stated in terms of the arrow


diagram, they become (1) there is an arrow coming out of
each element of the domain, and (2) no element of the
domain has more than one arrow coming out of it.

So you can write T (2) = 5, T (4) = 1, and T (6) = 1.


Function Machines
Function Machines
Another useful way to think of a function is as a machine.
Suppose f is a function from X to Y and an input x of X is
given.

Imagine f to be a machine that processes x in a certain way


to produce the output f (x). This is illustrated in Figure 1.3.1

Figure 1.3.1
Example 6 – Functions Defined by Formulas

The squaring function f from R to R is defined by the


formula f (x) = x2 for all real numbers x.

This means that no matter what real number input is


substituted for x, the output of f will be the square of that
number.

This idea can be represented by writing f (● ) = ● 2. In other


words, f sends each real number x to x2, or, symbolically,
f : x → x2. Note that the variable x is a dummy variable; any
other symbol could replace it, as long as the replacement is
made everywhere the x appears.
Example 6 – Functions Defined by Formulas cont’d

The successor function g from Z to Z is defined by the


formula g (n) = n + 1. Thus, no matter what integer is
substituted for n, the output of g will be that number plus
one: g (● ) = ● + 1.

In other words, g sends each integer n to n + 1, or,


symbolically, g : n → n + 1.

An example of a constant function is the function h from Q


to Z defined by the formula h (r) = 2 for all rational numbers r.
Example 6 – Functions Defined by Formulas cont’d

This function sends each rational number r to 2. In other


words, no matter what the input, the output is always
2: h(● ) = 2 or h : r → 2.

The functions f, g, and h are represented by the function


machines in Figure 1.3.2.

Figure 1.3.2
Function Machines
A function is an entity in its own right. It can be thought of as
a certain relationship between sets or as an input/output
machine that operates according to a certain rule.

This is the reason why a function is generally denoted by a


single symbol or string of symbols, such as f, G, of log, or
sin.

A relation is a subset of a Cartesian product and a function is


a special kind of relation.
Function Machines
Specifically, if f and g are functions from a set A to a set B,
then
f = {(x, y) ∈ A × B | y = f (x)}
and
g = {(x, y) ∈ A × B | y = g (x)}.

It follows that

f equals g, written f = g,
if, and only if, f (x) = g (x) for all x in A.
Example 7 – Equality of Functions
Define f : R → R and g: R → R by the following formulas:

Does f = g?

Solution:
Yes. Because the absolute value of any real number equals
the square root of its square,

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy