Mathematics for Computer Science - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Mathematics for Computer Science

Description:

If p is a prime and p | ab, then p | a or p | b. Application of number theory. Cryptography ... Read section 2.1 - 2.5. Do exercises 2.1 - 2.4 ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 23
Provided by: leonvand
Category:

less

Transcript and Presenter's Notes

Title: Mathematics for Computer Science


1
Mathematics for Computer Science
  • Lecture 4 Sets and Numbers
  • Leon van der Torre

2
Slides
  • Slides can be found on the internet
  • These slides are based on MIT open courseware,
    by S. Devadas and E. Lehmann

BECS - Bachelor of Engineering in Computer
Science
3
Part 1 Set theory
  • A set is a collection of distinct objects called
    elements.
  • Lists the elements inside curly-braces.
  • N  0,1,2,3,... the natural numbers
  • C  red,blue,yellow primary colors
  • D  Nifty,Friend,Horatio,Pretty-Pretty dead
    pets
  • P  a,b ,a,c ,b,c a set of sets
  • Elements of a set are required to be distinct
  • Order of elements is not significant, so x,y
    y,x
  • Expression e ? S asserts that e is an element of
    set S.
  • 7 ? N and blue ? C, but Wilbur ? D yet.
  • Sets are simple, flexible, and everywhere.

4
Some popular sets
  • Special symbols to represent some common sets.
  • A superscript  restricts a set to its positive
    elements
  • for example, R is the set of positive real
    numbers.

5
Comparing sets
  • S ? T indicates that set S is a subset of set T,
  • N ? Z and Q ? R, but not C ? Z
  • S ? T S is a subset of T, but they are not
    equal.
  • So for every set A, A ? A, but not A ? A.

6
Combining sets. X  1,2,3,Y  2,3,4
  • The union of sets X and Y  is denoted X ? Y
  • all elements appearing in X or Y or both X ?
    Y  1,2,3,4.
  • The intersection of X and Y  is denoted X ? Y
  • all elements that appear in both X and Y X ?
    Y  2,3.
  • The difference of X and Y  is denoted X - Y
  • all elements in X, but not in Y X - Y  1 ,
    Y - X  4.
  • The complement of a set Z,
  • consists of all elements not in Z, given a larger
    set.
  • with the real numbers R, the complement of the
    positive real numbers is the set of negative real
    numbers together with zero

7
Sequences
  • A sequence is a list of objects called terms
  • Listing the elements between parentheses
  • (a,b,c) is a sequence with three terms.
  • Terms in a sequence can be the same.
  • (a,b,a) is valid sequence, but a,b,a is not
    valid set
  • The terms in a sequence have a specified order.
  • (a,b,c) and (a,c,b) are different sequences, but
    a,b,c a,c,b
  • The empty sequence is typically ?.

8
Links between sets and sentences
  • A product of sets, S1  S2  ...  Sn, is a new
    set consisting of all sequences where the first
    term is drawn from S1, the second from S2, and so
    forth.
  • N N  (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...
  • A x B A x B B x A
  • Product of n copies of set S is denoted Sn.
  • 0,13  
  • (0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(
    1,1,0),(1,1,1)

9
Set Builder Notation
  • to define a set using a predicate
  • the set consists of all values that make the
    predicate true
  • A  n ? N n is prime and n 4k 1 for integer
    k
  • the elements are 5, 13, 17, 29, 37, 41, 53, 57,
    61, 73, ...
  • B   x ? R x3 - 3x 1 gt 0 
  • C   a  bi  ? C a2  2b2  1
  • Oval-shaped region around the origin in the
    complex plane

10
Characteristic function
  • fA 1 if x ?A
  • 0 otherwise
  • fA ? B fA x fB
  • fA ? B fA fB - fA x fB
  • fnot A 1 - fA
  • fA-B fA x (1 - fB)

11
Infinite sets
  • Infinite set there exists a 1-1 mapping on a
    proper subset
  • Countable there is a 1-1 mapping on N
  • Q is countable

12
Properties of set operations
  • P and Q are sets
  • (P ? Q) (Q ? P)
  • P ? (Q ? R) (P ? Q) ? R
  • P ? (Q ? R) (P ? Q) ? (P ? R)
  • (P ? P) P
  • not not P P
  • not (P ? Q) not P ? not Q

13
This is a Boolean algebra
  • P and Q are propositions
  • (P ? Q) ? (Q ? P)
  • P ? (Q ? R) ? (P ? Q) ? R
  • P ? (Q ? R) ? (P ? Q) ? (P ? R)
  • (P ? P) ? P
  • ??P ? P
  • ? (P ? Q) ? ?P ? ?Q

14
Part 2 Number theory
  • P and Q are integers
  • (P x Q) (Q x P)
  • P x (Q x R) (P x Q) x R
  • P x (Q R) (P x Q) (P x R)
  • But not, e.g.
  • P (Q x R) (P Q) x (P R)
  • Are there any problems with integers?

15
Divisibility
  • a divides b if there is an integer k such that a
    x k  b.
  • This is denoted a  b.
  • For example7 63 because 7x9 63 
  • Every number divides zero since a x 0  0 for
    every integer a.
  • If a divides b, then b is a multiple of a.
  • For example, 63 is a multiple of 7.

16
Facts About Divisibility
  • If a  b, then a  bc for all c.
  • If a  b and b c, then a c.
  • If a  b and a c, then a  sb tc for all s  t.
  • For all c ? 0, a  b if and only if ca  cb.

17
When Divisibility Goes Bad
  • More precisely, if you divide n by d, then you
    get a quotient q and a remainder r.
  • Theorem (Division Theorem). Let n and d be
    integers such that d gt 0. Then there exists a
    unique pair of integers q and r such that n 
    qd r and 0 r lt d.
  • d  10, n  2716 q  271 and r 6,
  • since 2716  271  10  6.
  • We write r n mod d

18
The Greatest Common Divisor
  • The largest number that is a divisor of both
    a and b. It is denoted gcd(a, b).
  • For example, gcd(18, 24)6.
  • Theorem. The greatest common divisor of a and
    b is equal to the smallest positive linear
    combination of a and b.
  • gcd(52,44) 4.
  • 4 is a linear combin. of 52 and 446 x
    52  (-7) x 44  4
  • Furthermore, no linear combination of 52 and 44
    is equal to a smaller positive integer.

19
Properties Greatest Common Divisor
  • Every common divisor of a and b divides
    gcd(a, b).
  • gcd(ka, kb) k  gcd(a, b) for all kgt 0.
  • If gcd(a, b) 1 and gcd(a, c)1, then
    gcd(a, bc) 1.
  • If a  bc and gcd(a, b) 1, then ac.
  • gcd(a, b)  gcd(b, a mod b).
  • Can be used to compute the gcd efficiently

20
Fundamental Theorem of Arithmetic
  • Every positive integer n can be written in a
    unique way as a product of primes
  • n  p1 p2 pj (p1  p2  ...  pj)
  • 1 is not a prime 15  3x5 or 1x3x5 or 12 35
  • the product of an empty set of numbers is defined
    to be 1 (for n1)
  • Lemma. If p is a prime and p ab, then p a or
    p b.

21
Application of number theory
  • Cryptography

22
Homework
  • Outils mathématiques pour l'informaticien, pages
    31-75
  • Read section 2.1 - 2.5
  • Do exercises 2.1 - 2.4
Write a Comment
User Comments (0)
About PowerShow.com