0% found this document useful (0 votes)
25 views

Discrete Mathematics I: Solution

The document contains solutions to exercises on discrete mathematics. Exercise 1 asks to prove that any amount of money from 8 cents and above can be made using just 3 and 5 cent coins, using strong induction. Exercise 2 describes a robot on a grid that can move in four ways and asks to prove it cannot reach the position (1,1). It is shown that a certain predicate is a preserved invariant, allowing the conclusion that (1,1) is unreachable. Exercise 3 proves by strong induction that if a propositional formula has n connectives, the number of its subformulas is at most 2n+1.

Uploaded by

ryuu.ducat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Discrete Mathematics I: Solution

The document contains solutions to exercises on discrete mathematics. Exercise 1 asks to prove that any amount of money from 8 cents and above can be made using just 3 and 5 cent coins, using strong induction. Exercise 2 describes a robot on a grid that can move in four ways and asks to prove it cannot reach the position (1,1). It is shown that a certain predicate is a preserved invariant, allowing the conclusion that (1,1) is unreachable. Exercise 3 proves by strong induction that if a propositional formula has n connectives, the number of its subformulas is at most 2n+1.

Uploaded by

ryuu.ducat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Discrete Mathematics I

Exercise sheet 8 2023

Exercise 1. You live in a strange country where the only coins are 3 cent coins and 5 cent coins.
What are the possible prices you can pay with just these two coins? As it turns out, quite a lot.
Let P (n) stand for the proposition that for the money amount n ≥ 8 cent, you can build it up with
just 3 and 5 cent pieces.

• Prove that for any n ≥ 8 that P(n) holds using strong induction.

• Can you come up with a proof that does not use strong induction but just "regular" induction?
If not, why not? (briefly summarize where the problem lies or briefly show how you could use
"regular" induction. You do not need to give a full proof.)

Solution:
We use strong induction to prove that for the money amount n ≥ 8 cent, you can build it up
with just 3 and 5 cent pieces.

Let P (n) ::= [∃k, l ∈ N : 3k + 5l = n] we prove that for any n ≥ 8 that P (n) is true.

Base Case: We use the following Base case(s):


For n = 8 choose 5 and 3
for n = 9 choose 3 ∗ 3
for n = 10 choose 5 ∗ 2
for n = 11 choose 3 ∗ 2 + 5 ∗ 1
for n = 12 choose 3 ∗ 5

Inductive Hypothesis: We assume for some n ≥ 12 and for all 12 ≤ k ≤ n that P (k) is
true.

Induction step:
From the induction hypothesis we know that P (n − 5) is also true since if n = 12 then n − 5 = 8
and P (8) is true. Also, we know that we can reach n − 5 by removing a 5 cent coin since we
can make the collection adding up to an amount larger than 12 simply by adding a number of 5
cents to one of the base cases. We can make 6 cents using two 3 cent coins as 3 ∗ 2 = 6. Now
we can use the collection of coins used to construct n − 5 and add two 3 cent coins to it to make
n − 5 + 3 ∗ 2 = n + 1 and so we can organize n + 1 as well.

We conclude using the principle of mathematical induction that P (n) is true for all n ≥ 8.

2023 1
Discrete Mathematics I
Exercise sheet 8 2023

Exercise 2. A robot moves on the two-dimensional integer grid (it can go in the negatives too).
It starts out at (0,0) and is allowed to move in any of these four ways:
1. right 2, down 1;
2. left 2, up 1;
3. right 1, up 3;
4. left 1, down 3.
We will gradually prove that this robot can never reach the position (1,1) (1 right and 1 up from
the starting position).
(a) Give a full mathematical description of this state machine (domain of the states, starting state
and transitions).

Solution:
states::= Z × Z

start state ::= (0, 0)




(x + 2, y − 1)

(x − 2, y + 1)
transitions ::= (x, y) −→


(x + 1, y + 3)
(x − 1, y − 3)

(b) Show that the following predicate is a preserved invariant of the state machine:
P ((x, y)) := [∃k ∈ Z s.t. 3x − y = 7k]
Note: x represents the horizontal position (left-right) and y the vertical position (up-down).

Solution:
We show that P ((x, y)) is a preserved invariant of the defined state-machine by analysing the
transition of the state-machine.

Suppose P ((x, y)) is true for some (x, y) ∈ Z2 , so there exists k ∈ Z such that 3x − y = 7k.
We now show that it holds in the next state too for any transition:
• If the robot moved (+2, −1): Then the next state is (x + 2, y − 1). Since P ((x, y)) holds,
we have:

3x − y = 7k ⇔ 3x − y = 7(k + 1) − 7
⇔ 3x − y + 7 = 7(k + 1)
⇔ 3x + 6 − y + 1 = 7(k + 1)
⇔ 3(x + 2) − (y − 1) = 7(k + 1)
So P ((x + 2, y − 1)) holds too.
• If the robot moved (−2, +1): Then the next state is (x − 2, y + 1). Since P ((x, y)) holds,
we have:

3x − y = 7k ⇔ 3x − y = 7(k − 1) + 7
⇔ 3(x − 2) − (y + 1) = 7(k − 1)
So P ((x − 2, y + 1)) holds too.

2023 2
Discrete Mathematics I
Exercise sheet 8 2023

• If the robot moved (+1, +3): Then the next state is (x + 1, y + 3). Since P ((x, y)) holds,
we have:

3x − y = 7k ⇔ 3x − y + 3 − 3 = 7k
⇔ 3(x + 1) − (y + 3) = 7k
So P ((x + 1, y + 3)) holds too.
• If the robot moved (−1, −3): Then the next state is (x − 1, y − 3). Since P ((x, y)) holds,
we have:

3x − y = 7k ⇔ 3x − y − 3 + 3 = 7k
⇔ 3(x − 1) − (y − 3) = 7k
So P ((x − 1, y − 3)) holds too.
Hence, if P ((x, y)) holds for some arbitrary state then it will also hold for the next state, and
so P is a preserved invariant of the state machine. □
(c) Using this result, conclude that the state (1,1) is unreachable.

Solution:
As shown above, P is a preserved invariant. Additionally, P holds for the initial state, (0, 0),
since 3 × 0 − 0 = 7 × 0. So P holds for all reachable states.
Now suppose for a contradiction that (1, 1) is a reachable state. Then, P ((1, 1)) holds. But
there is no k ∈ Z such that 3 − 1 = 2 = 7k, so we have a contradiction. Hence, (1, 1) is not
reachable. □

2023 3
Discrete Mathematics I
Exercise sheet 8 2023

Exercise 3. The function sub returns the set of all subformulas of a formula in propositional
logic. For example, for the formula F = ((P1 ∧ P2 ) ∨ ¬P3 ), sub(F ) = {((P1 ∧ P2 ) ∨ ¬P3 ), (P1 ∧
P2 ), ¬P3 , P1 , P2 , P3 }. Prove by induction on the number of connectives (i. e. ∧, ∨, →, ↔ ¬) in a
formula that if a propositional formula A has n connectives, it holds that |sub(A)| ≤ 2n + 1.

Solution:
Proof by strong induction on the number of connectives in a formula that if a propositional
formula A has n connectives, it holds that |sub(A)| ≤ 2n + 1.

Let P (n) ::= [|sub(A)| ≤ 2n + 1] where n is the number of connectives in A and n ≥ 0.

Base Case: n = 0 i.e. 0 connectives. Then the formula is A is an atom Pi which has ex-
actly one sub-formula (itself), so 1 ≤ 2 ∗ 0 + 1. The base case is true

Induction Hypothesis: Assume for some A ∈ PROP having k connectives, that |sub(A)| ≤
2k + 1.

Inductive Step: Now we add a connective to A, there are three cases.

1. A = ⊥, and since |sub(⊥)| = |{⊥}| = 1 we are done.

2. we add a negation - ¬A. |sub(¬A)| = |sub(A)|+|{¬A}| = |sub(A)|+1. We want to show that


|sub(A)| + 1 ≤ 2(k + 1) + 1 = 2k + 3. This is simple since |sub(A)| ≤ 2k + 1 by assumption,
and so |sub(A)| + 1 ≤ 2k + 1 + 2 reduces to 2k + 2 ≤ 2k + 3 which clearly holds and so we
are done.
3. we add another formula with a binary connective ∗ ∈ {∧, ∨, ⊃, ≡}, and so have A ∗ B.
|sub(A∗B)| = |{(A∗B)}|+|sub(A)|+|sub(B)|. Observation: the total number of connectives
in A ∗ B is k + 1, so the total number of connectives in A and B is k. Let us say that there are
0 < j < k connectives in B, and so therefore there must be k − j connectives in A. Therefore,
by inductive hypothesis, |sub(A)| ≤ 2(k − j) + 1, and |sub(B)| ≤ 2j + 1. Putting it all
together, we want to show that |{(A ∗ B)}| + |sub(A)| + |sub(B)| ≤ 2(k + 1) + 1. Substituting
our inequalities in we have |{(A ∗ B)}| + 2(k − j) + 1 + 2j + 1 ≤ 2(k + 1) + 1, and reducing
we have 1 + 2k − 2j + 2j + 1 + 1 ≤ 2k + 3 which reduces finally to 2k + 3 ≤ 2k + 3 and so
we are done and it holds for this case

Conclusion: we have proved it for n = 0 and we have proved that if it is true for n = k then
it is true for n = k + 1, therefore by the principle of mathematical induction, P (n) is true for
A ∈ P ROP with n ≥ 0 connectives in A.

2023 4

You might also like