Discrete Str Notes

download Discrete Str Notes

of 20

Transcript of Discrete Str Notes

  • 8/22/2019 Discrete Str Notes

    1/20

    L e c t u r e N o t e s : M a t h e m a t i c a l / D i s c r e t e

    S t r u c t u r e s

    R a s h i d B i n M u h a m m a d , P h D .

    T h i s b o o k l e t i n c l u d e s l e c t u r e n o t e s , h o m e w o r k p r o b l e m s , a n d e x a m p r o b -

    l e m s f r o m d i s c r e t e s t r u c t u r e s c o u r s e I t a u g h t i n F a l l 2 0 0 6 a t t h e K e n t S t a t e

    U n i v e r s i t y , U S A . I w r o t e a g o o d p a r t o f t h e s e n o t e s i n F a l l 2 0 0 6 ; I r e v i s e t h e m

    e v e r y t i m e I t e a c h t h e c o u r s e . T h e p r o b l e m s i n t h e n o t e s h a v e b e e n u s e d i n

    c l a s s l e c t u r e s , h o m e w o r k a s s i g n m e n t s , o r e x a m s . Y o u c a n n d a c o l l e c t i o n o f

    h o m e w o r k a s s i g n m e n t s a n d e x a m s f r o m p a s t s e m e s t e r s o f m y c l a s s o n l i n e a t

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u / ~ r m u h a m m a / .

    P l e a s e d o n o t a s k f o r s o l u t i o n s . I f y o u a r e a s t u d e n t , t h e o n l y w a y t o l e a r n t h e

    m a t e r i a l i s s o l v e y o u r s e l f . I f y o u a r e a t e a c h e r , y o u s h o u l d n o t a s s i g n p r o b l e m s

    t h a t y o u c a n n o t s o l v e y o u r s e l f .

    C o p y r i g h t 2 0 0 6 - 2 0 1 1 R a s h i d B i n M u h a m m a d . L a s t U p d a t e F a l l 2 0 0 9 . T h i s w o r k m a y b e f r e e l y

    c o p i e d a n d d i s t r i b u t e d , e i t h e r e l e c t r o n i c a l l y o r o n p a p e r . I t m a y n o t b e s o l d f o r m o r e t h a n t h e

    a c t u a l c o s t o f r e p r o d u c t i o n , s t o r a g e , o r t r a n s m i t t a l . T h i s w o r k i s l i c e n s e d u n d e r a C r e a t i v e

    C o m m o n s A t t r i b u t i o n - N o n C o m m e r c i a l - S h a r e A l i k e 3 . 0 U n i t e d S t a t e s L i c e n s e .

    1

  • 8/22/2019 Discrete Str Notes

    2/20

    1 I N T R O D U C T I O N

    P r o p o s i t i o n a l L o g i c

    1 I n t r o d u c t i o n

    T h e a l g o r i t h m s i n c o m p u t e r s c i e n c e a n d p r o o f s i n m a t h e m a t i c s u s e l o g i c a l e x -

    p r e s s i o n s s u c h a s i f p t h e n q . T h e r e f o r e , i t i s n e c c e s s a r y t o k n o w t h e t r u t h v a l u e o f s u c h e x p r e s s i o n s , t h a t i s , t o k n o w t h e c a s e s i n w h i c h t h e s e e x p r e s s i o n s

    a r e e i t h e r t r u e o r f a l s e . W e d i s c u s s t h e s e i s s u e s i n t h i s l e c t u r e .

    1 . 1 P r o p o s i t i o n

    A p r o p o s i t i o n ( o r s t a t e m e n t ) i s a s e n t e n c e t h a t i s t r u e o r f a l s e b u t n o t b o t h .

    E x a m p l e . ( 1 ) 2+2 = 4 ( p r o p o s i t i o n ) . ( 2 ) 5+2 = 7 ( p r o p o s i t i o n ) . ( 3 ) x+2 = 7( n o t a p r o p o s i t i o n ) . ( 4 ) H e w i l l g o t o s c h o o l . ( n o t a p r o p o s i t i o n ) .

    1 . 2 C o m p o u n d P r o p o s i t i o n

    M a n y p r o p o s i t i o n s a r e c o m p o s i t e , t h a t i s , c o m p o s e d o f s u b p r o p o s i t i o n s a n d

    v a r i o u s c o n n e c t i v e s . S u c h c o m p o s i t e p r o p o s i t i o n s a r e c a l l e d c o m p o u n d p r o p o -

    s i t i o n s .

    1 . 3 P r i m i t i v e P r o p o s i t i o n

    I f p r o p o s i t i o n c a n n o t b e b r o k e n d o w n i n t o s i m p l e r p r o p o s i t i o n s , t h a t i s , i f i t i s

    n o t c o m p o s i t e .

    1 . 4 B a s i c L o g i c a l O p e r a t i o n s

    T h i s s e c t i o n d i s c u s s e s t h e t h r e e b a s i c l o g i c a l o p e r a t i o n s o f c o n j u n c t i o n , d i s j u n c -

    t i o n , a n d n e g a t i o n .

    1 . 4 . 1 C o n j u n c t i o n

    I f p a n d q a r e p r o p o s i t i o n v a r i a b l e s , t h e c o n j u n c t i o n o f p a n d q i s p a n d q. I t i s t r u e w h e n , a n d o n l y w h e n , b o t h p a n d q a r e t r u e . I f e i t h e r p o r q i s f a l s e , o r i f b o t h a r e f a l s e , p q i s f a l s e .

    p q p qT T T

    T F F

    F T F

    F F F

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 2 o f 2 0

  • 8/22/2019 Discrete Str Notes

    3/20

    1 . 5 P r o p o s i t i o n F o r m 1 I N T R O D U C T I O N

    1 . 4 . 2 D i s j u n c t i o n

    I f

    pa n d

    qa r e p r o p o s i t i o n v a r i a b l e s , t h e d i s j u n c t i o n o f

    pa n d

    qi s

    po r

    q. I t i s

    t r u e w h e n a t l e a s t o n e o f p o r q i s t r u e a n d f a l s e o n l y w h e n b o t h p a n d q a r ef a l s e .

    p q p qT T T

    T F T

    F T T

    F F F

    1 . 4 . 3 N e g a t i o n

    I f

    pi s a p r o p o s i t i o n v a r i a b l e , t h e n e g a t i o n o f

    pi s n o t

    p o r I t i s n o t t h e c a s e

    t h a t p a n d d e n o t e d p. I t h a s o p p o s i t e t r u t h v a l u e f r o m p: i f p i s t r u e , p i sf a l s e ; i f p i s f a l s e , p i s t r u e .

    p pT F

    F T

    1 . 5 P r o p o s i t i o n F o r m

    A p r o p o s i t i o n f o r m i s a n e x p r e s s i o n m a d e u p o f p r o p o s i t i o n v a r i a b l e s a n d l o g i c a l

    c o n n e c t i v e s t h a t b e c o m e s a p r o p o s i t i o n w h e n a c t u a l p r o p o s i t i o n s a r e s u b s t i t u t e d

    f o r t h e c o m p o n e n t p r o p o s i t i o n v a r i a b l e . T h e t r u t h t a b l e f o r a g i v e n p r o p o s i t i o n

    f o r m d i s p l a y s t h e t r u t h v a l u e s t h a t c o r r e s p o n d t o t h e d i e r e n t c o m b i n a t i o n s o f

    t r u t h v a l u e s f o r t h e v a r i a b l e s .

    E x a m p l e . ( 1 ) (p q) (p q) . ( 2 ) (p q) r .

    1 . 6 L o g i c a l E q u i v a l e n c e

    T w o p r o p o s i t i o n f o r m s a r e c a l l e d l o g i c a l l y e q u i v a l e n t i f , a n d o n l y i f , t h e y h a v e

    i d e n t i c a l t r u t h v a l u e s f o r e a c h p o s s i b l e s u b s t i t u t i o n o f p r o p o s i t i o n s f o r t h e i r

    p r o p o s i t i o n v a r i a b l e s . T h e l o g i c a l e q u i v a l e n c e o f p r o p o s i t i o n f o r m s P a n d Q i sd e n o t e d b y w r i t i n g P Q.

    E x a m p l e . ( 1 ) D o u b l e N e g a t i v e P r o p e r t y : ( p) . ( 2 ) S h o w N o n e q u i v a l e n c e : (p q) a n d p q.

    1 . 6 . 1 D e M o r g a n ' s L a w s

    T h e f o l l o w i n g t w o l o g i c a l e q u i v a l e n c e s a r e k n o w n a s D e M o g a n ' s l a w s o f l o g i c .

    T h e n e g a t i o n o f a n a n d p r o p o s i t i o n i s l o g i c a l l y e q u i v a l e n t t o t h e o r p r o p o s i -

    t i o n i n w h i c h e a c h c o m p o n e n t i s n e g a t e d . S y m b o l i c a l l y , (p q) p q.O n t h e o t h e r h a n d , t h e n e g a t i o n o f a n o r p r o p o s i t i o n i s l o g i c a l l y e q u i v a l e n t

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 3 o f 2 0

  • 8/22/2019 Discrete Str Notes

    4/20

    1 . 7 T a u t o l o g i e s a n d C o n t r a d i c t i o n s 1 I N T R O D U C T I O N

    t o t h e a n d p r o p o s i t i o n i n w h i c h e a c h c o m p o n e n t i s n e g a t e d . S y m b o l i c a l l y ,

    (p q) p q.

    E x a m p l e . I n e q u a l i t i e s a n d D e M o r g a n ' s L a w s .

    1 . 7 T a u t o l o g i e s a n d C o n t r a d i c t i o n s

    A t a u t o l o g y i s a p r o p o s i t i o n f o r m t h a t i s a l w a y s t r u e r e g a r d l e s s o f t h e t r u t h

    v a l u e s o f t h e i n d i v i d u a l p r o p o s i t i o n s s u b s t i t u t e d f o r i t s p r o p o s i t i o n v a r i a b l e s . A

    p r o p o s i t i o n w h o s e f o r m i s a t a u t o l o g y i s c a l l e d a t a u t o l o g i c a l p r o p o s i t i o n .

    A c o n t r a d i c t i o n i s a p r o p o s i t i o n f o r m t h a t i s a l w a y s f a l s e r e g a r d l e s s o f t h e

    t r u t h v a l u e s o f t h e i n d i v i t u a l s t a t e e m n t s s u b s t i t u t e d f o r i t s p r o p o s i t i o n v a r i a b l e s .

    A p r o p o s i t i o n w h o s e f o r m i s a c o n t r a d i c t i o n i s c a l l e d a c o n t r a d i c t o r y p r o p o s i t i o n .

    E x a m p l e . ( 1 ) S h o w t h a t t h e p r o p o s i t i o n f o r m

    p p i s a t a u t o l o g y . ( 2 ) S h o w t h a t t h e p r o p o s i t i o n f o r m

    p pi s a c o n t r a d i c t i o n .

    1 . 8 L o g i c a l E q u i v a l e n c e s

    T h e o r e m 1 . G i v e n a n y p r o p o s i t i o n v a r i a b l e s p , q , a n d r , a t a u t o l o g y t a n d a

    c o n t r a d i c t i o n c , t h e f o l l o w i n g l o g i c a l e q u i v a l e n c e s h o l d :

    1 . C o m m u t a t i v e L a w s

    p q qp

    p q qp

    2 . A s s o c i a t i v e L a w s

    ( p q) r p (q r)

    ( p q) r p (q r)

    3 . D i s t r i b u t e d L a w s

    p (q r) (p q) (p r)

    p (q r) (p q) (p r)

    4 . I d e n t t i t y L a w s

    p t p

    p c p

    5 . N e g a t i o n L a w s

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 4 o f 2 0

  • 8/22/2019 Discrete Str Notes

    5/20

    1 . 9 C o n d i t i o n a l P r o p o s i t i o n 1 I N T R O D U C T I O N

    p p t

    p p c

    6 . D o u b l e N e g a t i o n L a w

    ( p) p

    7 . I d e m p o t e n t L a w s

    p p p

    p p p

    8 . D e M o r g a n ' s L a w s

    (p q) p q

    (p q) p q

    9 . U n i v e r s a l B o u n d L a w s

    p t t

    p c c

    1 0 . A b s o r p t i o n L a w s

    p (p q) pp (p q) p

    1 1 . N e g a t i o n s o f t a n d c

    t c

    c t

    1 . 9 C o n d i t i o n a l P r o p o s i t i o n

    I f p a n d q a r e p r o p o s i t i o n v a r i a b l e s , t h e c o n d i t i o n a l o f q b y p i s i f p t h e n qo r p i m p l i e s q. I t i s f a l s e w h e n p i s t r u e a n d q i s f a l s e ; o t h e r w i s e i t i s t r u e .M o r e o v e r , t h e n e g a t i o n o f i f p t h e n q i s l o g i c a l l y e q u i v a l e n t t o p a n d n o t q.

    E x e r c i s e . ( 1 ) T r u t h t a b l e f o r p q p. ( 2 ) S h o w t h a t p q r (p r) (q r). ( 3 ) S h o w t h a t p q p q. ( 4 ) S h o w t h a t (p q) p q.

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 5 o f 2 0

  • 8/22/2019 Discrete Str Notes

    6/20

    2 P R O P O S I T I O N A L F U N C T I O N S

    1 . 9 . 1 C o n t r a p o s i t i v e P r o p o s i t i o n

    T h e c o n t r a p o s i t i v e o f a c o n d i t i o n a l p r o p o s i t i o n o f t h e f o r m i f

    pt h e n

    q i s i f

    q t h e n p.

    F a c t . A c o n d i t i o n a l p r o p o s i t i o n i s l o g i c a l l y e q u i v a l e n t t o i t s c o n t r a p o s i t i v e .

    1 . 9 . 2 C o n v e r s e a n d I n v e r s e P r o p o s i t i o n s

    S u p p o s e a c o n d i t i o n a l p r o p o s i t i o n o f t h e f o r m i f

    pt h e n

    q i s g i v e n . T h e n , t h e

    c o n v e r s e i s i f

    qt h e n

    p a n d t h e i n v e r s e i s i f p t h e n q.

    F a c t . A c o n d t i o n a l p r o p o s i t i o n i s n o t l o g i c a l l y e q u i v a l e n t t o i t s c o n v e r s e a n d t o

    i t s i n v e r s e .

    1 . 9 . 3 B i c o n d i t i o n a l P r o p o s i t i o n

    G i v e n p r o p o s i t i o n v a r i a b l e p a n d q, t h e b i c o n d i t i o n a l o f p a n d q i s p i f a n d o n l y i f q. I t i s t r u e i f b o t h p a n d q h a v e t h e s a m e t r u t h v a l u e s a n d i s f a l s e i f p a n dq h a v e o p p o s i t e t r u t h v a l u e s .

    p q p qT T T

    T F F

    F T F

    F F T

    1 . 9 . 4 N e c e s s a r y a n d S u c i e n t C o n d i t i o n s

    I f

    ra n d

    sa r e p r o p o s i t i o n s :

    1 .

    ri s a s u c i e n t c o n d i t i o n f o r

    sm e a n s i f

    rt h e n

    s.

    2 . r i s a n e c e s s a r y c o n d i t i o n f o r s m e a n s i f r t h e n s .

    E x a m p l e . S h o w t h a t r i s a n e c e s s a r y c o n d i t i o n f o r s a l s o m e a n s i f

    st h e n

    r.

    P r e d i c a t e L o g i c

    2 P r o p o s i t i o n a l F u n c t i o n s

    A p r o p o s i t i o n a l f u n c t i o n ( o r p r e d i c a t e ) i s a s e n t e n c e t h a t c o n t a i n s a n i t e v a r i -

    a b l e s a n d b e c o m e s a p r o p o s i t i o n w h e n s p e c i c v a l u e s a r e s u b s t i t u t e d f o r t h e

    v a r i a b l e s . T h e d o m a i n o f a p r o p o s i t i o n a l f u n c t i o n v a r i a b l e i s t h e s e t o f a l l

    v a l u e s t h a t m a y b e s u b s t i t u e d i n p l a c e o f t h e v a r i a b l e .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 6 o f 2 0

  • 8/22/2019 Discrete Str Notes

    7/20

    2 . 1 T r u t h S e t 3 Q U A N T I F I E R S

    2 . 1 T r u t h S e t

    I f

    P(x)i s a p r o p o s i t i o n a l f u n c t i o n a n d

    xh a s d o m a i n D , t h e t r u t h s e t o f

    P(x)i s

    t h e s e t o f a l l e l e m e n t s o f D t h a t m a k e P(x) t r u e w h e n s u b s t i t u t e d f o r x. T h e t r u t h s e t o f

    P(x) i s d e n o t e d {x D | P(x)}.

    N o t a t i o n . S u p p o s e P(x) a n d Q(x) b e p r o p o s i t i o n a l f u n c t i o n s a n d a l s o s u p p o s e t h e c o m m o n d o m a i n o f x i s D . T h e n o a t i o n P(x) Q(x) m e a n s t h a t e v e r y e l e m e n t i n t h e t r u t h s e t o f P(x) i s i n t h e t r u t h s e t o f Q(x) . T h e n o t a t i o n P(x) Q(x) m e a n s t h a t P(x) a n d Q(x) h a v e i d e n t i c a l t r u t h s e t s .

    3 Q u a n t i e r s

    O n e w a y t o o b t a i n p r o p o s i t i o n f r o m p r o p o s i t i o n a l f u n c t i o n s i s t o a d d q u a n t i e r s .

    3 . 1 U n i v e r s a l Q u a n t i c a t i o n

    S u p p o s e Q(x) b e a p r o p o s i t i o n a l f u n c t i o n a n d D t h e d o m a i n o f x. A u n i v e r s a l p r o p o s i t i o n i s a p r o p o s i t i o n o f t h e f o r m x D, Q(x). T h e u n i v e r s a l p r o p o s i - t i o n i s d e n e d t o b e t r u e i f a n d o n l y i f Q(x) i s t r u e f o r e v e r y x i n D . I t i s d e n e d t o b e f a l s e i f a n d o n l y i f Q(x) i s f a l s e f o r a t l e a s t o n e x i n D . T h e s y m b o l d e n o t e s f o r a l l a n d i s c a l l e d t h e u n i v e r s a l q u a n t i e r .

    N o t e . A v a l u e f o r

    xf o r w h i c h

    Q(x) i s f a l s e i s c a l l e d a c o u n t e r e x a m p l e t o t h e u n i v e r s a l p r o p o s i t i o n .

    3 . 2 E x i s t e n t i a l Q u a n t i c a t i o n

    S u p p o s e Q(x) b e a p r o p o s i t i o n a l f u n c t i o n a n d D t h e d o m a i n o f x. A n e x i s - t e n t i a l p r o p o s i t i o n i s a p r o p o s i t i o n o f t h e f o r m x D s u c h t h a t Q(x) . T h e e x i s t e n t i a l p r o p o s i t i o n i s d e n e d t o b e t r u e i f a n d o n l y i f Q(x) i s t r u e f o r a t l e a s t o n e x i n D . I t i s f a l s e i f a n d o n l y i f Q(x) i s f a l s e f o r a l l x i n D . T h e s y m b o l e d e n o t e s t h e r e e x i s t s a n d i s c a l l e d t h e e x i s t e n t i a l q u a n t i e r .

    3 . 3 U n i v e r s a l C o n d i t i o n a l P r o p o s i t i o n

    O n e o f t h e m o s t i m p o r t a n t f o r m s b o t h i n m a t h e m a t i c s a n d i n c o m p u t e r s c i e n c e

    i s t h e u n i v e r s a l c o n d i t i o n a l p r o p o s i t i o n : x, i f P(x) t h e n Q(x) .

    E x a m p l e . A s a n e x a m p l e , t h e i n f o m a l p r o p o s i t i o n i f a r e a l n u m b e r i s g r e a t e r

    t h e n 2 t h e n i t s s q u a r e i s g r e a t e r t h a n 4 c a n b e w r i t t e n f o r m a l l y a s x R, i fx > 2 t h e n x2 > 4 .

    3 . 3 . 1 N e g a t i o n o f U n i v e r s a l P r o p o s i t i o n

    T h e n e g a t i o n o f a p r o p o s o t i o n x D, Q(x) i s x D s u c h t h a t Q(x).

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 7 o f 2 0

  • 8/22/2019 Discrete Str Notes

    8/20

    4 M E T H O D S O F P R O O F

    3 . 3 . 2 N e g a t i o n o f E x i s t e n t i a l P r o p o s i t i o n

    T h e n e g a t i o n o f t h e e x i s t e n t i a l p r o p o s i t i o n

    x Ds u c h t h a t

    Q(x) i s

    x D,

    Q(x) .

    3 . 3 . 3 N e g a t i o n o f U n i v e r s a l C o n d i t i o n a l P r o p o s i t i o n

    T h e n e g a t i o n o f t h e u n i v e r a l p r o p o s i t i o n x, P(x) t h e n Q(x) i s x s u c h t h a t P(x) a n d Q(x).

    4 M e t h o d s o f P r o o f

    M a t h e m a t i c s , a s a s c i e n c e , c o m m e n c e d w h e n r s t s o m e o n e , p r o b -

    a b l y a G r e e k , p r o v e d p r o p o s i t i o n s a b o u t a n y t h i n g s o r a b o u t s o m e

    t h i n g s w i t h o u t s p e c i c a t i o n o f d e n i t e p a r t i c u l a r t h i n g s - A . N .

    W h i t e h e a d .

    4 . 1 D e n i t i o n s

    Y o u m u s t c l e a r l y u n d e r s t a n d w h a t t h e p r o p o s i t i o n i s a b o u t t o e v a l u a t e i t s t r u t h

    o r f a l s i t y . M a t h e m a t i c i a n s d e n e t e r m s p e r c i s e l y s o c o n s i d e r i t i m p o r t a n t t o

    l e a r n d e n i t i o n s v i r t u a l l y w o r d f o r w o r d .

    A n i n t e g e r n i s e v e n i f a n d o n l y i f n = 2k f o r s o m e i n t e g e r k .

    A n i n t e g e r n i s o d d i f a n d o n l y i f n = 2k + 1 f o r s o m e i n t e g e r k .

    A n i n t e g e r n i s p r i m e i f a n d o n l y i f n > 1 a n d f o r a l l p o s i t i v e i n t e g e r s ra n d s, i f n = r.s, t h e n r = 1 o r s = 1 .

    A n i n t e g e r n i s c o m p o s i t e i f a n d o n l y i f n = r s f o r s o m e p o s i t i v e i n t e g e r s r a n d s w i t h r = 1 a n d s = 1 .

    A r e a l n u m b e r r i s r a t i o n a l i f a n d o n l y i f r = a/b f o r s o m e i n t e g e r s a a n db w i t h b = 0 . A r e a l n u m b e r t h a t i s n o t r a t i o n a l i s i r r a t i o n a l .

    I f n a n d d a r e i n t e g e r s a n d d = 0 , t h e n n i s d i v i s i b l e b y d i f a n d o n l y i f n = d k f o r s o m e i n t e g e r k . N o t e t h a t t h e n o t a t i o n d | n i s r e a d d d i v i d e s n

    .

    G i v e n a n y i n t e g e r n a n d p o s i t i v e i n t e g e r d, t h e r e e x i s t u n i q u e i n t e g e r qa n d r s u c h t h a t n = d q+ r a n d 0 r < d. [ T h e Q u o t i e n t - R e m a i n d e r T h e o r e m ]

    G i v e n a n o n n e g a t i v e i n t e g e r n a n d a p o s i t i v e i n t e g e r d, n d i v d e q u a l s t h e i n t e g e r q u o t i e n t o b t a i n e d w h e n

    ni s d i v i d e d b y

    d, a n d

    nm o d

    de q u a l s t h e

    i n t e g e r r e m a i n d e r o b t a i n d e d w h e n n i s d i v i d e d b y d.

    G i v e n a n y r e a l n u m b e r x, t h e o o r o f x, d e n o t e d x, i s t h a t u n i q u e i n t e g e r n s u c h t h a t n x < n + 1 .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 8 o f 2 0

  • 8/22/2019 Discrete Str Notes

    9/20

    4 . 2 D i r e c t P r o o f 4 M E T H O D S O F P R O O F

    G i v e n a n y r e a l n u m b e r x, t h e c e i l i n g o f x, d e n o t e d x, i s t h a t u n i q u e i n t e g e r n s u c h t h a t n 1 < x n.

    4 . 2 D i r e c t P r o o f

    P r o v e t h a t i f t h e s u m o f a n y t w o i n t e g e r s i s e v e n t h e n s o i s t h e i r

    d i e r e n c e .

    T h e o r e m 2 . i n t e g e r s m a n d n, i f m + n i s e v e n t h e n m n i s e v e n .

    P r o o f . S u p p o s e m a n d n a r e i n t e g e r s s o t h a t m + n i s e v e n . B y d e n i t i o n o f e v e n , m + n = 2k f o r s o m e i n t e g e r k . S u b t r a c t i n g n f r o m b o t h s i d e s g i v e s m = 2k n. S o , m n = (2k n) n = 2k 2n = 2(k n) . B u t k n i sa n i n t e g e r b e c a u s e i t i s a d i e r e n c e o f i n t e g e r s . H e n c e ,

    m n e q u a l s 2 t i m e s a n i n t e g e r , a n d s o b y d e n i t i o n o f e v e n ,

    m n i s e v e n .

    P r o v e t h a t t h e s u m o f a n y t w o r a t i o n a l n u m b e r s i s r a t i o n a l .

    T h e o r e m 3 . r e a l n u m b e r s r a n d s, i f r a n d s a r e r a t i o n a l t h e n r + s i sr a t i o n a l .

    P r o o f . S u p p o s e r a n d s a r e r a t i o n a l r u m b e r s . T h e n b y d e n i t i o n o f r a t i o n a l ,r = a/b a n d s = c/d f o r s o m e i n t e g e r s a, b , c, a n d d w i t h b = 0 a n d d = 0 . S or + s = a

    b+ c

    d= ad+bc

    bd. L e t p = ad + bc a n d q = bd. T h e n p a n d q a r e i n t e g e r s

    b e c a u s e p r o d u c t s a n d s u m s o f i n t e g e r s a r e i n t e g e r s a n d b e c a u s e a, b, c, a n d da r e a l l i n t e g e r s . T h u s , r + s = p

    qw h e r e p a n d q a r e i n t e g e r s a n d q = 0 . S o , r + s

    i s r a t i o n a l b y d e n i t i o n o f a r a t i o n a l n u m b e r .

    P r o v e t h e t r a n s i t i v e p r o p e r t y o f d i v i s i b i l i t y .

    T h e o r e m 4 . i n t e g e r s a, b , a n d c, i f a d i v i d e s b a n d b d i v i d e s c, t h e n a d i v i d e s c

    .

    P r o o f . S u p p o s e a, b , a n d c a r e i n t e g e r s s u c h t h a t a d i v i d e s b a n d b d i v i d e s c.B y d e n i t i o n o f d i v i s i b i l i t y ,

    b = a r a n d c = b s f o r s o m e i n t e g e r s r a n d s . B ys u b s t i t u t i o n

    c = b s = (a r) s = a (r s). L e t k i s a n i n t e g e r s i n c e i t i s a p r o d u c t o f i n t e g e r s , a n d t h e r e f o r e

    c = a k w h e r e k i s a n i n t e g e r . T h u s a d i v i d e s c b y d e n i t i o n o f d i v i s i b i l i t y .

    P r o v e t h a t g i v e n a n y t w o c o n s e c u t i v e i n t e g e r s , o n e i s e v e n a n d t h e

    o t h e r i s o d d .

    T h e o r e m 5 . A n y t w o c o n s e c u t i v e i n t e g e r s h a v e o p p o s i t e p a r i t y .

    P r o o f . S u p p o s e t h a t t w o c o n s e c u t i v e i n t e g e r s m a n d m + 1 a r e g i v e n . B y t h e p a r i t y p r o p e r t y , e i t h e r m i s e v e n o r m i s o d d .

    C a s e 1 ( m i s e v e n ) : I n t h i s c a s e , m = 2k f o r s o m e i n t e g e r k , a n d s o m + 1 =2k + 1 , w h i c h i s o d d . H e n c e , i n t h i s c a s e o n e o f m a n d m + 1 i s e v e n a n d t h e o t h e r i s o d d .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 9 o f 2 0

  • 8/22/2019 Discrete Str Notes

    10/20

    4 . 2 D i r e c t P r o o f 4 M E T H O D S O F P R O O F

    C a s e 2 ( m i s o d d ) : I n t h i s c a s e , m = 2k + 1 f o r s o m e i n t e g e r k , a n d s o m + 1 = (2k + 1) + 1 = 2k + 2 = 2(k + 1) . B u t k + 1 i s a n i n t e g e r b e c a u s e i t i s a s u m o f t w o i n t e g e r s . T h e r e f o r e , m + 1 e q u a l s t w i c e s o m e i n t e g e r , a n d t h u s m + 1 i s e v e n . H e n c e , i n t h i s c a s e a l s o o n e o f m a n d m + 1 i s e v e n a n d t h e o t h e r i s o d d .

    I t f o l l o w s t h a t r e g a r d l e s s o f w h i c h c a s e a c t u a l l y o c c u r s f o r t h e p a r t i c u l a r ma n d m + 1 t h a t a r e c h o s e n , o n e o f m a n d m + 1 i s e v e n a n d t h e o t h e r i s o d d .

    M o d u l o 4 I n t e g e r s R e p r e s e n t a t i o n

    C l a i m . W e s a y t h a t a n y i n t e g e r c a n b e w r i t t e n i n o n e o f t h e f o u r f o r m s :

    n = 4qo r n = 4q+ 1 o r n = 4q+ 2 o r n = 4q+ 3 f o r s o m e i n t e g e r q.

    P r o o f . G i v e n a n y i n t e g e r n, a p p l y t h e q u o t i e n t - r e m a i n d e r t h e o r e m t o n w i t h d = 4. T h i s i m p l i e s t h a t t h e r e e x i s t a n i n t e g e r q u o t i e n t q a n d a r e m a i n d e r rs u c h t h a t n = 4 q+ r a n d 0 r < 4 . B u t t h e o n l y n o n n e g a t i v e r e m a i n d e r s rt h a t a r e l e s s t h a n 4 a r e 0 , 1 , 2 , a n d 3 . H e n c e , n = 4q o r n = 4q+ 1 o r n = 4q+ 2o r n = 4q+ 3 f o r s o m e i n t e g e r q.

    T h e s q u a r e o f a n y o d d i n t e g e r h a s t h e f o r m 8m + 1 f o r s o m e i n t e g e r m .

    T h e o r e m 6 . o d d i n t e g e r s n , a n i n t e g e r m s u c h t h a t n2 = 8m + 1.

    P r o o f . S u p p o s e n i s a o d d i n t e g e r . B y t h e q u o t i e n t - r e m a i n d e r t h e o r e m , n c a nb e w r i t t e n i n o n e o f t h e f o r m s : n = 4q o r n = 4q+ 1 o r n = 4q+ 2 o r n = 4q+ 3f o r s o m e i n t e g e r

    q. I n f a c t , s i n c e

    ni s o d d a n d 4q a n d 4q+ 2 a r e e v e n , n m u s t

    h a v e o n e o f t h e f o r m s :

    n = 4q+ 1 o r n = 4q+ 3 .C a s e 1 (

    n = 4q+ 1 f o r s o m e i n t e g e r q) : S i n c e n = 4q+ 3 , n2 = (4q+ 1)2 =(4q+ 1)(4q+ 1) = 16q2 + 8q+ 1 = 8(2q2 + q) + 1 . L e t m = 2q2 + q. T h e n mi s a n i n t e g e r s i n c e 2 a n d q a r e i n t e g e r s a n d s u m s a n d p r o d u c t s o f i n t e g e r s a r e i n t e g e r s . T h u s s u b s t i t u t i n g , n2 = 8m + 1 w h e r e m i s a n i n t e g e r .

    C a s e 2 ( n = 4q+ 3 f o r s o m e i n t e g e r q) : S i n c e n = 4q+ 3 , n2 = (4q+ 3)2 =(4q+3)(4q+3) = 16q2 + 24q+9 = 16q2 + 24q+(8 +1) = 8(2q2 + 3q+1)+1. L e t m = 2q2 + 3q+ 1. T h e n m i s a n i n t e g e r s i n c e 2 , 3 , a n d q a r e i n t e g e r s a n d s u m s a n d p r o d u c t s o f i n t e g e r s a r e i n t e g e r s . T h u s , s u b s t i t u t i n g , n2 = 8m + 1w h e r e mi s a n i n t e g e r .

    C a s e s 1 a n d 2 s h o w t h a t g i v e n a n y o d d i n t e g e r , w h e t h e r o f t h e f o r m 4q+ 1o r 4q+ 3 , n2 = 8m + 1 f o r s o m e i n t e g e r m.

    P r o v i n g a P r o p e r t y o f F l o o r

    T h e o r e m 7 . F o r a l l r e a l n u m b e r s x a n d a l l i n t e g e r s m , x + m = x + m.

    P r o o f . S u p p o s e a r e a l n u m b e r

    xi s a n d a n i n t e g e r

    ma r e g i v e n . L e t

    n = x .B y d e n i t i o n o f o o r ,

    ni s a n i n t e g e r a n d

    n x < n + 1 . A d d m t o a l l s i d e s t o o b t a i n n + m x + m < n + m + 1 . N o w n + m i s a n i n t e g e r , a n d s o b y d e n i t i o n o f o o r x + m = n + m . B u t n = x . H e n c e b y s u b s t i t u t i o n x + m = x + m.

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 0 o f 2 0

  • 8/22/2019 Discrete Str Notes

    11/20

    4 . 3 I n d i r e c t P r o o f 5 S E Q U E N C E

    4 . 3 I n d i r e c t P r o o f

    4 . 3 . 1 A r g u m e n t b y C o n t r a d i c t i o n

    T h e o r e m 8 . F o r a l l i n t e g e r s n, i f n2 i s o d d , t h e n n i s o d d .

    P r o o f . A s s u m e , t o t h e c o n t r a r y , t h a t a n i n t e g e r n s u c h t h a t n2 i s o d d a n d ni s e v e n . B y d e n i t i o n o f e v e n , n = 2 k f o r s o m e i n t e g e r k . S o , b y s u b s t i t u t i o n n n = (2k) (2k) = 2 (2 k k). L e t m = 2 k k . N o w m i s a n i n t e g e r b e c a u s e p r o d u c t s o f i n t e g e r s a r e i n t e g e r s ; a n d 2 a n d k a r e i n t e g e r s . H e n c e , n2 = 2 mf o r s o m e i n t e g e r m. S o , b y d e n i t i o n o f e v e n n2 i s e v e n . B u t t h i s c o n t r a d i c t s t h e s u p p o s i t i o n t h a t n2 i s o d d .

    4 . 3 . 2 A r g u m e n t b y C o n t r a p o s i t i o n

    T h e o r e m 9 . F o r a l l i n t e g e r s n, i f n2 i s o d d , t h e n n i s o d d .

    P r o o f . F o r m t h e c o n t r a p o s i t i v e o f t h e g i v e n p r o p o s i t i o n : F o r a l l i n t e g e r s n, i f ni s e v e n , t h e n n2 i s e v e n . N o w w e ' l l p r o v e t h e c o n t r a p o s i t i v e p r o p o s i t i o n u s i n g t h e m e t h o d o f d i r e c t p r o v e . S u p p o s e

    ni s i n t e g e r . B y d e n i t i o n o f e v e n

    n = 2 kf o r s o m e i n t e g e r

    k. S o , b y s u b s t i t u t i o n

    n n = (2k) (2k) = 2 (2 k k) . L e t m = 2 k k . N o w m i s a n i n t e g e r b e c a u s e p r o d u c t s o f i n t e g e r s a r e i n t e g e r s ; a n d 2 a n d k a r e i n t e g e r s . H e n c e , n2 = 2 m f o r s o m e i n t e g e r m . S o , b y d e n i t i o n o f e v e n n2 i s e v e n . H e n c e , t h e g i v e n p r o p o s i t i o n i s t r u e b y t h e l o g i c a l e q u i v a l e n c e b e t w e e n a p r o p o s i t i o n a n d i t s c o n t r a p o s i t i v e .

    S e q u e n c e s

    5 S e q u e n c e

    I n f o r m a l l y , t h e s e q u e n c e i s a s e t o f e l e m e n t s w r i t t e n i n a r o w . I n a s e q u e n c e

    am, am+1 , . . . , an , e a c h e l e m e n t ak i s c a l l e d a t e r m . T h e k i n ak i s c a l l e d a s u b s c r i p t o r i n d e x . A g e n e r a l f o r m u l a f o r a s e q u e n c e i s a r u l e t h a t s h o w s h o w

    t h e v a l u e s o f ak d e p e n d o n k .

    5 . 1 N o t a t i o n s

    S u m m a t i o n N o t a t i o n I f m a n d n a r e i n t e g e r s a n d m n, t h e n t h e s u m m a - t i o n f r o m k e q u a l s m t o n o f ak i s t h e s u m o f a l l t e r m s am, am+1 , . . . , an . W ew r i t e

    nk=m ak = am, am+1 , . . . , an a n d c a l l k t h e i n d e x o f t h e s u m m a t i o n , m

    t h e l o w e r l i m i t o f t h e s u m m a t i o n , a n d

    nt h e u p p e r l i m i t o f t h e s u m m a t i o n .

    E x a m p l e . L e t a1 = 2 , a2 = 1 , a3 = 0, a4 = 1, a n d a5 = 2. T h e n 5k=1 ak = a1 + a2 + a3 + a4 + a5 = (2) + (1) + 0 + 1 + 2 = 0 .

    W e c a n t r a n s f o r m a s u m b y a c h a n g e o f v a r i a b l e .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 1 o f 2 0

  • 8/22/2019 Discrete Str Notes

    12/20

    5 . 2 P r o p e r t i e s o f S u m m a t i o n s a n d P r o d u c t s 6 P R I N C I P L E O F M A T H E M A T I C A L I N D U C T I O N

    E x a m p l e . T r a n s f o r m t h e s u m m a t i o n

    6k=0

    1k+1 b y m a k i n g t h e s p e c i c c h a n g e

    o f v a r i a b l e : j = k + 1 .

    P r o d u c t N o t a t i o n I f m a n d n a r e i n t e g e r s a n d m n , t h e n t h e p r o d u c t f r o m

    ke q u a l s

    mt o

    no f

    ak i s t h e p r o d u c t o f a l l t e r m s am, am+1 , . . . , an . W ew r i t e

    nk=m ak = am am+1 . . . an a n d c a l l k t h e i n d e x o f t h e p r o d u c t , m t h e

    l o w e r l i m i t o f t h e p r o d u c t , a n d

    nt h e u p p e r l i m i t o f t h e p r o d u c t . F o r i n s t a n c e ,5

    k=1 k = 1 2 3 4 5 = 120.

    5 . 2 P r o p e r t i e s o f S u m m a t i o n s a n d P r o d u c t s

    T h e o r e m . I f

    am, am+1, am+2, . . . a n d bm, bm+1, bm+2, . . . a r e s e q u e n c e s o f r e a l n u m b e r s a n d

    ci s a n y r e a l n u m b e r , t h e n t h e f o l l o w i n g e q u a t i o n s h o l d f o r a n y

    i n t e g e r

    n m : 1 .n

    k=m ak +n

    k=m bk =n

    k=n(ak + bk) 2 . c n

    k=m c ak 3 .(n

    k=m

    ak) (n

    k=m

    bk) =n

    k=m

    (ak bk).

    E x a m p l e . U s i n g t h e p r o p e r t i e s o f s u m m a t i o n a n d p r o d u c t , w r i t e t h e f o l l o w i n g

    e x p r e s s i o n s a s a s i n g l e s u m m a t i o n o r p r o d u c t : ( 1 )

    nk=m ak + 2

    nk=m bk ( 2 )

    (n

    k=m ak) (n

    k=m bk) .

    5 . 3 F a c t o r i a l

    D e n i t i o n . F o r e a c h p o s i t i v e i n t e g e r

    n, t h e q u a n t i t y n f a c t o r i a l , d e n o t e d

    n! ,i s d e n e d t o b e t h e p r o d u c t o f a l l t h e i n t e g e r s f r o m 1 t o n . T h a t i s , n! =n (n 1) . (n 2) . . . 3 2 1 . Z e r o f a c t o r i a l i s d e n e d t o b e 1 . T h a t i s , 0! = 1 .

    N o t e . T h e f o l l o w i n g f o r m u l a h o l d s f o r e a c h p o s i t i v e i n t e g e r n: n! = n (n 1)!

    6 P r i n c i p l e o f M a t h e m a t i c a l I n d u c t i o n

    L e t P(n) b e a p r o p o s i t i o n a l f u n c t i o n t h a t i s d e n e d f o r i n t e g e r s n, a n d l e t n0b e a x e d i n t e g e r . S u p p o s e t h e f o l l o w i n g t w o p r o p o s i t i o n s a r e t r u e : ( 1 ) P(n0)i s t r u e . ( 2 ) F o r a l l i n t e g e r s k n0 , i f P(k) i s t r u e t h e n P(k + 1) i s t r u e . T h e n t h e p r o p o s i t i o n f o r a l l i n t e g e r s n n0 , P(n) i s t r u e .

    L e m m a . F o r a l l i n t e g e r s n 1, 1 + 2 + . . . + n = n(n+1)2 .

    P r o o f . T h e f o r m u l a i s t r u e f o r n = 1 : T o e s t a b l i s h t h e f o r m u l a f o r n = 1, w e

    m u s t s h o w t h a t 1 = 1(1+1)2 =22 = 1 , a n d s o t h e f o r m u l a i s t r u e f o r n = 1 .

    I f t h e f o r m u l a i s t r u e f o r n = k t h e n i t i s t r u e f o r n = k + 1 : S u p p o s e

    1 + 2 + . . . + k = k(k+1)2 , f o r s o m e i n t e g e r k 1. W e m u s t s h o w t h a t 1 + 2 + . . . +

    (k + 1) = (k+1)((k+1)+1)

    2, o r e q u i v a l e n t l y , t h a t 1 + 2 + . . . + (k + 1) = (k+1)(k+2)

    2.

    1 + 2 + . . . + (k + 1) = 1 + 2 + . . . + k + (k + 1) = k(k+1)2 + (k + 1) =k(k+1)

    2 +(k+1)2

    2 =(k+1)(k+2)

    2 .

    E x a m p l e . P r o v e t h a t

    ni=0 r

    i = rn+1

    1r1 , f o r a l l i n t e g e r s n 0 a n d a l l r e a l

    n u m b e r s r e x c e p t 1 .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 2 o f 2 0

  • 8/22/2019 Discrete Str Notes

    13/20

    7 F U N C T I O N S

    7 F u n c t i o n s

    A f u n c t i o n f f r o m a s e t X t o a s e t Y i s a r e l a t i o n s h i p b e t w e e n e l e m e n t s o f Xa n d e l e m e n t s o f

    Yw i t h t h e p r o p e r t y t h a t e a c h e l e m e n t o f

    Xi s r e l a t e d t o a

    u n i q u e e l e m e n t o f Y . T h e n o t a t i o n f : X Y m e a n s f i s a f u n c t i o n f r o m X t oY . T h e s e t X i s c a l l e d t h e d o m a i n o f f a n d t h e s e t Y i s c a l l e d t h e c o - d o m a i n o f f.

    G i v e n a n e l e m e n t x X, t h e r e i s a u n i q u e e l e m e n t y Y t h a t i s r e l a t e d t o x. W e c a n t h i n k o f x a s i n p u t a n d y a s t h e r e l a t e d o u t p u t . W e t h e n s a y fs e n d s x t o y . T h e u n i q u e e l e m e n t y t o w h i c h f s e n d s x i s d e n o t e d f(x) a n d i s c a l l e d f o f x, o r t h e v a l u e o f f a t x, o r t h e i m a g e o f x u n d e r f.

    T h e s e t o f a l l v a l u e s o f

    ft a k e n t o g e t h e r i s c a l l e d t h e r a n g e o f

    fo r t h e i m a g e

    o f

    Xu n d e r

    f. S y m b o l l i c a l l y : r a n g e o f

    f = { y Y | y = f(x) , f o r s o m e x i n X} .G i v e n a n e l e m e n t

    y Y , t h e r e m a y e x i s t e l e m e n t s i n X w i t h y a s t h e i r i m a g e .T h e s e t o f a l l s u c h e l e m e n t s i s c a l l e d t h e i n v e r s e i m a g e o f y . S y m b o l l i c a l l y :i n v e r s e i m a g e o f y = {x X | f(x) = y} .

    E x a m p l e . L e t

    X = {a,b,c} a n d Y = {1, 2, 3, 4} . D e n e a f u n c t i o n f f r o m Xt o Y b y s p e c i f y i n g t h a t f(a) = 2 , f(b) = 4, a n d f(c) = 2 . T h e n , d o m a i n o f f ={a,b,c} , c o - d o m a i n o f f = {1, 2, 3, 4} , r a n g e o f f = {2, 4}, i n v e r s e i m a g e o f 2 ={a, c} , i n v e r s e i m a g e o f 4 = {b} , i n v e r s e i m a g e o f 1 = a n d w e c a n r e p r e s e n t fa s a s e t o f o r d e r e d p a i r s : {(a, 2), (b, 4), (c, 2)} .

    7 . 1 I n j e c t i v e o r O n e - t o - O n e F u n c t i o n s

    L e t F b e a f u n c t i o n f r o m a s e t X t o a s e t Y . F i s o n e - t o - o n e i f , a n d o n l y i f , f o r a l l e l e m e n t s x1 a n d x2 i n X, i f F(x1) = F(x2) , t h e n x1 = x2 . O r e q u i v a l e n t l y ,i f x1 = x2 , t h e n F(x1) = F(x2) .

    L e t F b e a f u n c t i o n f r o m a s e t X t o a s e t Y . F i s not o n e - t o - o n e i f , a n d o n l y i f , e l e m e n t s x1 a n d x2 i n X w i t h F(x1) = F(x2) a n d x1 = x2 .

    E x a m p l e . L e t X = {1, 2, 3} a n d Y = {a,b,c,d} . D e n e H : X Y b ys p e c i f y i n g t h a t H(1) = c, H(2) = a, a n d H(3) = d . D e n e K : X Y b ys p e c i f y i n g t h a t

    K(1) = d , K(2) = b , a n d K(3) = d. T h e n , H i s o n e - t o - o n e b e c a u s e e a c h o f t h e t h r e e e l e m e n t s o f d o m a i n o f

    Hi s s e n t b y

    Ht o a d i e r e n t

    e l e m e n t o f t h e c o - d o m a i n : H(1) = H(2), H(1) = H(3), a n d H(2) = H(3).H o w e v e r , K i s n o t o n e - t o - o n e b e c a u s e K(1) = K(3) = d b u t 1 = 3 .

    L e m m a . I f t h e f u n c t i o n

    f : R R i s d e n e d b y t h e r u l e f ( x ) = 4 x - 1 , f o r a l l r e a l n u m b e r s x , t h e n f i s o n e - t o - o n e

    P r o o f . S u p p o s e

    x1 a n d x2 a r e r e a l n u m b e r s s u c h t h a t f(x1) = f(x2). T h e n ,

    4x1 1 = 4x2 1 , A d d i n g 1 t o b o t h s i d e s g i v e s 4x1 = 4x2 , a n d d i v i d i n g b o t h s i d e s b y 4 g i v e s x1 = x2 , w h i c h i s r e q u i r e d .

    L e m m a . I f t h e f u n c t i o n

    g : Z Z i s d e n e d b y t h e r u l e g(n) = n2 , f o r a l l n Z, t h e n g i s n o t o n e - t o - o n e .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 3 o f 2 0

  • 8/22/2019 Discrete Str Notes

    14/20

    7 . 2 S u r j e c t i v e o r O n t o F u n c t i o n s 7 F U N C T I O N S

    P r o o f . ( b y c o u n t e r e x a m p l e ) L e t n1 = 2 a n d n2 = 2 . T h e n g(n1) = g(2) =22 = 4 a n d a l s o g(n2) = g(2) = (2)

    2 = 4. H e n c e , g(n1) = g(n2) b u t n1 = n2 ,a n d s o g i s n o t o n e - t o - o n e f u n c t i o n .

    7 . 2 S u r j e c t i v e o r O n t o F u n c t i o n s

    L e t F b e a f u n c t i o n f r o m a s e t X t o a s e t Y . F i s o n t o i f , a n d o n l y i f , g i v e n a n y e l e m e n t y i n Y i t i s p o s s i b l e t o n d a n e l e m e n t x i n X w i t h t h e p r o p e r t y t h a t y = F ( x ) .

    L e t F b e a f u n c t i o n f r o m a s e t X t o a s e t Y . F i s n o t o n t o i f , a n d o n l y i f ,y i n Y s u c h t h a t x X, F(x) = y .

    E x a m p l e . L e t X = {1, 2, 3, 4}a n d Y = {a,b,c} . D e n e H : X Y b ys p e c i f y i n g t h a t H(1) = c, H(2) = a, H(3) = c, a n d H(4) = b . D e n e K :X Y b y s p e c i f y i n g t h a t K(1) = c, K(2) = b, a n d K(4) = c. T h e n , H i so n t o b e c a u s e e a c h o f t h e t h r e e e l e m e n t s o f t h e c o - d o m a i n o f H i s t h e i m a g e o f s o m e e l e m e n t o f t h e d o m a i n o f

    H:

    a = H(2), b = H(4), a n d c = H(1) = H(3).H o w e v e r , K i s n o t o n t o b e c a u s e a = K(x) f o r a n y x i n {1, 2, 3, 4} .

    L e m m a . I f

    f : R R i s t h e f u n c t i o n d e n e d b y t h e r u l e f(x) = 4x 1 f o r a l lr e a l n u m b e r s

    x, t h e n

    fi s o n t o .

    P r o o f . L e t

    y R. L e t x = y+14 . T h e n x i s a r e a l n u m b e r s i n c e s u m s a n d q u o t i e n t s ( o t h e r t h a n b y 0 ) o f r e a l n u m b e r s a r e r e a l n u m b e r s . I t f o l l o w s t h a t

    f(x) = fy+14

    = 4

    y+14

    1 = (y + 1) 1 = y .

    L e m m a . I f t h e f u n c t i o n

    h : Z Z i s d e n e d b y t h e r u l e h(n) = 4n 1 f o r a l li n t e g e r s

    n, t h e n

    hi s n o t o n t o .

    P r o o f . ( b y c o u n t e r e x a m p l e ) T h e c o - d o m a i n o f

    hi s

    Za n d

    0 Z. B u t

    h(n) = 0f o r a n y i n t e g e r

    n. F o r i f

    h(n) = 0, t h e n 4n 1 = 0 b y d e n i t i o n o f h, w h i c h i s 4n 1 o r n = 14 . B u t

    14 i s n o t a n i n t e g e r . H e n c e , t h e r e i s n o i n t e g e r

    nf o r w h i c h

    f(n) = 0 , a n d s o f i s n o t o n t o .

    7 . 3 B i j e c t i o n o r o n e - t o - o n e c o r r e s p o u n d e n c e

    A b i j e c t i o n f r o m a s e t X t o a s e t Y i s a f u n c t i o n F : X Y t h a t i s b o t h o n e - t o - o n e a n d o n t o .

    7 . 4 I n v e r s e F u n c t i o n

    S u p p o s e F : X Y i s a b i j e c t i o n ; t h a t i s , s u p p o s e F i s o n e - t o - o n e a n d o n t o .T h e n t h e r e i s a f u n c t i o n

    F1

    : Y Xt h a t i s d e n e d a s f o l l o w s : G i v e n a n y

    e l e m e n t y i n Y , F1(y) i s t h a t u n i q u e e l e m e n t x i n X s u c h t h a t F(x) e q u a l s y .T h e f u n c t i o n F1 i s c a l l e d t h e i n v e r s e f u n c t i o n o f F.

    E x a m p l e . T h e f u n c t i o n f : R R d e n e d b y t h e f o r m u l a f(x) = 4x 1f o r a l l r e a l n u m b e r s x. T h e n b y d e n i t i o n o f f1 , f1(y) = t h a t u n i q u e r e a l

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 4 o f 2 0

  • 8/22/2019 Discrete Str Notes

    15/20

    7 . 5 P i g e o n h o l e P r i n c i p l e 7 F U N C T I O N S

    n u m b e r y s u c h t h a t f(x) = y . B u t f(x) = y 4x 1 = y x = y+14 . H e n c e ,

    f1(y) = y+1

    4

    , w h i c h i s t h e i n v e r s e f u n c t i o n o f t h e g i v e n f u n c t i o n f(x) = 4x 1 .

    L e m m a . I f X a n d Y a r e s e t s a n d F : X Y i s b i j e c t i o n ( t h a t i s , o n e - t o - o n e a n d o n t o ) , t h e n F1 : Y Y i s a l s o b i j e c t i o n .

    P r o o f .

    F1i s o n e - t o - o n e : S u p p o s e

    y1 a n d y2 a r e e l e m e n t s o f Y s u c h t h a t F1(y1) = F

    1(y2). L e t x = F1(y1) = F

    1(y2). T h e n , x X, a n d b y d e - n i t i o n o f F1 , F(x) = y1 s i n c e x = F

    1(y1) a n d F(x) = y2 s i n c e x = F1(y2) .

    C o n s e q u e n t l y , y1 = y2 s i n c e e a c h i s e q u a l t o F(x) .F1 i s o n t o : S u p p o s e x X. L e t y = F(x) . T h e n y Y , a n d b y d e n i t i o n

    o f F1 , F1(y) = x.

    7 . 5 P i g e o n h o l e P r i n c i p l e

    A f u n c t i o n f r o m o n e n i t e s e t t o a s m a l l e r n i t e s e t c a n n o t b e o n e - t o - o n e : T h e r e

    m u s t b e a t l e a s t t w o e l e m e n t s i n t h e d o m a i n t h a t h a v e t h e s a m e i m a g e i n t h e

    c o - d o m i a n .

    E x a m p l e . A g r o u p o f t h i r t e e n p e o p l e m u s t c o n t a i n a t l e a s t t w o w h o w e r e b o r n

    i n t h e s a m e m o n t h , f o r t h e r e a r e o n l y t w e l v e m o n t h s i n a y e a r a n d 13 > 12 .

    T h e t r u t h o f t h e p i g e o n h o l e p r i n c i p l e d e p e n d s o n t h e s e t s b e i n g n i t e . S o ,

    t h e d e n i t i o n s o f n i t e a n d i n n i t e s e t s a r e a s f o l l o w s :

    D e n i t i o n . A s e t i s c a l l e d n i t e i f , a n d o n l y i f , i t i s t h e e m p t y s e t o r t h e r e i s a

    o n e - t o - o n e c o r r e s p o n d e n c e f r o m {1, 2, . . . , n} t o i t , w h e r e n i s a p o s i t i v e i n t e g e r .I n t h e r s t c a s e , t h e n u m b e r o f e l e m e n t s i n t h e s e t i s s a i d t o b e 0 , a n d i n t h e s e c o n d c a s e i t i s s a i d t o b e n. A s e t t h a t i s n o t n i t e i s c a l l e d i n n i t e .

    L e m m a . F o r a n y f u n t i o n

    f f r o m a n i t e s e t

    Xt o a n i t e s e t

    Y, i f

    n(X) >

    n(Y), t h e n f i s n o t o n e - t o - o n e .

    P r o o f . S u p p o s e f i s a n y f u n c t i o n f r o m a n i t e s e t X t o a n i t e s e t Y w h e r e n(X) > n(Y). L e t n(Y) = m , a n d d e n o t e t h e e l e m e n t s o f Y b y y1, y2, . . . , ym .R e c a l l t h a t f o r e a c h

    yi i n Y , t h e i n v e r s e i m a g e s e t f1(yi) = {x X : f(x) = yi} .

    N o w c o n s i d e r t h e c o l l e c t i o n o f a l l t h e i n v e r s e i m a g e s e t s f o r a l l t h e e l e m e n t s o f

    Y : f1(y1), f1(y2), . . . , f

    1(ym). B y d e n i t i o n o f f u n c t i o n , e a c h e l e m e n t o f X i s s e n t b y f t o s o m e e l e m e n t o f Y . H e n c e , e a c h e l e m e n t o f X i s o n e o f t h e i n v e r s e i m a g e s e t s , a n d s o t h e u n i o n o f a l l t h e s e s e t s e q u a l s X. B u t a l s o b y d e n i t i o n o f f u n c t i o n , n o e l e m e n t o f X i s s e n t b y f t o m o r e t h a n o n e e l e m e n t o f Y . T h u s e a c h e l e m e n t o f X i s i n o n l y o n e o f t h e i n v e r s e i m a g e s e t s , a n d s o t h e i n v e r s e i m a g e s e t s a r e m u t u a l l y d i s j o i n t . T h e r e f o r e , b y t h e a d d i t i o n r u l e ,

    n(X) = n(f1(y1)) + n(f1(y2)) + . . . + n(f1(ym)) ( E q u a t i o n 1 ) .N o w s u p p o s e t h a t

    fi s o n e - t o - o n e . T h e n , e a c h s e t

    f1

    (yi)h a s a t m o s t o n e

    e l e m e n t , a n d s o

    n(f1(y1))+ n(f1(y2))+ . . .+n(f

    1(ym)) 1+1+. . .+1 = m( E q u a t i o n 2 ) .

    P u t t i n g E q u a t i o n 1 a n d E q u a t i o n 2 t o g a t h e r g i v e s t h a t n(X) m = n(Y) .T h i s c o n t r a d i c t s t h e f a c t t h a t n(X) > n(Y) , a n d s o t h e s u p p o s i t i o n t h a t f i so n e - t o - o n e m u s t b e f a l s e . H e n c e , f i s n o t o n e - t o - o n e .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 5 o f 2 0

  • 8/22/2019 Discrete Str Notes

    16/20

    7 . 6 C o m p o s i t i o n o f F u n c t i o n s 8 R E C U R S I O N

    7 . 6 C o m p o s i t i o n o f F u n c t i o n s

    L e t

    f : X Y

    a n d

    g : Y Zb e f u n c t i o n s w i t h t h e p r o p e r t y t h a t t h e r a n g e o f

    f i s a s u b s e t o f t h e d o m a i n o f g . D e n e a n e w f u n c t i o n g f : X Z a s f o l l o w s :(g f)(x) = g(f(x)) f o r a l l x X. T h e f u n c t i o n g f i s c a l l e d t h e c o m p o s i t i o n o f

    fa n d

    g.

    E x a m p l e . L e t f : Z Z b e t h e s u c c e s s o r f u n c t i o n a n d l e t g : Z Z b e t h e s q u a r i n g f u n c t i o n . T h e n

    f(n) = n + 1 f o r a l l n Z a n d g(n) = n2 f o r a l l n Z.T h e f u n c t i o n

    g f a n d f g a r e d e n e d a s f o l l o w s : (g f)(n) = g(f(n)) =g(n + 1) = (n + 1)2 f o r a l l n Z, a n d (f g) = f(g(n)) = f(n2) = n2 + 1 f o r a l l n Z.

    T w o f u n c t i o n s f r o m o n e s e t t o a n o t h e r a r e e q u a l i f , a n d o n l y i f , t h e y t a k e t h e

    s a m e v a l u e s . I n t h i s c a s e , (gf)(1) = (1+1)2 = 4 , w h e r e a s (fg)(1) = 12+1 = 2 .T h u s , t h e t w o f u n c t i o n s g f a n d f g a r e n o t e q u a l : g f = f g .

    T h e a b o v e e x a m p l e i l l u s t r a t e s t h e i m p o r t a n t f a c t t h a t c o m p o s i t i o n o f f u n c -

    t i o n s i s n o t a c o m m u t a t i v e o p e r a t i o n : f o r g e n e r a l f u n c t i o n s F a n d G, FG n e e d n o t n e c e s s a r i l y e q u a l G F , a l t h o u g h t h e t w o m a y b e e q u a l .

    E x e r c i s e . L e t X = {1, 2, 3} , Y = {a,b,c,d} , Y = {a,b,c,d,e} , Z = {x, y, z} .D e n e f u n c t i o n s f : X Y a n d g : Y Z a s f(1) = c, f(2) = b , f(3) = a,a n d g(a) = y , g(b) = y , g(c) = z , g(d) = z , a n d g(e) = z . F i n d t h e a r r o w d i a g r a m f o r g f a n d n d t h e r a n g e o f g f.

    L e m m a . I f f : X Y a n d g : Y Z a r e b o t h o n e - t o - o n e f u n c t i o n s , t h e n g fi s o n e - t o - o n e .

    P r o o f . S u p p o s e f : X Y a n d g : Y Z a r e b o t h o n e - t o - o n e f u n c t i o n s .S u p p o s e

    x1a n d

    x2a r e e l e m e n t s o f

    Xs u c h t h a t

    (g f)(x1) = (g f)(x2). B y

    d e n i t i o n o f c o m p o s i t i o n o f f u n c t i o n s , g(f(x1)) = g(f(x2)). S i n c e g i s o n e - t o - o n e , f(x1) = f(x2) . A n d s i n c e f i s o n e - t o - o n e , x1 = x2 .

    L e m m a . I f f : X Y a n d g : Y Z a r e b o t h o n t o f u n c t i o n s , t h e n g f i so n t o .

    P r o o f . S u p p o s e f : X Y a n d g : Y Z a r e b o t h o n t o f u n c t i o n s . L e t z b ea e l e m e n t o f Z. S i n c e g i s o n t o , t h e r e i s a n e l e m e n t y i n Y s u c h t h a t g(y) = z .A n d s i n c e f i s o n t o , t h e r e i s a n e l e m e n t x i n X s u c h t h a t f(x) = y . H e n c e ,t h e r e e x i s t s a n e l e m e n t x i n X s u c h t h a t (g f)(x) = g(f(x)) = g(y) = z. I tf o l l o w s t h a t

    g f i s o n t o .

    8 R e c u r s i o n

    A r e c u r r e n c e r e l a t i o n f o r a s e q u e n c e a1, a2, a3, . . . i s a f o r m u l a t h a t r e l a t e s e a c h t e r m ak t o c e r t a i n o f i t s p r e d e c e s s o r s ak1, ak2, . . . , aki, w h e r e i i s a x e d i n t e g e r a n d k i s a n y i n t e g e r g r e a t e r t h a n o r e q u a l t o i. T h e i n i t i a l c o n d i t i o n s f o r s u c h a r e c u r r e n c e r e l a t i o n s p e c i f y t h e v a l u e s o f a0, a1, a2, . . . , ai1 .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 6 o f 2 0

  • 8/22/2019 Discrete Str Notes

    17/20

    8 . 1 I t e r a t i o n M e t h o d 8 R E C U R S I O N

    F o r e x a m p l e , a s e q u e n c e b0, b1, b2, . . . c a n b e d e n e d r e c u r s i v e l y a s f o l l o w s :F o r a l l i n t e g e r k 2, bk = bk1 + bk2 ( r e c u r r e n c e r e l a t i o n ) a n d b0 = 1 ,

    b1 = 3 ( i n i t i a l c o n d i t i o n s ) . S i n c e b0 a n d b1 a r e g i v e n , b2 c a n b e c o m p u t e d u s i n g r e c u r r e n c e r e l a t i o n . b2 = b1+b0 = 3+1 = 4 . T h e n , s i n c e b o t h b1 a n d b2 a r e n o w k n o w n , b3 c a n b e c o m p u t e d u s i n g r e c u r r e n c e r e l a t i o n . b3 = b2 + b1 = 4+ 3 = 7 .I n g e n e r a l , t h e r e c u r r e n c e r e l a t i o n s a y s t h a t a n y t e r m o f t h e s e q u e n c e a f t e r b

    i s t h e s u m o f t h e t w o p r e c e d i n g t e r m s . T h u s , b4 = b3 + b2 = 7 + 4 = 11, b5 =b4 + b3 = 11 + 7 = 18 , a n d s o f o r t h .

    8 . 1 I t e r a t i o n M e t h o d

    A n e x p l i c i t f o r m u l a f o r t h e s e q u e n c e , w h o s e r e c u r r e n c e r e l a t i o n a n d i n i t i a l c o n -

    d i t i o n s a r e g i v e n , i s c a l l e d a s o l u t i o n t o t h e r e c u r r e n c e r e l a t i o n . T h e b a s i c

    m e t h o d f o r n d i n g a n e x p l i c i t f o r m u l a ( i . e . , s o l u t i o n ) f o r a r e c u r s i v e l y d e n e d

    s e q u e n c e i s i t e r a t i o n . T h e f o l l o w i n g e x a m p l e s h o w s t h e w o r k i n g o f t h e m e o t h o d

    o f i t e r a t i o n .

    l e t a0, a1, a2, . . . b e t h e s e q u e n c e d e n e d r e c u r s i v e l y a s f o l l o w s : F o r a l l i n t e - g e r s k 1 , ak = ak1 + 2 ( r e c u r r e n c e r e l a t i o n ) a0 = 1 ( i n i t i a l c o n d i t i o n ) . W e u s e i t e r a t i o n t o g u e s s a n e x p l i c i t f o r m u l a f o r t h e s e q u e n c e .

    R e c a l l t h a t t o s a y ak = ak1 + 2 f o r a l l i n t e g e r s k 1 m e a n s n o m a t t e r w h a t p o s i t i v e i n t e g e r i s r e p l a c e d k . I n p a r t i c u l a r , a1 = a0 + 2, a2 = a1 +2, a3 = a2 + 2 , a n d s o f o r t h . N o w u s e t h e i n i t i a l c o n d i t i o n t o b e g i n a p r o c e s s o f s u c c e s s i v e s u b s t i t u t i o n s i n t o t h e s e e q u a t i o n s , n o t j u s t o f n u m b e r s b u t o f

    n u m e r i c a l e x p r e s s i o n s . H e r e ' s h o w t h e p r o c e s s w o r k s f o r t h e g i v e n s e q u e n c e :

    a0 = 1a1 = a0 + 2 = 1 + 2a2 = a1 + 2 = (1 + 2) + 2 = 1 + 2 + 2

    a3 = a2 + 2 = (1 + 2 + 2) + 2 = 1 + 2 + 2 + 2a4 = a3 + 2 = (1 + 2 + 2 + 2) + 2 = 1 + 2 + 2 + 2 + 2W e u s e t h e s h o r t h a n d k 2 i n p l a c e o f 2 + 2 + . . . + 2 ( k i t e m s ) , s o s t a r t i n g

    f r o m a0 .a0 = 1 = 1 + 0 2a1 = a0 + 2 = 1 + 2 = 1 + 1 2a2 = a1 + 2 = (1 + 2) + 2 = 1 + 2 + 2 = 1 + 2 2a3 = a2 + 2 = (1 + 2 + 2) + 2 = 1 + 2 + 2 + 2 = 1 + 3 2a4 = a3 + 2 = (1 + 2 + 2 + 2) + 2 = 1 + 2 + 2 + 2 + 2 = 1 + 4 2a5 = a4 + 2 = (1 + 2 + 2+ 2 + 2) + 2 = 1 + 2 + 2 + 2 + 2+ 2 = 1 + 5 2S o t h e g u e s s i s :

    an = 1 + n 2 = 1 + 2nT h e a n s w e r o b t a i n e d f o r t h i s p r o b l e m i s j u s t a g u e s s . T o b e s u r e o f t h e

    c o r r e c t n e s s o f t h i s g u e s s , y o u w i l l n e e d t o c h e c k i t b y m a t h e m a t i c a l i n d u c t i o n .

    T h e s e q u e n c e l i k e t h e o n e i n t h e a b o v e e x a m p l e , i n w h i c h e a c h t e r m e q u a l s

    t h e p r e v i o u s t e r m p l u s a x e d c o n s t a n t , i s c a l l e d a n a r i t h m e t i c s e q u e n c e .

    D e n i t i o n . A s e q u e n c e a0, a1, a2, . . . i s c a l l e d a n a r i t h m e t i c s e q u e n c e i f a n d o n l y i f t h e r e i s a c o n s t a n t

    ds u c h t h a t

    ak = ak1 + d f o r a l l i n t e g e r s k 1. O r

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 7 o f 2 0

  • 8/22/2019 Discrete Str Notes

    18/20

    9 R E L A T I O N S

    e q u i v a l e n t l y , an = a0 + d n f o r a l l i n t e g e r s n 0 .

    I n a g e o m e t r i c s e q u e n c e , e a c h t e r m e q u a l s t h e p r e v i o u s t e r m t i m e s a x e d

    c o n s t a n t .

    D e n i t i o n . A s e q u e n c e

    a0, a1, a2, . . . i s c a l l e d a g e o m e t r i c s e q u e n c e i f a n d o n l y i f t h e r e i s a c o n s t a n t

    rs u c h t h a t

    ak = r ak1 f o r a l l i n t e g e r s k 1. O re q u i v a l e n t l y , an = a0 r

    nf o r a l l i n t e g e r s n 0 .

    E x e r c i s e . L e t

    rb e a x e d n o n z e r o c o n s t a n t a n d s u p p o s e a s e q u e n c e

    a0, a1, a2, . . .i s d e n e d r e c u r s i v e l y a s f o l l o w s :

    ak = r ak1 f o r a l l i n t e g e r s k 1, a0 = a. U s ei t e r a t i o n t o g u e s s a n e x p l i c i t f o r m u l a f o r t h i s s e q u e n c e .

    9 R e l a t i o n s

    L e t A a n d B b e s e t s . A ( b i n a r y ) r e l a t i o n R f r o m A t o B i s a s u b s e t A B .G i v e n a n o r d e r e d p a i r (x, y) i n A B , x i s r e l a t e d t o y b y R, w r i t t e n xRy , i fa n d o n l y i f (x, y) i s i n R.

    F o r i n s t a n c e , l e t

    A = {0, 1, 2} a n d B = {1, 2, 3} . L e t u s s a y t h a t a n e l e m e n t x i n A i s r e l a t e d t o a n e l e m e n t y i n B i f a n d o n l y i f x i s l e s s t h a n y . T h e n 0R1 s i n c e 0 < 1 , 0R2 s i n c e 0 < 2, 0R3 s i n c e 0 < 3 , 1R2 s i n c e 1 < 2 , 1R3s i n c e 1 < 3 , a n d 2R3 s i n c e 2 < 3 . R e c a l l t h a t t h e C a r t e s i a n p r o d u c t o f A a n dB , A B , c o n s i s t s o f a l l o r d e r e d p a i r s w h o s e r s t e l e m e n t i s i n A a n d w h o s e s e c o n d e l e m e n t i s i n B : A B = {(x, y) : x A y B} . I n t h i s c a s e , A B ={(0, 1), (0, 2), (0, 3), (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)} . T h e e l e m e n t s o f s o m e o r d e r e d p a i r s i n A B a r e r e l a t e d w h i l e t h e e l e m e n t s o f o t h e r o r d e r e d p a i r s a r e n o t . C o n s i d e r t h e s e t o f a l l o r d e r e d p a i r s i n A B w h o s e e l e m e n t s a r e r e l a t e d : {(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)} . O b s e r v e t h a t k n o w i n g w h i c h o r d e r e d p a i r s l i e i n t h i s s e t i s e q u i v a l e n t t o k n o w i n g w h i c h e l e m e n t s a r e r e l a t e d

    t o w h i c h .

    E x a m p l e . L e t

    A = {1, 2} a n d B = {1, 2, 3} a n d d e n e a b i n a r y r e l a t i o n R f r o m A t o B a s f o l l o w s : g i v e n a n y ( x , y ) A B , ( x , y ) R i f a n d o n l y i f xy i s e v e n .T h e n A B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}. T o d e t e r m i n e e x p l i c i t l y t h e c o m p o s i t i o n o f R, e x a m i n e e a c h o r d e r e d p a i r i n A B t o s e e w h e t h e r i t s e l e m e n t s s a t i s f y t h e d e n i n g c o n d i t i o n o f R. (1, 1) R b e c a u s e 1 1 = 0 a n d0 i s e v e n , (1, 2) / R b e c a u s e 1 2 = 1 a n d 1 i s n o t e v e n , (1, 3) R b e c a u s e 1 3 = 2 a n d 2 i s e v e n , (2, 1) / R b e c a u s e 2 1 = 1 a n d 1 i s n o t e v e n ,(2, 2) R b e c a u s e 2 2 = 0 a n d 0 i s e v e n , a n d (2, 3) / R b e c a u s e 2 3 = 1a n d 1 i s n o t e v e n . T h u s , R = {(1, 1), (1, 3), (2, 2)} .

    G e n e r a l i z e t h e r e l a t i o n i n t h e a b o v e e x a m p l e t o t h e s e t o f a l l i n t e g e r s

    Z. T h a t

    i s , d e n e a b i n a r y r e l a t i o n E f r o m Z t o Z a s f o l l o w s : f o r a l l (m, n) Z Z,mEn i f a n d o n l y i f m n i s e v e n . T h e n , 4E0 b e c a u s e 4 0 = 4 a n d 4 i s e v e n . . .

    a n d s o f o r t h . N o w w e ' l l s h o w t h a t i f

    ni s o d d t h e n w e h a v e

    nE1 .

    L e m m a . I f n i s a n y o d d i n t e g e r , t h e n nE1.

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 8 o f 2 0

  • 8/22/2019 Discrete Str Notes

    19/20

    9 . 1 F u n c t i o n s 9 R E L A T I O N S

    P r o o f . S u p p o s e n i s n a y o d d i n t e g e r . T h e n n = 2k + 1 f o r s o m e i n t e g e r k .N o w b y d e n i t i o n o f E, nE1 i f a n d o n l y i f n 1 i s e v e n . B u t b y s u b s t i t u t i o n ,

    n 1 = (2k + 1) 1 = 2 k , a n d s i n c e k i s a n i n t e g e r , 2k i s e v e n . H e n c e nE1.

    E x e r c i s e . D e n e a b i n a r y r e l a t i o n C f r o m R t o R a s f o l l o w s : f o r a n y (x, y) RR, (x, y) C i f a n d o n l y i f x2 + y2 = 1.

    9 . 1 F u n c t i o n s

    A f u n c t i o n F f r o m a s e t A t o a s e t B i s a r e l a t i o n f r o m A t o B t h a t s a t i s e s t h e f o l l o w i n g t w o p r o p e r t i e s : ( 1 ) F o r e v e r y e l e m e n t x i n A, t h e r e i s a n e l e m e n t y i n B s u c h t h a t (x, y) F. ( 2 ) F o r a l l e l e m e n t s x i n A a n d y a n d z i n B , i f(x, y) F a n d (x, z) F, t h e n y = z . I f F i s a f u n c t i o n f r o m A t o B , w e w r i t e y = F(x) i f a n d o n l y i f (x, y) F.

    E x a m p l e . L e t

    A = {2, 4, 6}a n d

    B = {1, 3, 5}. T h e r e l a t i o n s

    Rd e n e a s

    R = {(2, 5), (4, 1), (4, 3), (6, 5)} a n d t h e r e l a t i o n S d e n e a s f o r a l l (x, y) A B, (x, y) S i f a n d o n l y i f y = x + 1 . T h e n , t h e r e l a t i o n R i s n o t a f u n c t i o n b e c a u s e i t d o e s n o t s a t i s f y p r o p e r t y ( 2 ) . T h e o r d e r e d p a i r s (4, 1) a n d (4, 3)h a v e t h e s a m e r s t e l e m e n t b u t d i e r e n t s e c o n d e l e m e n t s . T h e r e l a t i o n

    Si s n o t

    a f u n c t i o n b e c a u s e i t d o e s n o t s a t i s f y p r o p e r t y ( 1 ) . I t i s n o t t r u e t h a t e v e r y

    e l e m e n t o f A i s t h e r s t e l e m e n t o f a n o r d e r e d p a i r i n S. F o r e x a m p l e , 6 Ab u t t h e r e i s n o y i n B s u c h t h a t y = 6 + 1 = 7 .

    E x e r c i s e . ( a ) D e n e a r e l a t i o n f r o m R t o R a s f o l l o w s : f o r a l l (x, y) R R, (x, y) C i f a n d o n l y i f x2 + y2 = 1. ( b ) D e n e a r e l a t i o n f r o m R t o R a sf o l l o w s : f o r a l l (x, y) R R, (x, y) L i f a n d o n l y i f y = x 1. W h i c h o n e Co r L i s a f u n c t i o n ?

    9 . 2 I n v e r s e R e l a t i o n

    L e t R b e a r e l a t i o n f r o m A t o B . D e n e t h e i n v e r s e r e l a t i o n R1 f r o m B t o Aa s f o l l o w s : R1 = {(y, x) B A : (x, y) R} .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 1 9 o f 2 0

  • 8/22/2019 Discrete Str Notes

    20/20

    R E F E R E N C E S R E F E R E N C E S

    R e f e r e n c e s

    [ 1 ] K e n n e t h A . R o s s a n d C h a r l e s R . B . W r i g h t , D i s c r e t e M a t h e m a t i c s , 5 t h

    E d i t i o n , P e a r s o n E d u c a t i o n I n c . , 2 0 0 3 .

    [ 2 ] S u s a n n a S . E p p , D i s c r e t e M a t h e m a t i c s w i t h A p p l i c a t i o n s , P W S P u b l i s h i n g

    C o m p a n y , B o s t o n , M A , 1 9 9 5

    [ 3 ] . S e y m o u r L i p s c h u t z a n d M a r c L i p s o n , S c h a u m ' s O u t l i n e o f T h e o r y a n d

    P r o b l e m s o f D i s c r e t e M a t h e m a t i c s , M c G r a w - H i l l , 1 9 9 7 .

    D i s c r e t e S t r u c t u r e L e c t u r e N o t e s b y R a s h i d B i n M u h a m m a d , P h D .

    h t t p : / / w w w . p e r s o n a l . k e n t . e d u /

    r m u h a m m a /

    P a g e 2 0 o f 2 0