Está en la página 1de 37

SET THEORY

Set: It is an unordered collection of distinct


elements. elements

Finite Set: A set is finite if it contains a finite


number of elements A = {1, 3, 5, 7, 9, 11, 15, 17, 19} Infinite Set: A set is infinite if it contains an infinite number of elements { , , , , , } B = {0, 1, 2, 3, 4, .} Empty Set: A set is empty if it contain no elements ={}

If X is a set: x X x belongs to X g x X x does not belong to X { x x N and x is odd } The set of all x such that x belongs to N and x is odd

Subset: If every element of A is also an element of B


AB

Proper Subset: A is proper subset of B if:


(i) A is subset of B (ii) There exists at least one element in B which is not in A A. AB

Improper Subset: A is an improper subset of B if:(i) A is a subset of B (ii) There does not exist any element in B which does not belong to A. Every set is an improper subset of itself

Equal Sets: A and B are equal sets if:ABBA or A=B

Union of X & Y:
X Y = { z z X or z Y }

Intersection of X & Y: X Y = { z z X and z Y } Difference of sets:


X \ Y = { z z X but z Y }

Cartesian Product:
X x Y = {(x,y) x X and y Y }

INTEGERS, REALS AND INTERVALS Integers:


Set of integers : Z = { 0, 1, 2, 3, 4, .} Set of natural integers : N = { 0,1, 2, 3, 4, } Set of positive integers : N+ = { 1, 2, 3, 4, } g g } Set of negative integers : N- = { -1, -2, -3, -4, }

Real Numbers:
Set of real numbers: R Set of positive real numbers: R+ = { x R x > 0 } Set of negative real numbers: R- = { x R x < 0 }

Interval:

An interval i a set of numbers l i A i t l is t f b lying between two bounds. If a and b are two real numbers (a b):
Open interval = { x R a < x < b} Semi-open interval = { x R a < x b } p or {xRax<b} Empty interval = { x R a < x < b } where a=b Integer interval [i j] Integer interval = { n Z i n j } where i & j are integers such that i j+1.

FUNCTIONS AND RELATIONS


X & Y be two sets Th relation b t The l ti between X and Y i called f d is ll d function if ti if: for each x X, there exists one and only one y Y such th t ( y) h that (x, ) . : XY is a function from X to Y. I relation ( y) f ( ) In l ti (x, ) (x) The set X is called the domain of the function The set Y is its image The set [X] = { (x) x X} is its range

Example
(i) C={(x,1), (y,1)} Domain C={x, y} Range C={1} (ii) D={(1, 1), (1, 2), (2, 1)} Domain D={1, 2} { , } Range D={1, 2}

Injective Function (one-to-one): A function is injective


if th there d not exist t do t i t two di ti t x1, x2 X distinct such that (x1) = (x2).

Example
A={2, 3, 5} B={a, b, x, y} ={(2, a), (3, x), (5,y)} Domain ={2, 3, 5} Range ={a, x, y}

(i)

A 2 3 5

B
a b x y

A into B A B

Domain =A Range B (Range i (R image) )

A (ii) 2 4 6

B 1 3 5

A into B

Domain ={2, 4, 6} Range ={1 3} {1, (Range image)

={(2,1), (4,3), {6, 3)} Domain = A Range B

Surjective function (onto)


A (i) 2 4 6 B 1 3 5

A onto B

Domain ={2 4 6} ={2, 4, Range ={1, 3, 5}

={(2,1), (4,3), (6, 5)} Domain = A Range = B

( Range = image)

A (ii) 2 3 5

A 2 3 5

A onto A

Domain =A Range =A

{( , ), ( , ), ( , )} ={(2,2), (3,5), (5, 3)} Domain = {2, 3, 5} Range = {2, 3, 5}

( Range = image)

Bijective Function: A set is bijective if it is


both injective and surjective
-1 inverse (-1 (y)) = y for all y Y A 2 3 5 A 2 3 5

A onto A
and A A A into A Domain =A Range =A

{( , ), ( , ), ( , )} ={(2,2), (3,5), (5, 3)} Domain = {2, 3, 5} Range = {2, 3, 5}

Predicate: A function P: X {true, false} is called a predicate on X.


P ( p , q , r ) = ( p q ) ( q r )
so P(true, false, true) = true when P is a predicate on X, we sometimes say P is a property of X.

Quantifiers
for all for all there exists ( x X) [P(x)] ( x X) [P(x)] ( ! x X) [P(x)] ( ( x X) [P(x)] ) [ ( )] ( x X) [P(x)] every x in X has property P. there exists at least one x in X that has property P. there exists exactly one x in X that has property P. is always true if X is an empty set. y py is always false if X is an empty set.

Alternation of Quantifiers
( n N) ( m N) [ m > n] For every natural number, there exists another natural number (m) greater than (n). ( m N) ( n N) [ m > n] There is an integer m that is larger that every natural number i l di m it lf t l b including itself. It is obviously false the order in which the quantifiers are presented is important.

Sums and Products


n Sums f (i ) = f (1) + f (2) + ..... + f(n)

i =1
Sum of the values taken by on the first n positive integers
f (i )
n

i=1 P(i) Sum of the values taken by f on those integers between 1 and n for which property P holds. p p y If n = 10 and P(i) is odd
10

i = 1 + 3 + 5 + 7 + 9 = 25

i=1

P(i) is odd

Products
n (i) = (1) x (2) x (3) x .. x (n) i=1 Product of (i) as i goes from 1 to n. If n = 0, the product is defined to be one.

Miscellaneous Notations
Logbx=y Where b 1 and x are +ve real numbers (b&x must be +ve) by = x log10 1000 = 3 or 103 = 1000 Where b is not specified, it is taken as 10 and denote the natural logarithm (ln)
Loga(xy) = logax + logay Loga(x/y) = logax logay Logaxy = ylogax
log a x = log b x log b a

(i )
(ii )

log 9 729 =
log 4 16 =

log 3 729 log 3 9

log 2 16 log 2 4

x logb y = y logb x

Floor of x: If x is a real number, [x] denotes the


largest integer that is not larger than x.
x=3 1 2 x =3

x = 3

1 2 x = 4

Floor [3.14] = 3, 5 = 2, 8.5 = 9, 7 = 7

Ceiling of x: If x is a real number, [x] denotes


the th smallest i t ll t integer th t i not smaller th x. that is t ll than

x=3

1 2 x =4

1 x = 3 2 x = 3 Ceiling [3.14] = 4, 5 = 3, 8.5 = 8, 7 = 7 g

Algorithm to Find a New Prime Number (Euclid M th d) (E lid Method)


Function NewPrime (P : set of integers)
{The argument P should be a non empty finite set of non-empty primes} x Product of the elements in P yx+1 d1 Repeat d d+1 until d divides y return d

Another Algorithm to Find a New Prime Number Pi N b


Function DumpEuclid (P : set of integers)
{The argument P should be a non empty finite set of non-empty primes} x The largest element in P g repeat x x + 1 until x is prime return x

PROOF
(1) Proof by contradiction (2) Proof by Mathematical Induction

Proof by contradiction b
It is also known as indirect proof. Theorem : There exist two irrational numbers x Th and y such that xy is rational. By contradiction, assume xy =irrational contradiction we know 2 is a irrational number
Let z= 2
2

By our assumption z is irrational

Let

w= z

W is again i ti i i irrational b our assumption l by ti but

w= z =

( 2)

2 = =2

( 2)

2 2

Here conclusion says that 2 is irrational which is false. Thus, our assumption was false. So it is possible to obtain a rational number when raising an irrational number to an irrational power. It is a proof by contradiction and is avoided in the context of algorithmics.

Proof By Mathematical Induction


(Very useful tool in algorithmics) Induction Approach: inferring of general law from particular instances instances. Deduction Approach: an inference from general to particular (always valid if it is applied properly) Induction Approach (i) Eulers Conjecture (1769) A4+B4+C4=D4 Enuler conjectured that this equation can never be satisfied. Frye (after two centuries) using computing machines for hundreds of hours found that: 958004+2175194+4145604=4224814 (23-figure number) 217519 414560 422481 23 figure

Proof By Mathematical Induction


(ii) Polynomial p(n) = n2 + n +41 p(0) + p(1) + p(2) + p(3) + p(4) + p(5) + p(6) +p(7) + p(8) + p(9) + p(10) = 41, 43, 47, 53, 61, 71, 83, 97, 113, 131 and 151. It is natural to infer by induction that p(n) is prime for all integer values of n. But p(40) = 1681 = 412 so induction has gone wrong.

Deduction Approach

(i) Sum of the cubes of the first n positive integers is always a perfect square. 13 = 1 = 12 13+23 = 9 = 32 13+23+33 = 36 = 62 13+23+33+43 = 100 = 102 13+23+33+43+53 = 225 = 152

(ii) Algorithm for Mathematical Induction function sq (n) if n=0 then return 0 else return 2n + sq(n-1)-1 ( ) Check: sq(0)=0, sq(1)=2+0-1=1 (0) 0 (1) 2 0 1 1 sq(2)=4+1-1=4, sq(3)=6+4-1=9 sq(4)=8+9-1=16 sq(4)=8+9 1=16 Proof: sq(n)=2n+sq(n-1)-1 sq(n)=2n+sq(n 1) 1 sq(n)=2n+n2-2n+1-1 sq(n)=2n+n2-2n sq(n)=n2

Tiling Problem
m squares in each row and column where m is power of 2 1 square is distinguished as special square. It is not covered b any til i t d by tile. 1 tile takes 3 squares 2 x 2 board is formed The tiling problem can always be solved

The tiling problem

(a) Board with special square

(c) One tile

(c) Placing the first tile

(d) solution

Proof by Mathematical Indirection for Tiling Problem


m = 2n where n is an integer (i) Basis if n=0 m=20=11x1 board 1 square is special Board is tiled by doing nothing if n=1 m=21=22x2 board 1 square i special is i l Board is tiled by putting 1 tile

(ii)

Induction Step
Consider n1 m = 2n According to induction hypothesis theorem is true for 2n-1 x 2n-1 boards Suppose a m x m board containing one special square Divide the board into four equal parts Place the tile in the middle of the original board so to cover 1 square of three sub-boards. These three squares are also special squares squares. By induction hypothesis, each of these sub-boards can be tiled Thus h Th theorem i f m=20, and since i truth f m=2n f ll is for 2 d i its h for 2 follows from its assumed truth for m=2n-1 for all n 1, it follows from the principle of mathematical induction that the theorem is true for all m provided m i a power of 2 t f ll id d is f 2. A suitable algorithm can be obtained to solve tiling problem.

Construction Induction
It can also be used to prove the truth of a partially specified assertion and discover the missing specifications This technique can be illustrated featuring the Fibonacci sequence ( th century, Italian mathematician). q (12 y, ) Every month a breeding pair of rabbits produce a pair of offspring. The offspring will in their turn start breeding after two 1 months and so on.
Month-4 Month-3
1 1 1 1 1 1 1 1

Month-1

Month-2
1

(1 pair)

(2 pairs)

(3 pairs)

(5 pairs) and so on

Format definition

f 0 = 0; f1 = 1

and d

f n = f n 1 + f n 2 f n >= 2 for

The sequence is = 0 1 1 2 3 5 8 13 21 34 55 89 .. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, Constructive induction can be useful in the analysis of algorithms.

Algorithm for computing the Fibonacci


function Fibonacci (n) if n<2 then return n else return Fibonacci (n-1)+Fibonacci (n-2) Let g(n) stand for number of times instruction () is performed when Fibonacci is called (recursive calls). g(0) = g(1) = 0 when n 2 : g(n)=g(n-1)+g(n-2)+1 n=5 : g( ) g( ) g( ) g(5)=g(5-1)+g(5-2)+1 g(5)=g(4)+g(3)+1 g(5)=3+2+1=6

Elementary Probability
It is concerned with the study of random phenomena whose future is not predictable with certainty. Example E l (i) Throwing of a dice (ii) Counting number of cars passing a particular point in a given period of time (iii) Measuring the response time of a computer system The set of all possible outcomes of a random experiment is called the sample space (s) of the experiment The individual outcomes are called sample points or elementary events.

Possible outcomes of throwing an ordinary dice=6, namely 1 to 6. Sample space = S = {1, 2, 3, 4, 5, 6,} for throwing a dice (S is finite and discrete) S = {0, 1, 2, 3, } for counting the cars passing a g g given point (S is infinite but discrete) for measuring the S = {tt>0} response ti time of a f (S is continuous) computer system An event is subset of S as it is a collection of sample p p points

Universal Event: The entire sample space (S) is an


event called the universal event. Impossible Event: The empty set () is an event called the impossible event.

Outline of the Basic Procedure for Solving Problems


1. Identify the sample space, S. 2. 2 Assign the probabilities to the elements in S. 3. 3 Identify the events of interests interests. 4. Compute the desired probabilities

Example: To know probability that a random number generator will produce a value th t i b t ill d l that is prime (range 09999)
1. S={0, 1, 2, 3, 1 S={0 1 2 3 , 9999} 2. Pr [1] = Pr [2] = Pr [3] = .. = Pr [9999]=1/10000 3. 3 A = {2, 3, 5, .., 9967, 9973} {2 3 5 9967 (Prime numbers,Total = 1229) 4. Probability of elementary events in A

1229 = 0.1229 10000

Horse-Race with Five runners


Outcome : name of the winner 1. 1 S : set of all possible outcomes S : { A, B, C, D, E } 2. Assigned probabilities are as under:under:
Outcome A B C D E Assigned Probability 0.10 0.05 0.25 0.50 0.10 Winnings(amount) (W) 50 100 -30 -30 15

W is a random variable, amount to win or lose is shown

3.

Assigning Probabilities W(A) = 50, W(B) =100, W(C) = -30 etc. P(-30) ( 30) = Pr(C)+Pr(D) (C) ( ) = 0.25+0.50 = 0.75 P(15) = Pr(E) = 0.10 P(50) = Pr(A) = 0.10 P(100) = Pr(B) = 0.05 4. Expected winnings E(W) E(W) = -30p(-30)+15p(15)+50p(50)+100p(100) = -30(0.75)+15(0.10)+50(0.10)+100(0.05) = -22.5+1.50+5.0+5.0 = -22.50+11.50 = -11 Variance of X = Var[X] = E[(x-E[X])2] = p(x)(x-E[X])2 [ ] [( [ ]) p( )( [ ]) Var[W] = p(-30)x192 +p(15)x262+p(50)x612+p(100)x1112 = 1326.5 Standard deviation of W = sqrt(1326.5)=36.42 q ( ) E[W] allows to predict the average observed value of W and the variance serves to quantify how good this prediction is likely to be.

También podría gustarte