Solution Manual for Connecting Discrete Mathematics and Computer Science 1st Edition By David Liben-No
, Connecting Discrete Mathematics
and Computer Science
Solution Manual
David Liben-Nowell
,Solution Manual for Connecting Discrete Mathematics and Computer Science 1st Edition By David Liben-
Nowell
Solution Manual for Connecting Discrete Mathematics and Computer Science 1st Edition By David Liben-
Nowell
, 2 Basic Data Types
2.2 Booleans, Numbers, and Arithmetic
2.1 112 and 201
2.2 111 and 201
2.3 18 and 39
2.4 17 and 38
2.5 Yes: there’s no fractional part in either x or y, so when they’re summed then there’s still no fractional part.
2.6 Yes: if we can write x = a and y = c with b ̸= 0 and d ̸= 0, then we can write x + y as ad+cb (and bd ̸= 0 because
b d bd
neither b = 0 nor d = 0).
2.7 No, and here’s a counterexample: π and 1 − π are both irrational numbers, but π + (1 − π) = 1, which is rational.
2.8 6, because ⌊2.5⌋ = 2 and ⌈3.75⌉ = 4 (and 2 + 4 = 6).
2.9 3, because ⌊3.14159⌋ = 3 and ⌈0.87853⌉ = 1 (and 3 · 1 = 3).
2.10 34 = 3 · 3 · 3 · 3 = 81, because ⌊3.14159⌋ = 3 and ⌈3.14159⌉ = 4.
2.11 The functions floor and truncate differ on negative numbers. For any real number x, we have ⌊x⌋ ≤ x—even if x
is negative. That’s not true for truncation. For example, ⌊−3.14159⌋ = −4 but trunc(−3.14159) = −3 .14159 = −3.
2.12 ⌊x + 0.5⌋
2.13 0.1 · ⌊10x + 0.5⌋
2.14 10−k · 10kx + 0.5
2.15 10−k · 10kx
2.16 If x is an integer, then ⌊x⌋ + ⌈x⌉ = 2x; if x isn’t an integer, then ⌊x⌋ + ⌈x⌉ = 2 + 3 for any x in [2, 3]. Thus
⌊x⌋+⌈x⌉
the expression x 2− is equivalent to x − x = 0 for x = 2 or 3 (yielding values 0 and 0), and x − 2.5 for
noninteger x. So the largest possible value for this expression is 0.4999999 · · · , when x = 2.9999999 · · · .
⌊x⌋+⌈x⌉
2.17 By the same logic as in Exercise 2.16, the smallest value of the expression x − 2 is −0.5 + ϵ, which occurs for
x = 2 + ϵ, for arbitrarily small values of ϵ. For example, the value is −0.4999999 when x = 2.00000001.
2.18 ⌊x⌋
2.19 ⌈x⌉
3
, Connecting Discrete Mathematics
and Computer Science
Solution Manual
David Liben-Nowell
,Solution Manual for Connecting Discrete Mathematics and Computer Science 1st Edition By David Liben-
Nowell
Solution Manual for Connecting Discrete Mathematics and Computer Science 1st Edition By David Liben-
Nowell
, 2 Basic Data Types
2.2 Booleans, Numbers, and Arithmetic
2.1 112 and 201
2.2 111 and 201
2.3 18 and 39
2.4 17 and 38
2.5 Yes: there’s no fractional part in either x or y, so when they’re summed then there’s still no fractional part.
2.6 Yes: if we can write x = a and y = c with b ̸= 0 and d ̸= 0, then we can write x + y as ad+cb (and bd ̸= 0 because
b d bd
neither b = 0 nor d = 0).
2.7 No, and here’s a counterexample: π and 1 − π are both irrational numbers, but π + (1 − π) = 1, which is rational.
2.8 6, because ⌊2.5⌋ = 2 and ⌈3.75⌉ = 4 (and 2 + 4 = 6).
2.9 3, because ⌊3.14159⌋ = 3 and ⌈0.87853⌉ = 1 (and 3 · 1 = 3).
2.10 34 = 3 · 3 · 3 · 3 = 81, because ⌊3.14159⌋ = 3 and ⌈3.14159⌉ = 4.
2.11 The functions floor and truncate differ on negative numbers. For any real number x, we have ⌊x⌋ ≤ x—even if x
is negative. That’s not true for truncation. For example, ⌊−3.14159⌋ = −4 but trunc(−3.14159) = −3 .14159 = −3.
2.12 ⌊x + 0.5⌋
2.13 0.1 · ⌊10x + 0.5⌋
2.14 10−k · 10kx + 0.5
2.15 10−k · 10kx
2.16 If x is an integer, then ⌊x⌋ + ⌈x⌉ = 2x; if x isn’t an integer, then ⌊x⌋ + ⌈x⌉ = 2 + 3 for any x in [2, 3]. Thus
⌊x⌋+⌈x⌉
the expression x 2− is equivalent to x − x = 0 for x = 2 or 3 (yielding values 0 and 0), and x − 2.5 for
noninteger x. So the largest possible value for this expression is 0.4999999 · · · , when x = 2.9999999 · · · .
⌊x⌋+⌈x⌉
2.17 By the same logic as in Exercise 2.16, the smallest value of the expression x − 2 is −0.5 + ϵ, which occurs for
x = 2 + ϵ, for arbitrarily small values of ϵ. For example, the value is −0.4999999 when x = 2.00000001.
2.18 ⌊x⌋
2.19 ⌈x⌉
3