Chapter 2 Mathematical Preliminaries Sets and Relations A

  • Slides: 13
Download presentation
Chapter 2 Mathematical Preliminaries

Chapter 2 Mathematical Preliminaries

Sets and Relations § A set is a collection of distinguishable members or elements

Sets and Relations § A set is a collection of distinguishable members or elements § The members are usually drawn from some larger base set § Each member is either a primitive element of the base set or a set itself § The is no concept of duplication in a set § Each value from the base type is either in the set or not § Example 3, 4, 5 are in set P and the base type is ints

Bags § Sometimes we wish to define a collection without order, like a set,

Bags § Sometimes we wish to define a collection without order, like a set, but with duplicate items § Such a collection is called a bag § To distinguish a bag from a set we put square brackets around a bag’s elements

Sequences § A sequence is a collection of elements with an order and which

Sequences § A sequence is a collection of elements with an order and which may contain duplicate-value elements. § A sequence is also sometimes called a tuple or a vector § A sequence is indicated using angle brackets <>

Relation § A relation R over set S is a set of ordered pairs

Relation § A relation R over set S is a set of ordered pairs from S § If tuple <x, y> is in relation R, we can show it as x. Ry § We can define the following properties of relations: § R is reflective if a. Ra for all a in S § R is symmetric if whenever a. Rb, then b. Ra for all a, b in S § R is antisymmetric if whenever a. Rb and b. Ra, then a=b for all a, b in S § R is transitive if whenever a. Rb and b. Rc then a. Rc for all a, b, c in S

Equivalence Relation § R is an equivalence relation on set S if it is

Equivalence Relation § R is an equivalence relation on set S if it is reflexive, symmetric and transitive § An equivalence relation can be used to partition a set into equivalence classes § An equivalence relation on set S partitions the sets into subsets whose elements are equivalent

Partial Order § A binary relation is called a partial order if it is

Partial Order § A binary relation is called a partial order if it is antisymmetric and transitive. § The set on which the partial order is defined is called a partially ordered set or a poset

Miscellaneous Notation § § § B means bytes b means bits KB is a

Miscellaneous Notation § § § B means bytes b means bits KB is a kilobyte 210 = 1024 byes MB is a megabyte 220 bytes GB is a gigabyte 230 bytes

n! § The factorial function for integer n is the product of the numbers

n! § The factorial function for integer n is the product of the numbers between 1 and n § Stirling’s approximation is n! ≈ √ 2πn(n/e)n

Recursion § Recursion is awesome!! § Two parts § Base case § Recursive call

Recursion § Recursion is awesome!! § Two parts § Base case § Recursive call § You’ll see a lot more of recursion this semester

Proof Strategies § Proof by contradiction § Proof by Mathematical Induction § Base case

Proof Strategies § Proof by contradiction § Proof by Mathematical Induction § Base case § Inductive Hypothesis § (seem familiar)

Estimating § Estimating can be formalized by a three step process 1. Determine the

Estimating § Estimating can be formalized by a three step process 1. Determine the major parameters that affect the problem 2. Derive an equation that relates the parameters to the equation 3. Select values for the parameters, and apply the equation to yield an estimated solution

Example § How many golf balls can fit in room that is 8” x

Example § How many golf balls can fit in room that is 8” x 8” § Parameters: a golf ball is 1’ diameter § The room is 4096 cubic feet § You can fit 1728 golf balls in 1 cubic foot § So you can fit 4096 * 1728 total golf balls § 7, 077, 888 golf balls § The units do to match!!