You are on page 1of 10

CS 1104: Discrete Mathematics Semester: Spring 2022

Midterm
Instructor: Soumyottam Chatterjee Student Name: Uttkarsh Kohli
Due: March 22, 2022 Uttkarsh.kohli 24@ashoka.edu.in

1
2

Problem 1 (6 points)
2
Prove that xx = o(1.001x ). You may assume that each of the domain and the codomain
is R+ , i.e., the set of positive real numbers. You may not make any use of Stirling’s
approximation or of the ”limit definition” of the o-notation.

Answer:

Pre-requisite = ln(x) = o(x)


Claim: ∀c > 0, c ∈ R+ Let k = max{1, 1c } then ∀x > k, we have ln(x) < c ∗ x

Proof:
let f (x) = c ∗ x − ln(x)

we know f (1) = c ∗ 1 − ln(1) = c and since c > 0, f (1) > 0.

f ′ (x) = c − 1/x, for x > 1/c we have f ′ (x) > 0 therefore it is increasing.

Since f (1) > 0 and for x > 1c , f (x) is increasing [if 1


c
< 1 then we take for x > 1 > 1c ],
f (x) > 0 =⇒ c ∗ x − ln(x) > 0 =⇒ ln(x) < c ∗ x.

Since we have ∀c > 0, c ∈ R+ Let k = max{1, 1c } then ∀x > k, we have ln(x) < c ∗ x

2
To prove : ∀c > 0, c ∈ R+ ∃k : {∀x > k, xx < c ∗ (1.001)x }
2
Let f(x) = ln(c ∗ (1.001)x ) − ln(xx )

f (x) = ln(c) + x2 ln(1.001) − xln(x)

if ln(c) > 0 then let g(x) = x2 ln(1.001) − xln(x) then we have f (x) > g(x)

1
Claim: for ln(c) > 0 we have f (x) > g(x) > 0, ∀x > ln(1.001)

Proof: g(x) = x2 ∗ ln(1.001) − x ∗ ln(x),

g(x) > 0 when x(x ∗ ln(1.001) − ln(x)) > 0

thus g(x) > 0 when x ∗ ln(1.001) − ln(x) > 0

thus g(x) > 0 when x ∗ C − ln(x) > 0 [for C = ln(1.001)] which we know from above is
1
true ∀x > ln(1.001)

1
since we have ln(c) > 0 then f (x) = ln(c) + g(x) > ln(c) + 0 > 0, ∀x > ln(1.001)

since f (x) > 0, ln(c) + x2 ln(1.001) − xln(x) > 0


3

2 ln(1.001)
then ln(c) + x2 ln(1.001) > xln(x) which implies eln(c)+x > exln(x) for x ∈ R+
2
=⇒ xx < c ∗ (1.001)x

1
Since we have ∀c > 0, c ∈ R+ Let k = ln(1.001)
then ∀x > k, we have ln(x) < c ∗ x
x x2
it is proved, x = o(1.001 ).
4

Problem 2: (Exercise 2.3.16 in the textbook) (2 points)

For a proposition of n variables, each variable can have 2 values: True or false. Therefore,
by the product rule there are a total 2 ∗ 2 ∗ ..... ∗ 2[n times] = 2n different combinations
of the truth values of n variables.
This represents 1 specific arrangement with 2n values. Since we have to find the total num-
ber of different truth tables that can be formed and we know one table has 2n elements,
n
and each can have 2 values: True or false. There will be a total of 2∗2∗.....2[2n times ] = 22
n
Hence proved, there are 22 different truth tables for propositions in n variables.

Example: If we have a proposition in 1 variable, then it can have 21 different values:


1
true and false. There are 22 different combinations of these 2 variables (True, True),
(True, False),(False, True),(False, False).
1
for n = 1 variable, there would be 22 = 4 truth tables and they are as follows:

a proposition a proposition a proposition a proposition


, , ,
T T T F F T F F

Table 1: Different Truth Tables for n = 1


5

Problem 3: Exercise 5.1.50 in the textbook (6 points)

The name of a variable in the C programming language is a string that may


contain uppercase letters, lowercase letters, digits, or underscores. Further-
more, the first character in the string must be a letter, either uppercase or
lowercase, or an underscore. If the name of a variable is determined by its
first eight characters, how many different variables can be named in C? (Note
that the name of a variable may contain fewer than eight characters.)

Total number of upper case letters: 26 Total number of lower case letters: 26 Total
number of underscore characters: 1 Total number of digits: 10

To find: number of different variable names possible under the given conditions.

Conditions:
1) The first character is either a letter(lowercase or uppercase) or an underscore. Total
possible characters for the first character:
26 + 26 + 1 = 53 [Rule of Sums] 2) Rest of the characters can be uppercase letters,
lowercase letters, digits, or underscores. Total possible characters for the rest of the char-
acters: 26 + 26 + 10 + 1 = 63.

By the rule of products, the total number of different variables satisfying the condi-
tions are :

For 8 characters: 53 ∗ 637 .


For 7 characters: 53 ∗ 636 .
For 6 characters: 53 ∗ 635 .
For 5 characters: 53 ∗ 634 .
For 4 characters: 53 ∗ 633 .
For 3 characters: 53 ∗ 632 .
For 2 characters: 53 ∗ 631 .
For 1 character: 53 ∗ 630 .

By the rule of sums, the total number of different variables satisfying the conditions
are :
Answer: 53 ∗ 637 + 53 ∗ 636 + 53 ∗ 635 + 53 ∗ 634 + 53 ∗ 633 + 53 ∗ 632 + 53 ∗ 631 + 53

= 53(637 + 636 + 635 + 634 + 633 + 632 + 631 + 630 )

212133167002880
6

Problem 4 (3 points)

Given two functions f : A −→ B and g : B −→ C, is g necessarily one-to-


one if both f and g ◦ f are one-to-one?

Answer: Proof by counterexample

Original Claim: g is necessarily one-to-one if both f and g ◦ f are one-to-one.

Counterexample:
f (x) = x, f : {1, 2} → {1, 2, 3, 4}. [f is one-to-one on its domain]
(
x, x ̸= 4
g(x) = , g : {1, 2, 3, 4} → {1, 2, 3, 4}. [g is many-to-one on its domain since f(3)=f(4)=3]
3, x = 4

(g ◦ f )(x) = x, (g ◦ f ) : {1, 2} → {1, 2, 3, 4} [g ◦ f is one-to-one on its domain]

Therefore, the original claim is false.

No, g is not necessarily one-to-one if both f and g ◦ f are one-to-one.


7

Problem 5 (4 points)

To prove:
Prove that if n is an odd positive integer, then n2 ≡ 1 (mod 8).

Proof:
If n is an odd positive integer then n = 2k + 1, k ∈ Z≥0 .
n2 = (2k + 1)2 = 4k 2 + 4k + 1

Case 1: k is even, k = 2s, s ∈ Z≥0


n2 = 4k 2 + 4k + 1 = 4 ∗ (2s)2 + 4 ∗ (2s) + 1
n2 = 16s2 + 8s + 1
n2 = 8(2s2 + s) + 1
n2 − 1 = 8(x), for some x ∈ Z≥0

By definition: If a and b are integers and m is a positive integer, then a is congru-


ent to b modulo m if m divides a−b. [Definition 3, page 240, Kenneth Rosen 7th edition].

Since 8 divides 8x, 8 divides n2 − 1 =⇒ n2 − 1 ≡ 0 (mod 8)


=⇒ n2 ≡ 1 (mod 8)

Case 2: k is odd, k = 2s + 1, s ∈ Z≥0


n2 = 4k 2 + 4k + 1 = 4 ∗ (2s + 1)2 + 4 ∗ (2s + 1) + 1
n2 = 16s2 + 16s + 4 + 8s + 4 + 1
n2 = 16s2 + 24s + 9
n2 = 8(2s2 + 3s + 1) + 1
n2 − 1 = 8(x), for some x ∈ Z≥0

By definition: If a and b are integers and m is a positive integer, then a is congru-


ent to b modulo m if m divides a−b. [Definition 3, page 240, Kenneth Rosen 7th edition].

Since 8 divides 8x, 8 divides n2 − 1 =⇒ n2 − 1 ≡ 0 (mod 8)


=⇒ n2 ≡ 1 (mod 8)

Since these 2 cases are exhaustive (an integer is either odd or even), it is proved: if
n is an odd positive integer, then n2 ≡ 1 (mod 8).
8

Problem 6 (6 points)

Prove that no integer in the following sequence is a perfect square:

11, 111, 1111, 11111, 111111, ...

Answer:

Pre requisite -
Claim: If an odd number is a perfect square, it is the perfect square of an odd number.
p: x2 , x ∈ N is odd
q: x, x ∈ N is odd
To prove: p → q

Proof by contraposition: Assume ¬q, let x be not an odd number, then x is even,
x = 2k, k ∈ N .
x2 = (2k)2 = 4k 2 = 2(2k 2 )
since 2 divides x2 , x2 is even =⇒ x2 is not odd which is ¬p.
(¬q =⇒ ¬p) ⇐⇒ (p =⇒ q)
Therefore claim holds, proof by contraposition.

Each integer in the above sequence can be represented as 10n + 10n−1 + 10n−2 + .... + 1

Proof by contradiction:
Assume: Sn is a perfect square.
Since Sn has 1 as the unit digit, it is not divisible by 2 and thus it is odd =⇒ it is the
perfect square of an odd number. [Proved above]

Let Sn = (2k + 1)2 , k ∈ N

4k 2 + 4k + 1 = 10n + 10n−1 + 10n−2 + .... + 101 + 1

4k 2 + 4k = 10n + 10n−1 + 10n−2 + ....101

2(2k 2 + 2k) = 2(2n−1 5n + 2n−2 5n−1 + 2n−3 5n−2 + .... + 21 ∗ 52 + 20 51 )

2(k 2 + k) = (2n−1 5n + 2n−2 5n−1 + 2n−2 5n−3 + .... + 21 ∗ 52 + 51 )

2(k 2 + k) = 2(2n−2 5n + 2n−2 5n−1 + 2n−3 5n−1 + .... + 20 ∗ 52 ) + 51

2(m) = 2(x) + 5, for some m ∈ N, x ∈ N.

2(m − x) = 5

Since 2 divides 2(m − x), it is even.


9

Since 2 does not divide 5, it is odd.


Thus clearly the statement 2(m − x) = 5 is false for any m ∈ N, x ∈ N .
Since the statement is false, our original claim: Sn is a perfect square will be false.

Hence proved, by contradiction, no integer in the sequence is a perfect square.


10

Problem 7 (3 points)

To prove: Prove that (3!)n |(3n)! for all natural numbers n.

Proof by induction:
Basis: for n = 1, (3!)1 = 3! = 6, (3n)! = (3 ∗ 1)! = 6 and 6|6. therefore the statement
holds for n = 1.

Induction hypothesis: Assume for all m such that n > m > 1, m ∈ N , assume (3!)m |(3m)! =⇒
(3m)! = k ∗ (3!)m for some k ∈ N

Induction step: for n = m + 1, we have (3!)(m+1) = 3! ∗ (3!)m and (3(m + 1))! =


(3m + 3) ∗ (3m + 2) ∗ (3m + 1) ∗ (3m)!

case 1: m is even.
=⇒ m = 2p, p ∈ N
3m + 2 = 6p + 2 = 2(3p + 1)
=⇒ 2|(3m + 2) and since 3|3m, we have (3 ∗ 2)|((3m) ∗ (3m + 2))
thus we have 3!|((3m) ∗ (3m + 2))

Since (3!)m |(3m)! and 3!|((3m + 3) ∗ (3m + 2) ∗ (3m + 1))

we have (3!)(m+1) |(3(m + 1))! [Proved below]

case 2: m is odd.
=⇒ m = 2p + 1, p ∈ N
3m + 1 = 6p + 3 + 1 = 2(3p + 2)
=⇒ 2|(3m + 1) and since 3|3m, we have (3 ∗ 2)|((3m) ∗ (3m + 1))
thus we have 3!|((3m) ∗ (3m + 1))

Since (3!)m |(3m)! and 3!|((3m + 3) ∗ (3m + 2) ∗ (3m + 1))

we have (3!)(m+1) |(3(m + 1))! [Proved below]

These 2 cases are exhaustive(an integer is either odd or even).

Therefore, it is proved by induction: we have (3!)n) |(3n)! for all natural numbers.

Theorem used: if a|b and c|d then ac|bd.

Proof: b = ak, d = cp
bd = ak ∗ cp = akcp
clearly a|bd and c|bd and ac|bd.

You might also like