dm - qa

download dm - qa

of 127

Transcript of dm - qa

  • 8/22/2019 dm - qa

    1/127

    1

    Solutions

    Problem 1.1

    Indicate which of the following sentences are propositions.a. 1,024 is the smallest four-digit number that is perfect square.b. She is a mathematics major.c. 128 = 26

    d. x = 26.

    Solution.

    a. Proposition with truth value (T). Note that 322

    = 1024 and 312

    = 961.b. Not a proposition since the truth or falsity of the sentence depends on thereference for the pronoun she. For some values of she the statement istrue; for others it is false.c. A proposition with truth value (F).d. Not a proposition

    Problem 1.2

    Consider the propositions:

    p: Juan is a math major.q: Juan is a computer science major.

    Use symbolic connectives to represent the proposition Juan is a math majorbut not a computer science major.

    Solution.

    p q

    Problem 1.3

    In the following sentence is the word or used in its inclusive or exclusive

    sense? A team wins the playoffs if it wins two games in a row or a total ofthree games.

    Solution.

    Exclusive

  • 8/22/2019 dm - qa

    2/127

    2

    Problem 1.4

    Write the truth table for the proposition: (p

    (p

    q

    )) (q

    r)

    .

    Solution.

    Let s = (p ( p q)) (q r).p q r p r p q q r (q r) p ( p q) sT T T F F T F T T TT T F F T T T F T FT F T F F F F T T TT F F F T F F T T TF T T T F T F T T TF T F T T T T F T FF F T T F T F T T TF F F T T T F T T T

    Problem 1.5

    Let t be a tautology. Show that p t t.Solution.

    p t p tT T TF T T

    Problem 1.6

    Let c be a contradiction. Show that p c p.Solution.

    p c p cT F T

    F F F

    Problem 1.7

    Show that (r p) (( r (p q)) (r q)) p q.

  • 8/22/2019 dm - qa

    3/127

    3

    Solution.

    Lets

    = (r (

    p

    q)) (

    r

    q)

    .

    p q r r p r q r (p q) s (r p) s p qT T T T T T T T TT T F T T T T T TT F T T T F F F FT F F T F T F F FF T T T T F F F FF T F F T T F F FF F T T T F F F FF F F F F T F F F

    Problem 1.8

    Use De Morgans laws to write the negation for the proposition:This com-puter program has a logical error in the first ten lines or it is being run withan incomplete data set.

    Solution.

    This computer program is error free in the first ten lines and it is being runwith complete data.

    Problem 1.9

    Use De Morgans laws to write the negation for the proposition:The dollaris at an all-time high and the stock market is at a record low.

    Solution.

    The dollar is not at an all-time high or the stock market is not at a recordlow.

    Problem 1.10

    Assume x R. Use De Morgans laws to write the negation for the proposition:0 x > 5.

    Solution.

    x 5 or x > 0.

  • 8/22/2019 dm - qa

    4/127

    4

    Problem 1.11

    Show that the propositions

    = (p

    q

    ) (p

    (p

    q)) is a tautology.

    Solution.

    p q p q p (p q) p q sT T F F F T TT F F T T F TF T T F T F TF F T T T F T

    Problem 1.12

    Show that the proposition s = (p q) ( p q) is a contradiction.

    Solution.

    p q p q p q) p q sT T F F F T FT F F T T F FF T T F F T FF F T T F T F

    Problem 1.13

    a. Find simpler proposition forms that are logically equivalent to p p andp (p p).b. Is (p q) r p (q r)? Justify your answer.c. Is (p q) r (p r) (q r)? Justify your answer.

    Solution.

    a. Constructing the truth table for p p we find

    p p pT FF F

    Hence, p p c, where c is a contradiction.Now, (p p) p c p p.

  • 8/22/2019 dm - qa

    5/127

    5

    b. (p q) r p (q r) because of the following truth table.

    p q r p q (p q) r p (q r)T T T F T TT T F F F FT F T T T = FT F F T T TF T T T T = FF T F T T TF F T T T TF F F F F F

    c. (p

    q)

    r

    (p

    r)

    (q

    r) because of the following truth table.

    p q r p q (p q) r (p r) (q r)T T T F F FT T F F F = TT F T T T TT F F T F FF T T T T TF T F T F FF F T T T = FF F F F F F

    Problem 1.14Show the following:a. p t p, where t is a tautology.b. p c c, where c is a contradiction.c. t c and c t.d. p p p and p p p.Solution.

    a.p t p tT T T

    F T Fb.

    p c p cT F FF F F

  • 8/22/2019 dm - qa

    6/127

    6

    c.t

    t c

    T F FT F F

    c c tF T TF T T

    d.p p pT TF F

    p p pT TF F

  • 8/22/2019 dm - qa

    7/127

    7

    Problem 2.1

    Rewrite the following proposition in if-then form: This loop will repeatexactly N times if it does not contain a stop or a go to.

    Solution.

    If this loop does not contain a stop or a go to then it will repeat exactly Ntimes.

    Problem 2.2

    Construct the truth table for the proposition: p q r.Solution.

    p q r p p q p q rT T T F T TT T F F T FT F T F F TT F F F F TF T T T T TF T F T T FF F T T T TF F F T T F

    Problem 2.3

    Construct the truth table for the proposition: (p r) (q r).Solution.

    p q r p r q r (p r) (q r)T T T T T TT T F F F TT F T T T TT F F F T F

    F T T T T TF T F T F FF F T T T TF F F T T T

  • 8/22/2019 dm - qa

    8/127

    8

    Problem 2.4

    Write negations for each of the following propositions. (Assume that all vari-ables represent fixed quantities or entities, as appropriate.)

    a. IfP is a square, then P is a rectangle.b. If today is Thanksgiving, then tomorrow is Friday.c. Ifr is rational, then the decimal expansion of r is repeating.d. Ifn is prime, then n is odd or n is 2.e. Ifx 0, then x > 0 or x = 0.f. If Tom is Anns father, then Jim is her uncle and Sue is her aunt.g. Ifn is divisible by 6, then n is divisible by 2 and n is divisible by 3.

    Solution.a. P is a square and P is not a rectangle.b. Today is Thanksgiving and tomorrow is not Friday.c. r is rational and its decimal expansion is not repeating.d. n is prime and both n is not odd and is not 2.e. x 0 and both x 0 and x = 0.f. Tom is Anns father and either Jim is not her uncle or Sue is not her aunt.g. n is divisible by 6 and either n is not divisible by 2 or n is not divisibleby 3

    Problem 2.5

    Write the contrapositives for the propositions of problem ??

    Solution.

    a. IfP is not a rectangle, then P is not a square.b. If tomorrow is not Friday, then today is not Thanksgiving.c. If the decimal expansion of r is not repeating, then r is not rational.d. Ifn is even and n = 2, then n is not prime.e. Ifx < 0, then x is negative.f. If either Jim is not Anns uncle or Sue is not her aunt, then Tom is nother father.

    g. If either n is not divisible by 2 or n is not divisible by 3 then n is notdivisible by 6

    Problem 2.6

    Write the converse and inverse for the propositions of problem ??

  • 8/22/2019 dm - qa

    9/127

    9

    Solution.

    a. converse : IfP

    is a rectangle, then P is a square.inverse : If P is not a square, then P is not a rectangle.b. converse : If tomorrow is Friday, then today is Thanksgiving.inverse; If today is not Thanksgiving, then tomorrow is not Friday.c. converse : If the decimal expansion of r is repeating, then r is rational.inverse : If r is not rational, then its decimal expansion is not repeating.d. converse: If n is odd or n = 2, then n is prime.inverse : If n is not prime, then both n is even and n = 2.e. converse : If x 0, then x is nonnegative.inverse : If x is negative, then x < 0.f. converse : If either Jim is Anns uncle or Sue is her aunt, then Tom is her

    father.inverse : If Tom is not Anns father, then neither Jim is her uncle nor Sue isher aunt.g. converse : If n is divisible by 2 and n is divisible by 3 then n is divisibleby 6.inverse : If n is not divisible by 6, then either n is not divisible by 2 or n isnot divisible by 3

    Problem 2.7

    Use the contrapositive to rewrite the proposition The Cubs will win thepenant only if they win tomorrows game in if-then form in two ways.

    Solution.

    If the cubs do not win tomorrows game then they will not win the pennant.If the cubs win the pennant then they will win tomorrows game

    Problem 2.8

    Rewrite the proposition : Catching the 8:05 bus is sufficient condition formy being on time for work in if-then form.

    Solution.

    If I catch the 8:05 bus then I am on time for work

    Problem 2.9

    Use the contrapositive to rewrite the proposition being divisible by 3 is anecessary condition for this number to be divisible by 9 in if-then form intwo ways.

  • 8/22/2019 dm - qa

    10/127

    10

    Solution.

    If this number is divisible by 9 then it is divisible by 3.If this number is not divisible by 3, then it is not divisible by 9

    Problem 2.10

    Rewrite the proposition A sufficient condition for Hals team to win thechampionship is that it wins the rest of the games in if-then form.

    Solution.

    If Hals team wins the rest of the games, then it will win the championship

    Problem 2.11

    Rewrite the proposition A necessary condition for this computer programto be correct is that it not produce error messages during translation inif-then form.

    Solution.

    If the computer program does not produce error messages during translationthen this program is correct

  • 8/22/2019 dm - qa

    11/127

    11

    Problem 3.1

    Use modus ponens or modus tollens to fill in the blanks in the argumentbelow so as to produce valid inferences.

    If

    2 is rational, then

    2 = ab

    for some integers a and b.

    It is not true that

    2 = ab

    for some integers a and b.

    ..

    Solution.

    If

    2 is rational, then

    2 = ab

    for some integers a and b.

    It is not true that

    2 =

    a

    b for some integersa

    andb.

    ..

    2 is not rational

    Problem 3.2

    Use modus ponens or modus tollens to fill in the blanks in the argumentbelow so as to produce valid inferences.

    If logic is easy, then I am a monkeys uncle.I am not a monkeys uncle...

    Solution.

    If logic is easy, then I am a monkeys uncle.I am not a monkeys uncle... Logic is not easy

    Problem 3.3

    Use truth table to determine whether the argument below is valid.

    p

    q

    q p.. p q

    Solution.

  • 8/22/2019 dm - qa

    12/127

    12

    The truth table is

    p q p q q p p qT T T T TT F F T TF T T F TF F T T F

    Because of the last row, the given argument is invalid

    Problem 3.4

    Use truth table to determine whether the argument below is valid.

    p

    p q q r

    .. r

    Solution.

    The truth table isp q r p q q rT T T T TT T F T F

    T F T F TT F F F TF T T T TF T F T FF F T T TF F F T T

    Because of the first row, the given argument is valid

    Problem 3.5

    Use symbols to write the logical form of the given argument and then use a

    truth table to test the argument for validity.

    If Tom is not on team A, then Hua is on team B.If Hua is not on team B, then Tom is on team A... Tom is not on team A or Hua is not on team B.

  • 8/22/2019 dm - qa

    13/127

    13

    Solution.

    Let p : Tom is on team A.q : Hua is on team B.

    Then the given argument is of the form

    p q q p

    .. p q

    The truth table is

    p q p q q p p qT T T T FT F T T TF T T T TF F F F T

    Because of the first row, the given argument is invalid

    Problem 3.6

    Use symbols to write the logical form of the given argument. If the argumentis valid, identify the rule of inference that quarantees its validity. Otherwise

    state whether the converse or the inverse error is made.

    If Jules solved this problem correctly, then Jules obtined the answer 2.Jules obtined the answer 2... Jules solved this problem correctly.

    Solution.

    Letp : Jules solved this problem correctly.q : Jules obtained the answer 2.

    Then the given argument is of the form

    p qq

    .. p

  • 8/22/2019 dm - qa

    14/127

    14

    Its truth table isp q p

    q

    T T TT F FF T TF F T

    From the third row we see that the argument is invalid. This argumentbecomes valid if p q is replaced by its converse q p. Thus, converseerror is made

    Problem 3.7

    Use symbols to write the logical form of the given argument. If the argument

    is valid, identify the rule of inference that quarantees its validity. Otherwisestate whether the converse or the inverse error is made.

    If this number is larger than 2, then its square is larger than 4.This number is not larger than 2... The square of this number is not larger than 4.

    Solution.

    Letp : T his number is larger than 2.q : The square of this number is larger than 4.

    Then the given argument is of the form

    p q p

    .. qIts truth table is

    p q p q p qT T T F FT F F F TF T T T FF F T T T

    From the third row we see that the argument is invalid. This argumentbecomes valid if p q is replaced by its inverse p q. Thus, inverseerror is made

  • 8/22/2019 dm - qa

    15/127

    15

    Problem 3.8

    Use the valid argument forms of this section to deduce the conclusion fromthe premises.

    p q rs q

    tp t

    p r s.. q

    Solution.

    (1) p t premise t premise

    .. p by modus tollens(2) p by (1).. p q by disjunctive addition

    (3) p q r premise p q by (2)

    .. r by modus ponens

    (4) p by (1)r by (3)

    .. p r by conjunctive addition(5) p r s premise

    p r by (4).. s by modus ponens

    (6) s q premise s by (5)

    .. q by disj unctive syllogism

    Problem 3.9

    Use the valid argument forms of this section to deduce the conclusion from

  • 8/22/2019 dm - qa

    16/127

    16

    the premises.

    p

    r

    s

    t su p

    wu w

    .. t w

    Solution.

    (1) w premiseu w premise

    .. u by disjunctive syllogism

    (2) u p premiseu by (1)

    .. p by modus ponens(3) p r s premise

    p by (2).. r s by modus ponens

    (4) r s by (3).. s by conjunctive simplification

    (5) t s premise s by (4)

    .. t by modus tollens(6) t by (5).. t w by disjunctive addition

  • 8/22/2019 dm - qa

    17/127

    17

    Problem 4.1

    By finding a counterexample, show that the proposition: For all positiveintegers n and m,m.n m + n is false.Solution.

    Let m = n = 1. Then m.n = 1 < m + n = 2.

    Problem 4.2

    Consider the statement

    x R such that x2 = 2.Which of the following are equivalent ways of expressing this statement?a. The square of each real number is 2.b. Some real numbers have square 2.c. The number x has square 2, for some real number x.d. Ifx is a real number, then x2 = 2.e. Some real number has square 2.f. There is at least one real number whose square is 2.

    Solution.

    (b), (c), (e), and (f) they mean the same thing

    Problem 4.3

    Rewrite the following propositions informally in at least two different ways

    without using the symbols and :a. squares x, x is a rectangle.b. a set A such that A has 16 subsets.Solution.

    a. All squares are rectangles.Every square is a rectangle.b. There exists a set A which has 16 subsets.Some sets have 16 subsets.

    Problem 4.4Rewrite each of the following statements in the form x such that :

    a. Some problems have answers.b. Some real numbers are rational.

  • 8/22/2019 dm - qa

    18/127

    18

    Solution.

    a. an problemx

    such thatx

    has an answer.b. x R such that x Q.Problem 4.5

    Rewrite each of the following statements in the form , if then .:

    a. All COBOL programs have at least 20 lines.b. Any valid argument with true premises has a true conclusion.c. The sum of any two even integers is even.d. The product of any two odd integers is odd.

    Solution.

    a. x, if x is a COBOL program then x has at least 20 lines.b. x, ifx is a valid argument with true premises then x has true conclusion.c. integers m and n, ifm and n are even then m + n is also an even integer.d. integers m and n, ifm and n are odd then m n is also an odd integer.Problem 4.6

    Which of the following is a negation for Every polynomial function is con-tinuous?

    a. No polynomial function is continuous.b. Some polynomial functions are continuous.c. Every polynomial function fails to be continuous.d. There is a noncontinuous polynomial function.

    Solution

    (b) and (d)

    Problem 4.7

    Determine whether the proposed negation is correct. If it is not, write acorrect negation.

    Proposition : For all integers n, if n2 is even then n is even.

    Proposed negation : For all integer n, if n2 is even then n is not even.

    Solution.

    Correct negation : There exists an integer n such that n2 is even and n isnot even

  • 8/22/2019 dm - qa

    19/127

    19

    Problem 4.8

    LetD

    = {48,14

    ,8

    ,0

    ,1

    ,3

    ,16

    ,23

    ,26

    ,32

    ,36}

    .Determine which of the fol-lowing propositions are true and which are false. Provide counterexamples

    for those propositions that are false.

    a. x D, if x is odd then x > 0.b. x D, if x is less than 0 then x is even.c. x D, if x is even then x 0.d. x D, if the ones digit of x is 2, then the tens digit is 3 or 4.e. x D, if the ones digit of x is 6, then the tens digit is 1 or 2

    Solution.

    a. True.b. True.c. False. 26 is even and positive.d. True.e. False. A counterexample is 36.

    Problem 4.9

    Write the negation of the proposition :x R, if x(x + 1) > 0 then x > 0 orx < 1.

    Solution.

    x R such that x(x + 1) > 0 and 1 x 0.Problem 4.10

    Write the negation of the proposition : If an integer is divisible by 2, then itis even.

    Solution.

    Note that the given proposition can be written in the form: n Z, if nis divisible by 2 then n is even. The negation to this proposition is: aninteger n such that n is divisible by 2 and n is not even.

    Problem 4.11Given the following true propostion: real numbers x, an integer n suchthat n > x. For each x given below, find an n to make the predicate n > xtrue.a. x = 15.83 b. x = 108 c. x = 1010

    10

    .

  • 8/22/2019 dm - qa

    20/127

    20

    Solution.

    a.n

    = 16 b.n

    = 10

    8

    + 1 c.n

    = 10

    1010

    + 1.

    Problem 4.12

    Given the proposition: x R, a real number y such that x + y = 0.

    a. Rewrite this proposition in English without the use of the quantifiers.b. Find the negation of the given proposition.

    Solution.

    a. For all real numbers x, there exists a real number y such that x + y = 0.b.

    x

    R,

    y

    R, x + y

    = 0.

    Problem 4.13

    Given the proposition: x R, y R, x + y = 0.

    a. Rewrite this proposition in English without the use of the quantifiers.b. Find the negation of the given proposition.

    Solution.

    a. There exists a real number x such that for all real numbers y we havex + y = 0.

    b. For every real number x there exists a real number y such that x + y = 0.

    Problem 4.14

    Consider the proposition Somebody is older than everybody. Rewrite thisproposition in the form a person x such that .

    Solution.

    a person x such that persons y, x is older than y.

    Problem 4.15Given the proposition: There exists a program that gives the correct answerto every question that is posed to it.a. Rewrite this proposition using quantifiers and variables.b. Find a negation for the given proposition.

  • 8/22/2019 dm - qa

    21/127

    21

    Solution.

    a. a programx

    such that questiony

    that is posed tox

    the program givesa correst answer.b. programs x, a question y for which the program gives a wrong answer.

    Problem 4.16

    Given the proposition: x R, y R such that x < y.a. Write a proposition by interchanging the symbols and .b. State which is true: the given proposition, the one in part (a), neither, orboth.

    Solution.a. x R, y R, x < y.b. The given proposition is correct whereas the one given in a. is false.

    Problem 4.17

    Find the contrapositive, converse, and inverse of the proposition x R, ifx(x + 1) > 0 then x > 0 or x < 1.

    Solution.

    Contrapositive: x R, if1 x 0 then x(x + 1) 0.Converse : x R, if x > 0 or x < 1 then x(x + 1) > 0.Inverse : x R, if x(x + 1) 0 then 1 x 0.Problem 4.18

    Rewrite the following proposition in if-then form : Earning a grade of C

    in this course is a sufficient condition for it to count toward graduation.

    Solution.

    If an individual earns a grade ofC in this course then this is counted towardgraduation.

    Problem 4.19

    Rewrite the following proposition in if-then form : Being on time each dayis a necessary condition for keeping this job.

    Solution.

    If a person is not on time each day, then the person will not keep this job.

  • 8/22/2019 dm - qa

    22/127

    22

    Problem 4.20

    Rewrite the following proposition without using the words necessary or sufficient : Divisibility by 4 is not a necessary condition for divisibility by2.

    Solution.

    There is a number that is divisible by 2 and is not divisible by 4.

  • 8/22/2019 dm - qa

    23/127

    23

    Problem 5.1

    Use the rule of universal modus ponens to fill in valid conclusion for the ar-gument.

    For all real numbers a,b,c, and d, if b = 0 and d = 0 then ab

    + cd

    = ad+bcbd

    .

    a = 2, b = 3, c = 4, and d = 5 are particular real numbers such that b = 0and d = 0...

    Solution.

    For all real numbers a,b,c, and d, if b = 0 and d = 0 then ab

    + cd

    = ad+bcbd

    .

    a = 2, b = 3, c = 4, and d = 5 are particular real numbers such that b

    = 0

    and d = 0...23 +

    45 =

    2215

    Problem 5.2

    Use the rule of universal modus tonens to fill in valid conclusion for the ar-gument.

    If a computer is corresct, then compilation of the program does not pro-duce error messages.Compilation of this program produces error messages.

    ..

    Solution.

    If a computer is corresct, then compilation of the program does not produceerror messages.Compilation of this program produces error messages... The computer program is incorrect

    Some of the following arguments are valid; others are invalid. State whichare valid and which are invalid. Justify your answer.

    Problem 5.3

    All freshmen must take writing.Caroline is a freshman... Caroline must take writing.

  • 8/22/2019 dm - qa

    24/127

    24

    Solution.

    This is a valid argument by the universal modus ponens or universal instan-tiation

    Problem 5.4

    All cheaters sit in the back row.George sits in the back row... George is a cheater.

    Solution.

    This is an invalid argument by the converse error

    Problem 5.5All honest people pay their taxes.Darth is not honest... Darth does not pay his taxes.

    Solution.

    This is an invalid argument by the inverse error

  • 8/22/2019 dm - qa

    25/127

    25

    Problem 6.1

    Construct the truth tables of the gates discussed in this section.

    Solution.

    Truth table for NOT - gate:P R1 00 1

    Truth table for AND - gate:

    P Q R1 1 11 0 00 1 00 0 0

    Truth table for OR - gate:P Q R1 1 11 0 10 1 10 0 0

    Truth table for NAND - gate:

    P Q R1 1 01 0 10 1 10 0 1

    Truth table for NOR - gate:

    P Q R1 1 01 0 00 1 00 0 1

  • 8/22/2019 dm - qa

    26/127

    26

    Problem 6.2

    Give the output signalS

    for the following circuit:

    Solution.

    Answer: S = 0

    Problem 6.3

    Write the input/output table for the circuit of the previous problem.

    Solution.

    P Q R S1 1 1 11 1 0 11 0 1 11 0 0 10 1 1 10 1 0 00 0 1 00 0 0 0

    Problem 6.4Find the Boolean expression that corresponds to the circuit of Problem ??.

    Solution.

    (P Q) (P R)

  • 8/22/2019 dm - qa

    27/127

    27

    Problem 6.5

    Construct the circuit corresponding to the Boolean expression: (P

    Q

    ) R.

    Solution.

    Problem 6.6

    For the following input/output table, construct (a) the corresponding Booleanexpression and (b) the corresponding circuit:

    P Q R S1 1 1 01 1 0 11 0 1 01 0 0 00 1 1 10 1 0 00 0 1 00 0 0 0

    Solution.

    (a) (P Q R) ( P Q R).(b)

  • 8/22/2019 dm - qa

    28/127

    28

    Problem 6.7

    Show that the following two circuits are equivalent:

    Solution.

    The Boolean expression corresponding to a. is given by (P Q) Q andthat corresponding to b. is (P Q) Q. These two expressions are logicallyequivalent:

    (P Q) Q (P Q) (Q Q) (P Q) Q.

    Problem 6.8

    Consider the following circuit

  • 8/22/2019 dm - qa

    29/127

    29

    Let P and Q be single binary digits and P + Q = RS. Complete the fol-lowing table

    P Q R S1 11 00 10 0

    The given circuit is called a half -adder. It computes the sum of two singlebinary digits.

    Solution.

    P Q R S1 1 1 01 0 0 10 1 0 10 0 0 0

    Problem 6.9

    Express the numbers 104 and

    104 in twos complement representation with

    8 bits.

    Solution.

    +10410 = 01101000210410 = 100110002

  • 8/22/2019 dm - qa

    30/127

    30

    Problem 6.10

    What is the decimal representation for the integer with twos complement10101001?

    Solution.

    The two complement of 10101001 is 010101112 = 8710

  • 8/22/2019 dm - qa

    31/127

    31

    Problem 7.1

    Find the decimal value of the following binary numbers:

    a. 11001012b. 1101102

    Solution.

    a. 11001012 = 1 26 + 1 25 + 0 24 + 0 23 + 1 22 + 0 2 + 1 = 101.b. 1101102 = 1 25 + 1 24 + 1 22 + 1 2 = 54.

    Problem 7.2

    Represent the following decimal integers in binary notation:

    a. 129710b. 45810

    Solution.

    a. Using the procedure mentioned aboe we find:

    1297 = 648 2 + 1648 = 324 2 + 0324 = 162 2 + 0162 = 81 2 + 081 = 40 2 + 140 = 20 2 + 020 = 10 2 + 010 = 5 2 + 05 = 2 2 + 12 = 1 2 + 01 = 0 2 + 1

    Hence, 129710 = 101000100012.b. Similarly, one finds that 45810 = 1110010102.

    Problem 7.3Evaluate the following sums:

    a. 110111012 + 10010110102b. 1011012 + 111012

  • 8/22/2019 dm - qa

    32/127

    32

    Solution

    a. 1 1 1 10 0 1 1 0 1 1 1 0 1

    + 1 0 0 1 0 1 1 0 1 01 1 0 0 1 1 0 1 1 1

    b. Similar to a. we find 1011012 + 111012 = 10010102

    Problem 7.4

    Convert the number A2BC16 to base 10.

    Solution.

    A2BC16 = A 163 + 2 162 + B 16 + C= 10 163 + 2 162 + 11 16 + 12= 4140410

    Problem 7.5

    Convert the number B53DF816 to base 2.

    Solution.

    We have B = 10112, 5 = 01012, 3 = 00112, D = 11012, F = 11112, 8 = 10002.

    Hence, B53DF816 = 1011010100111101111110002.

    Problem 7.6

    Convert the number 1011011110001012 to base 16.

    Solution.

    We have 1011011110001012 = 0101|1011|1100|0101 = 5BC516

  • 8/22/2019 dm - qa

    33/127

    33

    Problem 8.1

    Show that the numberr

    = 6.321521521

    ...is a rational number.

    Solution.

    Note first that r = 6.32 + 0.00152152.... = 632100

    + 0.00152152... Let x =0.00152152... then 100000x = 152.152152... that is 100000x = 152 + x andsolving for x we find x = 152

    99999. Thus, r = 632

    100+ 152

    99999

    Problem 8.2

    Prove the following theorem.

    Theorem. The product of two rational numbers is a rational number.

    Solution.

    Proof. Let p and q be two rational numbers. Then there exist integers a,b,c,and d with b = 0, d = 0 and p = a

    b, q = c

    d. Hence, pq = ac

    bd Q

    Problem 8.3

    Use the previous problem to prove the following.

    Corollary. The square of any rational number is rational.

    Solution.

    Proof. Let a = b in the previous theorem to find that a2 = a.a QProblem 8.4

    Use the method of constructive proof to show that if r and s are two realnumbers then there exists a real number x such that r < x < s.

    Solution.

    Indeed, one can easily check that x = r+s2 satisfies the inequality r < x < s

    Problem 8.5

    The following Pascal program segment does not find the minimum value ina data set of N integers. Find a counterexample.

    MINN := 0;

    FOR I := 1 TO N DOBEGIN

    READLN (A);If A < MINN THEN MINN := A

    END

  • 8/22/2019 dm - qa

    34/127

    34

    Solution.

    LetN

    = 2 with the two numbers {1,

    3}.

    According to the algorithm theminimum is found to be 0 which is false.

  • 8/22/2019 dm - qa

    35/127

    35

    Problem 9.1

    Prove that for any integern

    the productn

    (n

    + 1) is even.Solution.

    We use the method of proof by cases.

    Case 1. Suppose n is even. Then there is an integer k such that n = 2k.Thus, n(n +1) = 2k(2k +1) = 2k where k = k(2k +1) Z. That is, n(n+1)is even.Case 2. Suppose that n is odd. Then there exists an integer k such thatn = 2k+1. So, n(n+1) = 2(2k+1)(k+1) = 2k where k = (2k+1)(k+1) Z.Again, n(n + 1) is even

    Problem 9.2

    Prove that the square of any integer has the form 4k or 4k + 1 for someinteger k

    Solution.

    We use the method of proof by cases.

    Case 1. Suppose n is even. Then there is an integer m such that n = 2m.Taking the square of n we find n2 = 4m2 = 4k where k = m2 Z.Case 2. Suppose n is odd. Then there is an integer m such that n = 2m + 1.

    Taking the square ofn we find n2

    = 4m2

    + 4m + 1 = 4(m2

    + m) + 1 = 4k + 1where k = m2 + m Z.Problem 9.3

    Prove that for any integer n, n(n2 1)(n + 2) is divisible by 4.Solution.

    We use the method of proof by cases.

    Case 1. Suppose n is even. Then there is an integer m such that n = 2m Thisimplies that n(n21)(n+2) = 2m(4m21)(2m+2) = 4m(4m21)(m+1) =4k where k = m(4m

    2

    1)(m + 1) Z. Thus, n(n2

    1)(n + 2) is divisible by4.Case 2. Suppose n is odd. Then there is an integer m such that n = 2m + 1.Thus, n(n2 1)(n + 2) = (2m + 1)(4m2 + 4m)(2m + 3) = 4k where k =(2m + 1)(m2 + m)(2m + 3) Z. Thus, n(n2 1)(n + 2) is divisible by 4.

  • 8/22/2019 dm - qa

    36/127

    36

    Problem 9.4

    State a necessary and sufficient condition for the floor function of a realnumber to equal that number.

    Solution.

    Theorem. x = x if and only if x Z.

    Proof. Suppose that x = x. From the definition of the floor func-tion, x Z. Conversely, if x Z then x is the smallest integer such thatx x < x + 1. That is, x = x

    Problem 9.5

    Prove that if n is an even integer then n2 = n2 .Solution.

    If n is an even integer then there is an integer k such that n = 2k. In thiscase,

    n2 = k = k = n

    2

    Problem 9.6

    Show that the equality

    x

    y

    =

    x

    y

    is not valid for all real numbers

    x and y.

    Solution.

    As a counterexample, let x = 0 and y = 12

    . Then

    x y = 12 = 0

    whereas

    x y = 12 = (1) = 1.

    Problem 9.7

    Show that the equality x + y = x + y is not valid for all real numbersx and y.

  • 8/22/2019 dm - qa

    37/127

    37

    Solution.

    As a counterexample, letx

    =y

    =

    1

    2.

    Thenx + y = 1 = 1

    whereasx + y = 2.

    Problem 9.8

    Prove that for all real numbers x and all integers m, x + m = x + m.

    Solution.Suppose that x R and m Z. Let n = x. By definition of ceil function,n Z and

    n 1 < x n.Add m to all sides to obtain

    n + m 1 < x + m n + m.

    Since n + m Z and n = x then

    x + m

    = n + m =

    x

    + m.

    Problem 9.9

    Show that if n is an odd integer then n2 = n+1

    2.

    Solution.

    Let n be an odd integer. Then there is an integer k such that n = 2k 1.Hence, n

    2= k 1

    2. By the previous problem

    n

    2 = k

    1

    2 =k

    + 1

    2 =k

    =

    n + 1

    2.

  • 8/22/2019 dm - qa

    38/127

    38

    Problem 10.1

    Use the proof by contradiction to prove the proposition There is no greatesteven integer.

    Solution.

    Suppose the contrary. That is, suppose there is a greatest even integer N.Then for any even integer n we have N n. Define the number M := N+ 2.Since the sum of two even integers is again an even integer then M is even.Moreover, M > N . This contradicts the supposition that N is the largesteven integer. Hence, there in no greatest even integer

    Problem 10.2

    Prove by contradiction that the difference of any rational number and any

    irrational number is irrational.

    Solution.

    Suppose the contrary. That is, suppose there exist a rational number x andan irrational number y such that x y is rational. By the definition ofrational numbers, there exist integers a,b,c, and d with b = 0 and d = 0 suchthat x = a

    band x y = c

    d. Thus,

    a

    b y = c

    d.

    Solving for y we find

    y = ad bcbd

    = pq

    where p = adbc Z and q = bd Z{0}. This contradicts the assumptionthat y is irrational

    Problem 10.3

    Use the proof by contraposition to show that if a product of two positive realnumbers is greater than 100, then at least one of the numbers is greater than10.

    Solution.

    We must prove by the method of contraposition the implication if x and yare positive real numbers such that xy > 100 then either x > 10 or y > 10.Instead, we will show that if x 10 and y 10 then xy 100. Indeed, if0 < x 10 and 0 < y 10 then the algebra of inequalities we have xy 100.

  • 8/22/2019 dm - qa

    39/127

    39

    Problem 10.4

    Use the proof by contradiction to show that the product of any nonzerorational number and any irrational number is irrational.

    Solution.

    Suppose the contrary. That is, suppose there exist a rational number x and anirrational number y such that xy Q. By the definition of rational numbersthere exist integers a, b = 0, c, and d = 0 such that x = a

    band xy = c

    d. Since

    x = 0 then it has a multiplicative inverse, that is we can multiply both sideof the equality xy = c

    dby b

    ato obtain y = bc

    ad= p

    qwhere p = bc Z and

    q = ad Z {0}. This shows that y Q which contradcits the assumptionthat y is irrational

  • 8/22/2019 dm - qa

    40/127

    40

    Problem 11.1

    Use the method of induction to show that2 + 4 + 6 + + 2n = n2 + n

    for all integers n 1.Solution.

    Let P(n) = 2 + 4 + 6 + + 2n. We will show that P(n) = n2 + n for alln 1 by the method of mathematical induction.(i) (Basis of induction) P(1) = 2 = 12 + 1. So P(n) holds for n = 1.(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = n2 + n.(iii) (Induction step) We must show that P(n + 1) = (n + 1)2 + n +1. Indeed,

    P(n + 1) = 2 + 4 + + 2n + 2(n + 1)= P(n) + 2(n + 1)= n2 + n + 2n + 2= n2 + 2n + 1 + (n + 1)= (n + 1)2 + (n + 1)

    Problem 11.2

    Use mathematical induction to prove that

    1 + 2 + 22 + + 2n = 2n+1 1for all integers n 0.Solution.

    Let P(n) = 1 + 2 + 22 + + 2n. We will show, by induction on n 0 thatP(n) = 2n+1 1.

    (i) (Basis of induction) P(0) = 1 = 20+1 1. That is, P(1)is true.(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = 2n+1 1.(iii) (Induction step) We must show that P(n + 1) = 2n+2 1. Indeed,

    P(n + 1) = 1 + 2 + + 2n + 2n+1

    =P

    (n

    ) + 2

    n+1

    = 2n+1 1 + 2n+1= 2.2n+1 1= 2n+2 1

  • 8/22/2019 dm - qa

    41/127

    41

    Problem 11.3

    Use mathematical induction to show that12 + 22 + + n2 = n(n + 1)(2n + 1)

    6for all integers n 1.Solution.

    Let P(n) = 12 + 22 + + n2. We will show by mathematical induction thatP(n) = n(n+1)(2n+1)

    6for all integers n 1.

    (i) (Basis of induction) P(1) = 1 = 1(1+1)(2+1)6

    . That is, P(1)is true.

    (ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = n(n+1)(2n+1)6 .

    (iii) (Induction step) We must show that P(n + 1) =n(n+1)(2n+1)

    6 . Indeed,P(n + 1) = 12 + 22 + + (n + 1)2

    = P(n) + (n + 1)2

    = n(n+1)(2n+1)6

    + (n + 1)2

    = (n+1)(n+2)(2n+3)6

    Problem 11.4

    Use mathematical induction to show that

    13 + 23 +

    + n3 = (

    n(n + 1)

    2

    )2

    for all integers n 1.Solution.

    Let P(n) = 13 + 23 + + n3. We will show by mathematical induction thatP(n) = (n(n+1)

    2)2 for all integers n 1.

    (i) (Basis of induction) P(1) = 1 = ( 1(1+1)2

    )2. That is, P(1)is true.

    (ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = (n(n+1)2 )2.

    (iii) (Induction step) We must show that P(n + 1) = ( (n+1)(n+2)2 )2. Indeed,

    P(n + 1) = 13 + 23 +

    + (n + 1)3

    = P(n) + (n + 1)3

    = (n(n+1)2

    )2 + (n + 1)3

    = ( (n+1)(n+2)2

    )2

  • 8/22/2019 dm - qa

    42/127

    42

    Problem 11.5

    Use mathematical induction to show that1

    1 2 +1

    2 3 + +1

    n(n + 1)=

    n

    n + 1

    for all integers n 1.

    Solution.

    Let P(n) = 112 +123 + + 1n(n+1) . We will show by mathematical induction

    that P(n) = nn+1

    for all integers n 1.

    (i) (Basis of induction) P(1) = 112 =

    11+1 . That is, P(1)is true.

    (ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = nn+1 .(iii) (Induction step) We must show that P(n + 1) = n+1

    n+2. Indeed,

    P(n + 1) = 112 +

    123 + + 1n(n+1) + 1(n+1)(n+2)

    = P(n) + 1(n+1)(n+2)= n

    n+1+ 1

    (n+1)(n+2)

    = n(n+2)+1(n+1)(n+2)= (n+1)

    2

    (n+1)(n+2)

    = n+1n+2

    Problem 11.6

    Use the formula

    1 + 2 + + n = n(n + 1)2

    to find the value of the sum

    3 + 4 + + 1, 000.

    Solution.

    Indeed, 3 + 4 + + 1, 000 = (1 + 2 + + 1, 000) 3= 1,000(1,000+1)

    2 3

    = 500, 497

  • 8/22/2019 dm - qa

    43/127

    43

    Problem 11.7

    Find the value of the geometric sum

    1 +1

    2+

    1

    22+ + 1

    2n

    Solution.

    Indeed,

    1 + 12

    + 122

    + + 12n

    =1( 1

    2)n+1

    1 12

    = 2 12n

    Problem 11.8Let S(n) =n

    k=1k

    (k+1)!. Evaluate S(1), S(2), S(3), S(4), and S(5). Make a

    conjecture about a formula for this sum for general n, and prove your con-jecture by mathematical induction.

    Solution.

    By substitution we find S(1) = 12 , S(2) =56

    , S(3) = 2324 , S(4) =119120

    , S(5) =719720

    . We claim that P(n) : S(n) = 1 1(n+1)!

    . We will prove this formula byinduction on n 1.

    (i) (Basis of induction) S(1) = 11

    2

    = 1

    1

    (1+1)!. That is, P(1)is true.

    (ii) (Induction hypothesis) Assume P(n) is true. That is, S(n) = 1 1(n+1)! .(iii) (Induction step) We must show that P(n + 1) : S(n + 1) = 1 1

    (n+2)!.

    Indeed,

    n+1k=1

    k

    k(k + 1)!=

    nk=1

    k

    k(k + 1)!+

    n + 1

    (n + 2)!

    =1 1(n + 1)!

    +n + 1

    (n + 1)!(n + 2)

    =1 (n + 2

    n

    1

    (n + 2)(n + 1)!

    =1 1(n + 2)!

  • 8/22/2019 dm - qa

    44/127

    44

    Problem 11.9

    For each positive integern

    letP

    (n

    ) be the proposition 4

    n

    1 is divisible by 3.a. Write P(1). Is P(1) true?b. Write P(k).c. Write P(k + 1).d. In a proof by mathematical induction that this divisibility property holdsfor all integers n 1, what must be shown in the induction step?

    Solution.

    a. P(1) : 41 1 is divisible by 3. P(1) is true.b. P(k) : 4k 1 is divisible by 3.c. P(k + 1) : 4

    k+1

    1 is divisible by 3.d. We must show that if 4k 1 is divisible by 3 then 4k+1 1 is divisible by3.

    Problem 11.10

    For each positive integer n let P(n) be the proposition 23n 1 is divisible by7. Prove this property by mathematical induction.

    Solution.

    (i) (Basis of induction) P(1) : 23 1. P(1)is true since 7 is divisible by 7.(ii) (Induction hypothesis) Assume P(n) is true. That is, 23n

    1 is divisible

    by 7.(iii) (Induction step) We must show that P(n + 1) is true. That is, 23n+3 1is divisible by 7. Indeed,

    23n+3 1 = (1 + 7) 23n 1= 23n 1 + 7 23n

    Since 7|(23n 1) and 7|7 23n then 7 divides the sum. that is, 7 divides23n+3 1.

    Problem 11.11

    Show that 2n < (n + 2)! for all integers n 0.Solution.

    Let P(n) = (n + 2)! 2n. We use mathematical induction to show thatP(n) > 0 for all n 0.

  • 8/22/2019 dm - qa

    45/127

    45

    (i) (Basis of induction)P

    (0) = 2! 1 = 1>

    0 so thatP

    (1) is true.(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = (n + 2)! 2n > 0.(iii) (Induction step) We must show that P(n + 1) = (n + 3)! 2n+1 > 0.Indeed,

    P(n + 1) = (n + 3)! 2n+1= (n + 3)(n + 2)! 2n+1 2(n + 2)! 2 2n= 2((n + 2)! 2n)> 0

    Problem 11.12

    a. Use mathematical induction to show that n3 > 2n + 1 for all integersn 2.b. Use mathematical induction to show that n! > n2 for all integers n 4.

    Solution.

    a. Let P(n) = n3 2n 1. We want to show that P(n) > 0 for all integersn 2.

    (i) (Basis of induction) P(2) = 23

    4 1 = 3 > 0 so that P(1) is true.(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = n3 2n 1 > 0.(iii) (Induction step) We must show that P(n + 1) > 0. Indeed,

    P(n + 1) = (n + 1)3 2(n + 1) 1= n3 + 3n2 + 3n + 1 2n 3= n3 2n 1 + 3n2 + 3n 1> 3n2 + 3n 1> 0

    note that for n 2, 3n2

    + 3n 1 15b. Let P(n) = n! n2. We want to show that P(n) > 0 for all integersn 4.

  • 8/22/2019 dm - qa

    46/127

    46

    (i) (Basis of induction) P(4) = 4! 42 = 8 > 0 so that P(1) is true.

    (ii) (Induction hypothesis) AssumeP

    (n

    ) is true. That is,P

    (n

    )>

    0.

    (iii) (Induction step) We must show that P(n + 1) > 0. Indeed,

    P(n + 1) = (n + 1)! (n + 1)2= (n + 1)n! n2 2n 1> n! n2 + nn! 2n 1> nn! 2n 1= n(n! 2) 1 > 0

    note that for n 4, n! 24 so that n(n! 2) 1 87

    Problem 11.13

    A sequence a1, a2, is defined by a1 = 3 and an = 7an1 for n 2. Showthat an = 3 7n1 for all integers n 1.

    Solution.

    Listing the first few terms of the sequence we find, a1 = 3 = 3 711, a2 =3 721, etc. We will use induction on n 1 to show that the formula for anis valid for all n 1.

    (i) (Basis of induction) a1 = 3 = 3 711 so that the formula is true forn = 1.

    (ii) (Induction hypothesis) Assume that an = 3 7n1

    (iii) (Induction step) We must show that an+1 = 3 7n.an+1 = 7an

    = 7 3 7n1= 3 7n.

  • 8/22/2019 dm - qa

    47/127

    47

    Problem 12.1

    Letm

    andn

    be two integers.

    a. Is 6m + 8n an even integer?b. Is 6m + 4n2 + 3 odd?

    Solution.

    a. Since 6m + 8n = 2(3m + 4n) and 3m + 4n Z we have 6m + 8n is even.b. Since 6m +4n2 +3 = 2(3m +2n2 +2)+1 = 2k +1 where k = 3m + 2n2 +2,we have 6m + 4n2 + 3 is odd

    Problem 12.2

    Prove the following theorem.

    Theorem 12.1

    Leta = 0, b = 0, and c be integers. Prove that(i) If a|b and a|c then a|(b c).(ii) If a|b then a|bc.(iii) If a|b and b|c then a|c.

    Solution.

    (i) If a|b and a|c then there exist integers k1 and k2 such that b = k1a andc = k2a. In this case, b

    c = (k1

    k2)a. This says that a

    |(b

    c).

    (ii) If a|b then there is an integer k such that b = ka. Multiply both sides ofthis equality by c to obtain bc = (kc)a. Thus, a|bc.(iii) Suppose that a|b and b|c. Then there exist integers k1 and k2 such thatb = k1a and c = k2b. Thus, c = (k2k1)a. That is, a|c

    Problem 12.3

    Let m and n be positive integers with m > n. Is m2 n2 composite?

    Solution.

    If m = 2 and n = 1 then m2

    n2

    = 3 which is prime. Depending on m andn the number m2 n2 can be either prime or composite

    Problem 12.4

    Write the first 7 prime numbers.

  • 8/22/2019 dm - qa

    48/127

    48

    Solution.

    The numbers are : 2,

    3,

    5,

    7,

    11,

    13,

    17

    Problem 12.5

    If a positive number p is composite then one can always write p as the productof primes, where the prime factors are written in increasing order. This resultis known as the Fundamental Theorem of Arithmetic or the UniqueFactorization Theorem. Write the prime factorization of 180.

    Solution.

    180 = 22 32 5.

    Problem 12.6Use the previous theorem to show that the number 101 is prime.

    Solution.

    The prime numbers less than or equal to

    101 are: 2, 3, 5, 7. Since none ofthem divided 101, by the previous theorem, 101 is prime.

  • 8/22/2019 dm - qa

    49/127

    49

    Problem 13.1

    (i) Findgcd

    (120,

    500).

    (ii) Show that 17 and 22 are relatively prime.

    Solution.

    (i) Since 120 = 23 3 5 and 500 = 22 30 53 gcd(120, 500) = 22 30 5 = 20.(ii) Since 17 = 20 110 171 and 22 = 2 11 170, gcd(17, 22) = 20 110 170 = 1.Hence, 17 and 22 are relatively prime.

    Problem 13.2

    Find lcm(120, 500).

    Solution.

    m = lcm(120, 500) = 23 3 53 = 3000.

    Problem 13.3

    Recall that a b mod n if and only if a b = kn for some integer k.(i) Show that if a b mod n and c d mod n then a + c b + d mod n.(ii) Show that if a b mod n and c d mod n then ac bd mod n.(iii) What are the solutions of the linear congruences 3x 4(mod7)?

    Solution.

    (i) If a b mod n and c d mod n then there exist integers k1 and k2such that a b = k1n and c d = k2n. Adding these equations we find(a + c) (b + d) = kn where k = k1 + k2 Z. Hence, a + c b + d mod n.(ii) Using the notation of (i) we he ac bc = k1cn and cb bd = k2bn.Adding these equations we find ac bd = kn where k = k1c + k2b Z.Hence, ac bd mod n.(iii) By (ii) we have 9x 12 mod 7. Since 7x 0 mod 7 then by (i) we have2x 12 mod 7. This, the given equation, and (i) lead to x 8 mod 7.Hence, x = 7k

    8 where k

    Z.

    Problem 13.4

    a. Use the Euclidean algorithm to find gcd(414, 662).b. Use the Euclidean algorithm to find gcd(287, 91).

  • 8/22/2019 dm - qa

    50/127

    50

    Solution.

    a. Using the division algorithm we have662 = 414 1 + 248414 = 248 1 + 164248 = 164 1 + 84164 = 84 1 + 8084 = 80 1 + 480 = 20 4 + 0

    Hence, gcd(414, 662) = 20.b. Similar to a. we find gcd(287, 91) = 2.

  • 8/22/2019 dm - qa

    51/127

    51

    Problem 14.1

    Findx1

    , x2 and

    x3 such that

    x1 + x2 + 2x3 0 12 3 2x1 + 4x2 3x34 3x1 + 6x2 5x3 5

    =

    9 0 12 3 1

    4 0 5

    Solution.

    Because corresponding entries must be equal, this gives the following linearsystem

    x1 + x2 + 2x3 = 92x1 + 4x2 3x3 = 13x1 + 6x2 5x3 = 0

    From the first equation we see that x1 = 9 x2 2x3. Substituting this intothe second and the third equation we find

    2x2 7x3 = 173x2 11x3 = 27

    Solving this system by elimination or substitution give x2 = 2, x3 = 3. Thus,x1 = 1.

    Problem 14.2

    Solve the following matrix equation for a,b,c, and d

    a b b + c

    3d + c 2a 4d = 8 1

    7 6

    Solution.

    Equating corresponding entries we get the system

    a b = 8b + c = 1

    c + 3d = 72a 4d = 6

    The first two equations give a = 8 + b and c = 1 b. Substituting theseexpressions in the last two equations lead to the system b + 3d = 6

    b 2d = 5Solving this system we find d = 1 and b = 3. Hence, a = 8 + b = 5 andc = 1 b = 4.

  • 8/22/2019 dm - qa

    52/127

    52

    Problem 14.3

    Consider the matrices

    A =

    2 13 4

    , B =

    2 13 5

    , C =

    2 1 03 4 0

    Compute, if possible, A + B, A + C and B + C.

    Solution.

    We have

    A + B =

    4 26 10

    A + B and B + C are undefined since A and B are of different sizes as well

    as A and C

    Problem 14.4

    Consider the matrices

    A =

    2 3 41 2 1

    , B =

    0 2 71 3 5

    Compute A 3B.Solution.

    Using the above definitions we have

    A 3B =

    2 3 172 11 14

    Problem 14.5

    Let A be an m n matrix. The transpose ofA, denote by AT, is the n mwhose columns are the rows of A. Find the transpose of the matrix

    A =

    2 3 41 2 1

    ,

    Solution.

    By the definition of transpose, the transpose of A is the matrix

    AT =

    2 13 2

    4 1

  • 8/22/2019 dm - qa

    53/127

    53

    Problem 14.6

    Consider the matrices

    A =

    1 2 42 6 0

    , B =

    4 1 4 30 1 3 1

    2 7 5 2

    Compute, if possible, AB and BA.

    Solution.

    We have

    AB =

    1 2 42 6 0

    4 1 4 30 1 3 12 7 5 2

    =

    4 + 8 1 2 + 28 4 + 6 + 20 3 + 2 + 8

    8 2 6 8 + 18 6 + 6

    =

    12 27 30 138 4 26 12

    BA is not defined since the number of columns of B is not equal to thenumber of rows of A

    Problem 14.7

    Prove by induction on n 1 that

    2 10 2

    n=

    2n n2n10 2n

    Solution.

    Basis of induction: 2 10 2

    1=

    21 1211

    0 21

    so the result holds for n = 1.Induction hypothesis: Suppose that

    2 1

    0 2n

    = 2n n2n1

    0 2n

    Induction Step: We must show that2 10 2

    n+1=

    2n+1 n + 12n

    0 2n+1

  • 8/22/2019 dm - qa

    54/127

    54

    Indeed,

    2 10 2

    n+1=

    2 10 2

    n2 10 2

    =

    2n n2n1

    0 2n

    2 10 2

    =

    2n+1 n + 12n

    0 2n+1

  • 8/22/2019 dm - qa

    55/127

    55

    Problem 15.1

    Which of the following sets are equal?a. {a,b,c,d}b. {d,e,a,c}c. {d,b,a,c}d. {a,a,d,e,c,e}Solution.

    {a,b,c,d} = {d,b,a,c} and {d,e,a,c} = {a,a,d,e,c,e}Problem 15.2

    Let A = {c,d ,f,g}, B = {f, j}, and C = {d, g}. Answer each of the followingquestions. Give reasons for your answers.a. Is B A?b. Is C A?c. Is C C?d. Is C is a proper subset of A?

    Solution.

    a. B is not a subset ofA since j B but j A.b. C A.c. C C.d. C is a proper subset of A since C A and c A but c C.Problem 15.3

    a. Is 3 {1, 2, 3}?b. Is 1 {1}?c. Is {2} {1, 2}?d. Is {3} {1, {2}, {3}}?e. Is 1 {1}?f. Is {2} {1, {2}, {3}}?g. Is {1} {1, 2}?h. Is 1 {{1}, 2}?i. Is

    {1

    } {1,

    {2

    }}?

    j. Is {1} {1}?Solution.

    a. 3 {1, 2, 3}.b. 1 {1}.

  • 8/22/2019 dm - qa

    56/127

    56

    c. {2} {1, 2}

    d. {3} {1,{2}

    ,{3}}e. 1 {1}

    f. {2} {1, {2}, {3}}g. {1} {1, 2}h. 1 {{1}, 2}i. {1} {1, {2}}

    j. {1} {1}Problem 15.4

    Let A = {b ,c,d ,f,g} and B = {a,b,c}. Find each of the following:a. A B.b. A B.c. A B.d. B A.Solution.

    a. A B = {a,b ,c,d ,f,g}.b. A B = {b, c}.c. A B = {d , f , g}.d. B A = {a}Problem 15.5

    Indicate which of the following relationships are true and which are false:a. Z+ Q.b. R Q.c. Q Z.d. Z+ Z = Z.e. Q R = Q.f. Q Z = Z.g. Z+ R = Z+h. Z Q = Q.Solution.

    a. True b. False c. False d. False e. True f.False g.True h. True.

    Problem 15.6

    Let A = {x , y , z , w} and B = {a, b}. List the elements of each of the followingsets:

  • 8/22/2019 dm - qa

    57/127

    57

    a. A B

    b.B

    A

    c. A Ad. B B.

    Solution.

    a. A B = {(x, a), (x, b), (y, a), (y, b), (z, a), (z, b), (w, a), (w, b)}.b. B A = {(a, x), (b, x), (a, y), (b, y), (a, z), (b, z), (a, w), (b, w)}.c. A A = {(x, x), (x, y), (x, z), (x, w), (y, x), (y, y), (y, z), (y, w),(z, x), (z, y), (z, z), (z, w), (w, x), (w, y), (w, z), (w, w)}.d. B B = {(a, a), (a, b), (b, a), (b, b)}.

    Problem 15.7Let = {x, y} be an alphabet.a. Let L1 be the language consisting of all strings over that are palindromesand have length 4. List the elements L1.b. Let L2 be the language consisting of all strings over that begins with xand have length 3. List the elements L2.c. Let L3 be the language consisting of all strings over with length 3and for which all the xs appear to the left of all the ys. List the elementsL3.

    d. List the elements of 4, the set of all strings of length 4 over .e. Let A = 3

    4. Describe A,B, and A

    B in words.

    Solution.

    a. L1 = {,x,y,xx,yy,xxx,xyx,yxy,yyy,xxxx,xyyx,yxxy,yyyy}.b. L2 = {,x, xx, xxx,xy, xyy, xyx,xxy}.c. L3 = {,x,y,xx,xy,yy,xxx,xxy,xyy,yyy}.d. 4 = {xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy,yxyx, yxyy, yyxx, yyxy, yyyx, yyyy}.e. A is the set of all strings over of length 1 or 2. B is the set of all stringsover of length 3 or 4. AB is the set of all strings over of length between1 and 4.

  • 8/22/2019 dm - qa

    58/127

    58

    Problem 16.1

    LetA,B,

    andC

    be sets. Prove that ifA

    B

    thenA

    C

    B

    C.

    Solution.

    Let x A C. Then x A and x C. Since A B then x B. Thus,x B and x C so that x B C.

    Problem 16.2

    Find sets A,B, and C such that A C = B C but A = B.

    Solution.

    Let A =

    {1

    }, B =

    {2

    }, and C =

    {3

    }. Then A

    C = B

    C =

    and A

    = B.

    Problem 16.3

    Find sets A,B, and C such that A C B C and A C B C butA = B.

    Solution.

    Let A be a proper subset of a set B and let C = . Then = A C B C = and A = A C B C. However, A = B.

    Problem 16.4

    Let A and B be two sets. Prove that if A B then Bc Ac.

    Solution.

    Let x Bc. Ifx Ac then x A. Since A B then x B. That is, x Bc.This contradicts our assumption that x Bc. Hence, x Ac.

    Problem 16.5

    Let A,B, and C be sets. Prove that if A C and B C then A B C.

    Solution.

    Let x A B. Then either x A or x B. In either case we have x Csince both A and B are subsets of C. This shows that A B C.

    Problem 16.6

    Let A,B, and C be sets. Show that A (B C) = (A B) (A C).

  • 8/22/2019 dm - qa

    59/127

    59

    Solution.

    We first show thatA

    (B

    C

    ) (A

    B

    )(A

    C

    ).

    Let (x, y

    ) A

    (B

    C

    ).

    Then x A and y B C. So either y B or y C. Hence, we have either(x, y) A B or (x, y) A C. Thus, (x, y) (A B) (A C).Next we show that (A B) (A C) A (B C). Let (x, y) (A B) (A C). Then either (x, y) A B or (x, y) A C. If (x, y) A Bthen x A and y B. This implies that x A and y B C and so(x, y) A (B C). Similar argument if (x, y) A C.

    Problem 16.7

    Let A,B, and C be sets. Show that A (B C) = (A B) (A C).

    Solution.Let (x, y) A(BC). Then x A, y B, and y C. Thus, (x, y) ABand (x, y) A C. It follows that (x, y) (A B) (A C). This showsthat A (B C) (A B) (A C).Conversely, let (x, y) (A B) (A C). Then (x, y) A B and (x, y) A C. Thus, x A, y B and y C. That is, (x, y) A (B C).

    Problem 16.8

    a. Is the number 0 in ? Why?b. Is = {}? Why?c. Is

    {}? Why?

    Solution.

    a. The empty set contains no elements. Thus 0 .b. The set {} has one element, namely , whereas contains no elements.Thus = {}.c. The set {} has one element, namely . That is, {}.

    Problem 16.9

    Let A and B be two sets. Prove that (A B) (A B) = .

    Solution.Suppose not. Then there is an x (A B) (A B). This implies thatx A B, x A, and x B. But x A B implies that x A and x B.So we have x B and x B a contradiction. Hence, (A B) (A B) = .

  • 8/22/2019 dm - qa

    60/127

    60

    Problem 16.10

    LetA

    andB

    be two sets. Show that ifA

    B

    thenA

    Bc

    = .

    Solution.

    Suppose that A Bc = . Then there is an x A Bc. This implies thatx A and x Bc. Thus, x A and x B. Since A B and x A thenx B. It follows that x B and x B which is impossible.

    Problem 16.11

    Let A, B and C be three sets. Prove that if A B and B C = thenA C = .

    Solution.

    Suppose the contrary. That is, A C = . Then there is an element x Aand x C. Since A B then x B. So we have that x B and x C.This yields that x B C which contradicts the fact that B C = .

    Problem 16.12

    Find two sets A and B such that A B = but A B = .

    Solution.

    Let A = {1} and B = {2}. Then A B = and A B = {(1, 2)} = .Problem 16.13

    Suppose that A = {1, 2} and B = {2, 3}. Find each of the following:a. P(A B).b. P(A).c. P(A B).d. P(A B).

    Solution.

    a. Since A B = {2} then P(A) = {, {2}}.b. P(A) = {, {1}, {2}, A}.c. Since A B = {1, 2, 3} then

    P(A B) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.

  • 8/22/2019 dm - qa

    61/127

    61

    d. SinceA

    B

    = {(1,

    2),

    (1,

    3),

    (2,

    2),

    (2,

    3)} thenP(A B) = {, {(1, 2)}, {(1, 3)}, {(2, 2)}, {(2, 3)}, {(1, 2), (1, 3)},

    {(1, 2), (2, 2)}, {(1, 2), (2, 3)}, {(1, 3), (2, 2)}, {(1, 3), (2, 3)},{(2, 2), (2, 3)}, {(1, 2), (1, 3), (2, 2)}, {(1, 2), (1, 3), (2, 3)},

    {(1, 2), (1, 3), (2, 3)}, {(1, 3), (2, 2), (2, 3)}, A B}

    Problem 16.14

    a. Find P().b. Find

    P(

    P(

    )).

    c. Find P(P(P())).

    Solution.

    a. P() = {}.b. P(P()) = {, {}}.c. P(P(P())) = {, {}, {{}}, {, {}}}.

    Problem 16.15

    Determine which of the following statements are true and which are false.Prove each statement that is true and give a counterexample for each state-ment that is false.a. P(A B) = P(A) P(B).b. P(A B) = P(A) P(B).c. P(A) P(B) P(A B).d. P(A B) = P(A) P(B).

    Solution.

    a. Let A = {1, 2} and B = {1, 3}. Then A B = {1, 2, 3} andP(A B) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} whereasP(A) P(B) = {, {1}, {2}, {1, 2}, {3}, {1, 3}}.b. Let X P(A B). Then X A B and therefore X A and X B.This implies that X P(A) and X P(B) and hence X is in the intersec-tion. This completes a proof ofP(A B) P(A) P(B).Conversely, let X P(A) P(B). Then X P(A) and X P(B). Hence,X A and X B. It follows that X A B and therefore X P(A B).This ends a proof for P(A) P(B) P(A B).

  • 8/22/2019 dm - qa

    62/127

    62

    c. Let X P(A) P(B). Then X A and X B. Thus, X A B and

    this implies thatX

    P(A B).

    d. Let A = {1} and B = {2}. Then A B = {(1, 2)}. So we have

    P(A B) = {, {(1, 2)}}whereas

    P(A) P(B) = {(, ), (, {2}), ({1}, ), ({1}, {2})}.

  • 8/22/2019 dm - qa

    63/127

    63

    Problem 17.1

    Show that ifS

    is a collection of propositions with finite propositional variablesthen (S, , ) is a Boolean algebra.

    Solution.

    Let p,q,r S. Then (1) p q S and p q S.(2) p q qp and p q qp.(3) p (q r) (p q) r and p (q r) (p q) r.(4) p (q r) (p q) (p r) and p (q r) (p q) (p r).(5) Let c be a contradiction and t a tautology then p c p and p t p.(6) If p S then p S is such that p p t and p p c.

    Problem 17.2Show that for a given nonempty set S, (P(S), , ) is a Boolean algebra.

    Solution.

    Let A , B , C P(S). Then(1) A B P(S) and A B P(S).(2) A B = B A and A B = B A.(3) (A B) C = A (B C) and (A B) C = A (B C).(4) A (B C) = (A B) (A C) and A (B C) = (A B) (A C).(5) A = A and A S = A.(6) A

    Ac = S and A

    Ac =

    .

  • 8/22/2019 dm - qa

    64/127

    64

    Problem 18.1

    LetX

    = {a,b ,c

    }.

    Recall that P(X

    ) is the power set ofX.

    Define a binaryrelation R on P(X) as follows:A, B P(x), A R B |A| = |B|.

    a. Is {a, b}R{b, c}?b. Is {a}R{a, b}?c. Is {c}R{b}?Solution.

    a. {a, b}R{b, c} since |{a, b}| = |{b, c}| = 2.b. Since 1 =

    |{a

    }| = 2 =

    |{a, b

    }|then

    {a

    } R{a, b

    }.

    c. Since |{c}| = |{b}| then {c}R{b}.Problem 18.2

    Let = {a, b}. Then 4 is the set of all strings over of length 4. Define arelation R on 4 as follows:

    s, t 4, s R t s has the same first two characters as t.a. Is abaa R abba?b. Is aabb R bbaa?c. Is aaaa R aaab?

    Solution.

    a. abaa R abba.b. aabb R bbaa.c. aaaa R aaab.

    Problem 18.3

    Let A = {4, 5, 6} and B = {5, 6, 7} and define the binary relations R,S, andT from A to B as follows:

    (x, y) A B, (x, y) R x y.

    (x, y) A B , x S y 2|(x y).T = {(4, 7), (6, 5), (6, 7)}.

    a. Draw arrow diagrams for R,S, and T.b. Indicate whether any of the relations S,R, or T are functions.

  • 8/22/2019 dm - qa

    65/127

    65

    Solution.

    a.b. R is not a function since (4, y) R for any y B. S defines a functionsince it satisfies the definition of a function. Finally, T is not a function since(6, 5)

    R and (6, 7)

    R but 5

    = 7.

    Problem 18.4

    Let A = {3, 4, 5} and B = {4, 5, 6} and define the binary relation R asfollows:

    (x, y) A B, (x, y) R x < y.List the elements of the sets R and R1.

    Solution.

    R = {(3, 4), (3, 5), (3, 6), (4, 5), (4, 6), (5, 6)}R

    1

    = {(4, 3), (5, 3), (6, 3), (5, 4), (6, 4), (6, 5)}

    Problem 18.5

    Let A = {2, 4} and B = {6, 8, 10} and define the binary relations R,S, and

  • 8/22/2019 dm - qa

    66/127

    66

    T from A to B as follows:

    (x, y) A B, (x, y) R x|y.

    (x, y) A B , x S y y 4 = x.List the elements of A B,R ,S,R S, and R S.

    Solution.

    A B = {(2, 6), (2, 8), (2, 10), (4, 6), (4, 8), (4, 10)}

    R = {(2, 6), (2, 8), (2, 10), (4, 8)}S = {(2, 6), (4, 8)}

    R S = RR S = S

    Problem 18.6

    Consider the binary relation on R defined as follows:

    x, y R, x R y x y.

    Is R reflexive? symmetric? transitive?

    Solution.

    Since x x for any number x R then R is reflexive. R is not symmetricsince 2 1 but 1 > 2. Finally, R is transitive because if x y and y zthen x z.

    Problem 18.7

    Consider the binary relation on R defined as follows:

    x, y R, x R y xy 0.

    Is R reflexive? symmetric? transitive?

  • 8/22/2019 dm - qa

    67/127

    67

    Solution.

    Sincexx

    0 for allx

    R

    thenR

    is reflexive. Ifx, y

    R

    are such thatxy 0 then yx 0 since multiplication of real numbers is commutative.Thus, R is symmetric. Finally, R is transitive for if xy 0 then x and yhave the same sign. Similarly, if yz 0 then y and z have the same sign. Itfollows that all three numbers x,y, and z have the same sign.

    Problem 18.8

    Let = {0, 1} and A = . Consider the binary relation on A defined asfollows:

    x, y A, x R y |x| < |y|,where

    |x

    |denotes the length of the string x. Is R reflexive? symmetric?

    transitive?

    Solution.

    R is not reflexive since |x| = |x| for x A. Now since |10| = 2 < 3 = |111|and |111| < |10| then R is not symmetric. Finally, since < is transitive in Rthen it is transitive in A

    Problem 18.9

    Let A = and P(A) be the power set ofA. Consider the binary relation onP(A) defined as follows:

    X, Y P(A), X R Y X Y.Is R reflexive? symmetric? transitive?

    Solution.

    Since every set is a subset of itself then R is reflexive. However, R is notsymmetric since it is possible to find two subsets X and Y ofP(A) such thatX Y. Finally, for A B and B C then A C. That is, R is transitive.

    Problem 18.10

    Let E be the binary relation on Z defined as follows:

    a E b m n (mod 2).Show that E is an equivalence relation on Z and find the different equivalenceclasses.

  • 8/22/2019 dm - qa

    68/127

    68

    Solution.

    Ris reflexive: For all

    mZ

    ,m

    m

    (mod

    2) sincem

    m

    = 2 0.

    R is symmetric: If m, n Z are such that m n(mod 2) then there is aninteger k such that m n = 2k. Multiplying this equation by 1 to obtainn m = 2(k) so that n m (mod 2). That is, n R m.R is transitive: Let m,n,p Z be such that m n (mod 2) and n p (mod 2). Then there exist integers k1 and k2 such that m n = 2k1 andn p = 2k2. Add these equalities to obtain m p = 2(k1 + k2) which meansthat m p (mod 2).Ifx [a] then x = 2k + a so that a is the remainder of the division ofx by 2.Thus the only possible values ofa are 0 and 1 and so the equivalence classesare [0] and [1].

    Problem 18.11

    Let I be the binary relation on R defined as follows:

    a I b a b Z.Show that I is an equivalence relation on R and find the different equivalenceclasses.

    Solution.

    R is reflexive: For all a R we have a I a since a a = 0 Z.R is symmetric: If a, b

    R are such that a I b then a

    b

    Z. But then

    b a = (a b) Z. That is, b I a.R is transitive: Ifa,b ,c R are such that a I b and b I c then a b Z andb c Z. Adding to obtain a c Z that is a I c.For a R, [a] = {b R|a = b + n, for some n Z}.Problem 18.12

    Let A be the set all straight lines in the cartesian plane. Let || be the binaryrelation on A defined as follows:

    l1||l2 l1 is parallel to l2.

    Show that || is an equivalence relation on A and find the different equivalenceclasses.

    Solution.

    || is reflexive: Any line is parallel to itself.

  • 8/22/2019 dm - qa

    69/127

    69

    || is symmetric: If l1 is parallel to l2 then l2 is parallel to l1.

    || is transitive: Ifl1 is parallel to

    l2 and

    l2 is parallel to

    l3 then

    l1 is parallelto l3.

    If l A then [l] = {l A|l||l}.

    Problem 18.13

    Let A = N N. Define the binary relation R on A as follows:(a, b) R (c, d) a + d = b + c.

    a. Show that R is reflexive.b. Show that R is symmetric.c. Show that R is transitive.d. List five elements in [(1, 1)].e. List five elements in [(3, 1)].f. List five elements in [(1, 2)].g. Describe the distinct equivalence classes of R.

    Solution.

    a. R is reflexive since a + a = a + a, i.e. (a, a) R (a, a).b. R is symmetric: If (a, b) R (c, d) then a + d = b + c which implies thatc + b = d + a. That is, (c, d) R (a, b).c. R is transitive: Suppose (a, b) R (c, d) and (c, d) R (e, f). Then a+d = b+c

    and c + f = d + e. Multiply the first equation by -1 and add to the secondto obtain a + f = d + e. That is, (a, b) R (e, f).d. (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) [(1, 1)].e. (3, 1), (4, 2), (5, 3), (6, 4), (7, 5) [(3, 1)].f. (0, 1), (1, 2), (2, 3), (3, 4), (4, 5) [(1, 2)].g. [(a, b)] = {(c, d)|d c = b a}.

    Problem 18.14

    Let R be a binary relation on a set A and suppose that R is symmetric andtransitive. Prove the following: If for every x A there is a y A such thatx R y then R is reflexive and hence an equivalence relation on A.

    Solution.

    We must show that x R x for all x A. Let x A. Then there is a y Asuch that x R y. Since R is symmetric then y R x. The facts that x R y, y R xand R transitive imply that x R x.

  • 8/22/2019 dm - qa

    70/127

    70

    Problem 19.1

    Let = {a, b

    } and let be the set of all strings over .

    Define the relationR on as follows: for all s, t ,s R t l(s) l(t),

    where l(x) denotes the length of the word x. Is R antisymmetric? Prove orgive a counterexample.

    Solution.

    R is not antisymmetric since aab R baa and baa R aab but aab and baa aretwo different words.

    Problem 19.2

    Define a relation R on Z as follows: for all m, n Zm R n m + n is even.

    Is R a partial order? Prove or give a counterexample.

    Solution.

    For all m Z we have that m + m is even and so m R m. This shows that Ris reflexive. R is not antisymmetric sine 2 R 4 and 4 R 2 but 2 = 4. Hence,R is not a partial order relation

    Problem 19.3

    Define a relation R on R as follows: for all m, n Rm R n m2 n2.

    Is R a partial order? Prove or give a counterexample.

    Solution.

    R is not antisymmetric since 2 R (2) and (2) R 2 but 2 = 2. Hence, Ris not a partial order relation

    Problem 19.4

    LetS

    = {0,

    1} and consider the partial order relationR

    defined onS

    S

    asfollows: for all ordered pairs (a, b) and (c, d) in S S(a, b) R (c, d) a c and b d.

    Draw the Hasse diagram for R.

  • 8/22/2019 dm - qa

    71/127

    71

    Solution.

    Problem 19.5

    Consider the divides relation defined on the set A = {1, 2, 22, , 2n},where n is a nonnegative integer.a. Prove that this relation is a total order on A.b. Draw the Hasse diagram for this relation when n = 3.

    Solution.

    a. Reflexivity: for all 0 i n, we have 2i|2i.Antisymmetry: Suppose that 2i|2j and 2j |2i. Then i j and j i. Since therelation

    is antisymmetric on N we conclude that i = j. That is 2i = 2j.

    Transitivity: Suppose that 2i|2j and 2j|2k. Then i j and j k. Since istransitive on N we conclude that i k. Hence, 2i|2k.Now, if 2i and 2j are element of A then either i j or j i. That is, either2i|2j or 2j|2i. So A is a totally ordered set.b.

  • 8/22/2019 dm - qa

    72/127

    72

    Problem 20.1

    Letf, g

    :R

    R

    be the functionsf

    (x

    ) = 2x

    andg

    (x

    ) =

    2x3+2x2

    x2

    +1.

    Show thatf = g.

    Solution.

    Since x2 + 1 = 0 for all x R we have

    g(x) =2x(x2 + 1)

    x2 + 1= 2x = f(x).

    Problem 20.2

    Let H, K : RR be the functions H(x) =

    x

    + 1 and K(x) =

    x

    . DoesH = K? Explain.

    Solution.

    H = K since H(1) = 0 = 1 = K(1).Problem 20.3

    Find functions defined on the set of nonnegative integers that define thesequences whose first six terms are given below.a. 1, 13 , 15 , 17 , 19 , 111 .b. 0, 2, 4, 6, 8, 10.

    Solution.

    a. f(n) = (1)n

    2n+1.

    b. f(n) = (1)n(2n).Problem 20.4

    Let A = {1, 2, 3, 4, 5} and let F : P(A) Z be defined as follows:

    F(X) =

    0 if X has an even number of elements1 if X has an odd number of elements

    Find the following

    a. F({1, 3, 4})b. F().c. F({2, 3}).d. F({2, 3, 4, 5}).

  • 8/22/2019 dm - qa

    73/127

    73

    Solution.

    a.F

    ({1,

    3,

    4}) = 1b. F() = 0.c. F({2, 3}) = 0.d. F({2, 3, 4, 5}) = 0.Problem 20.5

    Let = {a, b} and be the set of all strings over .a. Define f : Z as follows:

    f(s) =

    the number of bs to the left of the left most a in s

    0 if s contains no as

    Find f(aba), f(bbab), and f(b). What is the range of f?b. Define g : as follows:g(s) = the string obtained by writing the characters of s in reverse order.

    Find g(aba), g(bbab), and g(b). What is the range of g?

    Solution.

    a. f(aba) = 0, f(bbab) = 2, f(b) = 0. Range(f) = N.b. g(aba) = aba, g(bbab) = babb, g(b) = b. Range(g) = .

    Problem 20.6

    Let E and D be the encoding and decoding functions.a. Find E(0110) and D(111111000111).b. Find E(1010) and D(000000111111).

    Solution.

    a. E(0110) = 000111111000 and D(111111000111) = 1101.b. E(1010) = 111000111000 and D(000000111111) = 0011.

    Problem 20.7

    Let H denote the Hamming distance function on 5.a. Find H(10101, 00011).

    b. Find H(00110, 10111).

    Solution.

    a. H(10101, 00011) = 3.b. H(00110, 10111) = 2.

  • 8/22/2019 dm - qa

    74/127

    74

    Problem 20.8

    Consider the three-place Boolean functionf

    : {0,

    1}3

    {0,

    1} defined asfollows:f(x1, x2, x3) = (3x1 + x2 + 2x3) mod 2

    a. Find f(1, 1, 1) and f(0, 1, 1).b. Describe f using an input/output table.

    Solution.

    a. f(1, 1, 1) = 6 mod 2 = 0 and f(0, 1, 1) = 3 mod 2 = 1.b.

    x1 x2 x3 f(x1, x2, x3)1 1 1 0

    1 1 0 01 0 1 11 0 0 10 1 1 10 1 0 10 0 1 00 0 0 0

    Problem 20.9

    Draw the graphs of the power functions f13 (x) and f14 (x) on the same set ofaxes. When, 0 < x < 1, which is greater: x

    1

    3 or x1

    4 ? When x > 1, which isgreater s

    1

    3 or x1

    4 .

    Solution.

    When 0 < x < 1, x1

    3 < x1

    4 . When x > 1, x1

    3 > x1

    4 .

  • 8/22/2019 dm - qa

    75/127

    75

    Problem 20.10

    Graph the functionf

    (x

    ) = x

    x on the interval (

    ,)

    .

    Solution.

    Problem 20.11

    Graph the function f(x) = x x on the inerval (, ).

    Solution.

    Problem 20.12Graph the function h : N R defined by h(n) = n2 .

    Solution.

  • 8/22/2019 dm - qa

    76/127

    76

    Problem 20.13

    Let k : RR be the function defined by the formula k(x) = x1

    x

    for allnonzero real numbers x.a. Show that k is increasing on (0, ).b. Is k increasing or decreasing on (, 0)? Prove your answer.

    Solution.

    a. Note first that k(x) = 1 1x

    . Suppose that 0 < x1 < x2. Then 1x1 < 1x2 .Adding this inequality to the inequality x1 < x2 to obtain k(x1) < k(x2).This shows that k is increasing on (0, ).b. Suppose that x1 < x2 < 0. Then 0 < x2 < x1 and therefore 1x1 < 1x2 .Adding this inequality to the inequality x1 < x2 to obtain k(x1) < k(x2).

    That is, k is increasing on (, 0).

  • 8/22/2019 dm - qa

    77/127

    77

    Problem 21.1

    a. Defineg

    :Z

    Z

    byg

    (n

    ) = 3n

    2..(i) Is g one-to-one? Prove or give a counterexample.

    (ii) Is g onto? Prove or give a counterexample.b. Define G : R R by G(x) = 3x 2. Is G onto? Prove or give acounterexample.

    Solution.

    a. (i) Suppose that g(n1) = g(n2). Then 3n1 2 = 3n2 2. This impliesthat n1 = n2 so that g is one-to-one.(ii) g is not onto because there is no integer n such that g(n) = 2.b. Let y R such that G(x) = y. That is, 3x 2 = y. Solving for x we findx =

    y+2

    3 R. Moreover, G(y+2

    3 ) = y. So G is onto.Problem 21.2

    Determine whether the function f : R R given by f(x) = x+1x

    is one-to-oneor not.

    Solution.

    Suppose that f(x1) = f(x2). Thenx1+1x1

    = x2+1x2

    . Cross multiply to obtainx1x2 + x1 = x1x2 + x2. That is, x1 = x2 so that f is one-to-one.

    Problem 21.3

    Determine whether the function f : R

    R given by f(x) = x

    x2+1is one-to-

    one or not.

    Solution.

    Suppose that f(x1) = f(x2). Thenx1

    x21+1

    = x2x22+1

    . Cross multiply to obtain

    x1x22 + x1 = x

    21x2 + x2. That is, (x1 x2)(x1x2 1) = 0. This is satisfied for

    example for x1 = 2 and x1 =12

    . Thus, f(2) = f(12

    ) with 2 = 12

    . Thus, f isnot one-to-one.

    Problem 21.4

    Let f : R Z be the floor function f(x) = x.a. Is f one-to-one? Prove or give a counterexample.

    b. Is f onto? Prove or give a counterexample.

    Solution.

    a. Since f(0.2) = f(0.3) = 0 with 0.2 = 0.3, f is not one-to-one.b. f is onto since for any x Z, x R and f(x) = x.

  • 8/22/2019 dm - qa

    78/127

    78

    Problem 21.5

    Let = {0,

    1} and letl

    : N

    denote the length function.a. Is l one-to-one? Prove or give a counterexample.b. Is l onto? Prove or give a counterexample.

    Solution.

    a. l(10) = l(11) but 10 = 11 so that l is not one-to-one.b. Given any nonnegative integer n we can always construct a string of lengthn from the alphabet . So l is onto.

    Problem 21.6

    If : R R and g : R R are one-to-one functions, is f + g also one-to-one?Justify your answer.

    Solution.

    The answer is no. Let f(x) = x 1 and g(x) = x + 1. Then both functionsare one-to-one but f + g = 0 is not one-to-one.

    Problem 21.7

    Define F : P{a,b,c} N to be the number of elements of a subset ofP{a,b,c}.a. Is F one-to-one? Prove or give a counterexample.b. Is F onto? Prove or give a counterexample.

    Solution.

    a. Since F({a}) = F({b}) = 1 and {a} = {b}, F is not one-to-one.b. Since Range(F) = {0, 1, 2, 3} = N, F is not onto.Problem 21.8

    If : R R and g : R R are onto functions, is f + g also onto? Justifyyour answer.

    Solution.

    The answer is no. The functions f, g : Z Z defined by f(n) = n + 2 andg(n) = n + 3 are both onto but (f + g)(n) = 2n + 5 is not onto since thereis no integer n such that (f + g)(n) = 2.

    Problem 21.9

    Let = {a, b} and let l : N be the length function. Let f : N {0, 1, 2} be the hash function f(n) = n mod 3. Find (fl)(abaa), (fl)(baaab),and (f l)(aaa).

  • 8/22/2019 dm - qa

    79/127

    79

    Solution.

    (f

    l)(

    abaa) =

    f(

    l(

    abaa)) =

    f(4) = 1

    .

    (f l)(baaab) = f(l(baaab)) = f(5) = 2.(f l)(aaa) = f(l(aaa)) = f(3) = 0.

    Problem 21.10

    Show that the function F1 : R R given by F1(y) = y23

    is the inverseof the function F(x) = 3x + 2.

    Solution.

    We have (F F1)(y) = F(F1(y)) = F(y23

    ) = 3(y23

    ) + 2 = y. This showsthat F F1 = IR. Similarly, (F1 F)(x) = F1(F(x)) = F1(3x + 2) =3x+2

    2

    3 = x. Hence, F1

    F = IR.Problem 21.11

    If f : X Y and g : Y Z are functions and g f : X Z is one-to-one,must both f and g be one-to-one? Prove or give a counterexample.

    Solution.

    Let f : {a, b} {1, 2, 3} be the function given by f(a) = 2, f(b) = 3.Then f is one-to-one. Let g : {1, 2, 3} {0, 1} be the function given byg(1) = g(2) = 0 and g(3) = 1. Then g is not one-to-one. However, thecomposition function g f : {a, b} {0, 1} given by (g f)(a) = 0 and(g f)(b) = 1 is one-to-one.Problem 21.12

    If f : X Y and g : Y Z are functions and g f : X Z is onto, mustboth f and g be onto? Prove or give a counterexample.

    Solution.

    Let f : {a, b} {1, 2, 3} be the function given by f(a) = 2, f(b) = 3.Then f is not onto. Let g : {1, 2, 3} {0, 1} be the function given byg(1) = g(2) = 0 and g(3) = 1. Then g is onto. However, the compositionfunction g

    f :

    {a, b

    } {0, 1

    }given by (g

    f)(a) = 0 and (g

    f)(b) = 1 is

    onto.

    Problem 21.13

    If f : X Y and g : Y Z are functions and g f : X Z is one-to-one,must f be one-to-one? Prove or give a counterexample.

  • 8/22/2019 dm - qa

    80/127

    80

    Solution.

    Letx1

    , x2

    Xsuch that

    f(

    x1) =

    f(

    x2)

    .Then

    g(

    f(

    x1)) =

    g(

    f(

    x2))

    .Thatis, (g f)(x1) = (g f)(x2). Since g f is one-to-one then x1 = x2. This

    argument shows that f must be one-to-one.

    Problem 21.14

    If f : X Y and g : Y Z are functions and g f : X Z is onto, mustg be onto? Prove or give a counterexample.

    Solution.

    Let z Z. Since g f is onto there is an x X such that (g f)(x) = z.That is, there is a y = f(x) Y such that g(y) = z. This shows that g isonto.

    Problem 21.15

    Let f : W X, g : X Y and h : Y Z be functions. Must h (g f) =(h g) f? Prove or give a counterexample.

    Solution.

    Let w W. Then (h (g f))(w) = h((g f)(w)) = h(g(f(w))). Similarly,((h g) f)(w) = (h g)(f(w)) = h(g(f(w))). It follows that h (g f) =(h g) f.

    Problem 21.16Let f : X Y and g : Y Z be two bijective functions. Show that (gf)1exists and (g f)1 = f1 g1.

    Solution.

    By problem ??, g f is bijective. Hence, by Theorem ?? (g f)1 exists.Since (f1 g1) (g f) = f1 (g1 g) f = f1 (IY f) = f1 f = IXand similalrly (g f) (f1 g1) = IY then (g f)1 = f1 g1 by theuniqueness of the inverse function.

  • 8/22/2019 dm - qa

    81/127

    81

    Problem 22.1

    Find the first four terms of the following recursively defined sequence:v1 = 1, v2 = 2

    vn = vn1 + vn2 + 1, n 3

    Solution.

    The first four terms are:v1 = 1v2 = 2v3 = 4v4 = 7

    Problem 22.2

    Prove each of the following for the Fibonacci sequence:a. F2k F2k1 = FkFk+1 Fk+1Fk1, k 1.b. F2k+1 F2k F2k1 = 2FkFk1, k 1.c. F2k+1 F2k = Fk1Fk+2, k 1.d. Fn+2Fn F2n+1 = (1)n for all n 0.

    Solution.

    a. We have

    F2k F

    2k1 = (Fk+1 Fk1)

    2

    F2k1

    = F2k+1 2Fk+1Fk1= Fk+1(Fk+1 2Fk1)= Fk+1(Fk + Fk1 2Fk1)= Fk+1(Fk Fk1)= Fk+1Fk Fk+1Fk1

    b.F2k+1 F2k F2k1 = (Fk + Fk1)2 F2k F2k1

    = 2FkFk1c.

    F2k+1

    F2k = (Fk+1

    Fk)(Fk+1 + Fk)= (Fk + Fk1 Fk)Fk+2= Fk1Fk+2

    d. The proof is by induction on n 0.

  • 8/22/2019 dm - qa

    82/127

    82

    Basis of induction: F2F0 F21 = (2)(1) 1 = 1 = (1)0.

    Induction hypothesis: Suppose thatFn+2

    Fn

    F2n+1 = (1)

    n.

    Induction step: We must show that Fn+3Fn+1 F2n+2 = (1)n+1. Indeed,Fn+3Fn+1 F2n+2 = (Fn+2 + Fn+1)Fn+1 F2n+2

    = Fn+2Fn+1 + F2n+1 F2n+2

    = Fn+2(Fn+1 Fn+2) + F2n+1= Fn+2Fn + F2n+1= (1)n = (1)n+1

    Problem 22.3

    Find limnFn+1

    Fn where F0, F1, F2, is the Fibonacci sequence. (Assumethat the limit exists.)Solution.

    Suppose that limnFn+1Fn

    = L. Since Fn+1Fn

    > 1 then L 1.On the other hand, we have

    L = limnFn+Fn1

    Fn

    = limn(Fn1Fn

    + 1)

    = limn( 1FnFn1

    + 1)

    = 1L

    + 1

    Multiply both sides by L to obtain

    L2 L 1 = 0.Solving we find L = 1

    5

    2< 1 and L = 1+

    5

    2> 1.

    Problem 22.4

    Define x0, x1, x2, as follows:xn =

    2 + xn1, x0 = 0.

    Find limn

    xn.

    Solution.

    Suppose that L = limn xn. Then L =

    2 + L. Squaring both sides weobtain L2 = L + 2. Solving this equation for L we find L = 1 and L = 2.Since L 0 we see that L = 2.

  • 8/22/2019 dm - qa

    83/127

    83

    Problem 22.5

    a. Make a list of all bit strings of lengths zero, one, two, three, and four thatdo not contain the pattern 111.b. For each n 0 let dn = the number of bit strings of length n that do notcontain the bit pattern 111. Find d0, d1, d2, d3, and d4.c. Find a recurrence relation for d0, d1, d2, d. Use the results of (b) of (c) to find the number of bit strings of length fivethat do not contain the pattern 111.

    Solution.

    a. length 0: length 1: 0, 1

    length 2: 00, 10, 01, 11length 3: 000, 001, 010, 100, 111, 110, 101length 4: 0000, 0001, 0010, 0011, 0100, 0101, 01101000, 1001, 1010, 1011, 1100, 1101.b. d0 = 1, d1 = 2, d2 = 4, d3 = 7, d4 = 13.c. Let n 3. Any string of length n that does not contain the pattern 111either starts with 0 or with 1. If it starts with a 0, this can be followed byany string of n 1 bits that does not contain the pattern 111. There aredn1 of these. If it starts with a 1, then the first two are either 10 or 11, Ifthe first two bits are 10, then these can be followed by any string of n 2bits that does not contain the pattern 111. There are dn2 of these. If the

    first two bits is 11, then the third must be 0, and these are followed by n 3bits of 0s and 1s that does not contain 111. There are dn3 of these. Hence,dn = dn1 + dn2 + dn3, n 3.d. d5 = d4 + d3 + d2 = 24.

    Problem 22.6

    Find a formula for each of the following sums:

    a. 1 + 2 + + (n 1), n 2.b. 3 + 2 + 4 + 6 + 8 + + 2n, n 1.c. 3

    1 + 3

    2 + 3

    3 +

    3

    n, n

    1.

    Solution.

    a. 1 + 2 + + (n 1) = n(n1)2 .b. 3 + 2 + 4 + 6 + 8 + + 2n = 3 + 2(1 + 2 + n) = 3 + n(n + 1).c. 3 1 + 3 2 + 3 3 + + 3 n = 3n(n+1)2 .

  • 8/22/2019 dm - qa

    84/127

    84

    Problem 22.7

    Find a formula for each of the following sums:

    a. 1 + 2 + 22 + + 2n1, n 1.b. 3n1 + 3n2 + + 32 + 3 + 1, n 1.c. 2n + 3 2n2 + 3 2n3 + + 3 22 + 3 2 + 3, n 1.d. 2n 2n1 + 2n2 2n3 + + (1)n1 2 + (1)n, n 1.Solution.

    a. 1 + 2 + 22 + + 2n1 = 2n121 = 2

    n 1.b. 3n1 + 3n2 + + 32 + 3 + 1 = 3n1

    2.

    c. 2n + 3 2n2 + 3 2n3 + + 3 22 + 3 2 + 3 = 2n+1 3.d. 2

    n

    2n

    1

    + 2n

    2

    2n

    3

    + + (1)n

    1

    2 + (1)n

    = 2nn

    k=0(1

    2)k

    =2n+13 (1 (12)n+1).

    Problem 22.8

    Use iteration to guess a formula for the following recusively defined sequenceand then use mathematical induction to prove the validity of your formula:c1 = 1, cn = 3cn1 + 1, for all n 2.Solution.

    Listing the first five terms of the sequence we find:

    c1 = 1

    c2 = 1 + 31

    c3 = 1 + 31 + 32

    c4 = 1 + 31 + 32 + 33

    c5 = 1 + 31 + 32 + 33 + 34

    Our guess is cn = 1 + 3 + 32 + + 3n1 = 3n1

    2. Next, we prove by induction

    the validity of this formula.

    Basis of induction: c1 = 1 =3112

    .

    Induction hypothesis: Suppose that cn =3n12

    .

    Induction step: We must show that cn+1 =3n+11

    2. Indeed,

    cn+1 = 3cn + 1

    = 3(3n1)2

    + 1

    = 3n+132

    + 1

    = 3n+112

  • 8/22/2019 dm - qa

    85/127

    85

    Problem 22.9

    Use iteration to guess a formula for the following recusively defined sequenceand then use mathematical induction to prove the validity of your formula:w0 = 1, wn = 2

    n wn1, for all n 2.

    Solution.

    Listing the first five terms of the sequence we find:

    w0 = 1w1 = 2 1w2 = 2

    2

    2 + 1

    w3 = 23 22 + 2 1

    w4 = 24 23 + 22 2 + 1

    Our guess is wn =n

    k=0(1)k2nk =2n+1(1( 1

    2)n+1)

    3. Next, we prove the

    validity of this formula by mathematical induction.

    Basis of induction: w0 = 1 =20+1(1( 1

    2)0+1)

    3 .

    Induction hypothesis: Suppose that wn =2n+1(1( 1

    2)n+1)

    3.

    Induction step: We must show that wn+1 =2n+2(1( 1

    2)n+2)

    3. Indeed,

    wn+1 = 2n+1 wn

    = 2n+1 2n+1(1( 12 )n+1)3=

    2n+2(1( 12)n+2)

    3

    Problem 22.10

    Determine whether the recursively defined sequence: a1 = 0 and an = 2an1+n 1 satisfies the explicit formula an = (n 1)2, n 1.

    Solution.If the given formula is the correcto one then it must satisfy the mathematicalinduction argument.

    Basis of induction: a1 = 0(1 1)2.

  • 8/22/2019 dm - qa

    86/127

    86

    Induction hypothesis: Suppose that an = (n 1)2.

    Induction step: We must then havean+1 =

    n2.This implies 2

    an +

    n 1 =

    n2

    and by the induction hypothesis we have 2(n 1)2 + n 1 = n2. Simplifyingto obtain n2 3n + 1 = 0 and this equation has no integer solutions.

    Problem 22.11

    Which of the following are second-order homogeneous recurrence relationswith constant coefficients?

    a. an = 2an1 5an2.b. bn = nbn1 + bn2.c. cn = 3cn

    1

    c2n

    2.

    d. dn = 3dn1 + dn2.e. rn = rn1 rn2 2.f. sn = 10sn2.

    Solution.

    a. Yes. A = 2 and B = 5.b. No. A = n depends on n.c. No. Degree of cn2 is 2.d. Yes. A = 3, B = 1.e. No because of the -2.

    f. Yes. A = 0, B = 10.

    Problem 22.12

    Let a0, a1, a2, be the sequence defined by the explicit formula

    an = C 2n + D, n 0

    where C and D are real numbers.a. Find C and D so that a0 = 1 and a1 = 3. What is a2 in this case?b. Find C and D so that a0 = 0 and a1 = 2. What is a2 in this case?

    Solution.a. We have the following system

    C + D = 1

    2C + D = 3

  • 8/22/2019 dm - qa

    87/127

    87

    Solving this system we find C = 2 and D = 1. Hence, an = 2n+1 1. In

    particular,a2 = 7

    .

    b. We have the following systemC + D = 0

    2C + D = 2

    Solving this system we find C = 2 and D = 2. Hence, an = 2n+1 2. Inparticular, a2 = 6.

    Problem 22.13

    Let a0, a1, a2,

    be the sequence defined by the explicit formula

    an = C 2n + D, n 0where C and D are real numbers. Show that for any choice of C and D,

    an = 3an1 2an2, n 2.Solution.

    Indeed,

    3an1 2an2 = 3(C 2n1 + D) 2(C 2n2 + D)= 3C

    2n1

    C

    2n1 + D

    = 2C 2n1 + D= C 2n + D = an