THE ISLAMIC UNIVERSITY OF GAZA
ENGINEERING FACULTY
DEPARTMENT OF COMPUTER ENGINEERING
DISCRETE MATHMATICS DISCUSSION β ECOM 2011
Eng. Huda M. Dawoud
December, 2015
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
Section 1: Mathematical Induction
3. Let P(n) be the statement that 12 + 22 +· · ·+n2 = n(n + 1)(2n + 1)/6 for the
positive integer n.
a) What is the statement P(1)?
b) Show that P(1) is true, completing the basis step of the proof.
c) What is the inductive hypothesis?
d) What do you need to prove in the inductive step?
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
e) Complete the inductive step, identifying where you use the inductive
hypothesis.
f) Explain why these steps show that this formula is true whenever n is a
positive integer.
Answer:
a) P(1) is the statement: 12 = 1 · 2 · 3/6.
b) 12 = 1
1 · 2 · 3/6 = 6 / 6 = 1
both sides equal 1, so the statement P(1) is true.
c) The inductive hypothesis is the statement that
12 + 22 + . . . + π 2 =
π(π + 1)(2π + 1)
6
.
d) For the inductive step, we want to show for each k β₯ 1 that P(k)
implies P(k + 1). In other words, we want to show that assuming the
inductive hypothesis P(k): 12 + 22 + . . . + π 2 =
π(π + 1)(2π + 1)
6
, we
can show P(k+1):
12 + 22 + . . . + π 2 + (π + 1)2 =
(π + 1)(π + 2)(2(π + 1) + 1)
.
6
e) If we add (k + 1)2 to both sides in the inductive step:
π(π + 1)(2π + 1)
6
π(π + 1)(2π + 1)
12 + 22 + . . . + π 2 + (π + 1)2 =
+ (π + 1)2
6
Remember we want to show P(k+1) in part d:
12 + 22 + . . . + π 2 =
12 + 22 + β¦ + π 2 + (π + 1)2 =
=
=
π(π + 1)(2π + 1)+6(π+1)2
6
(π + 1)[π(2π + 1)+6(π+1)]
6
(π + 1)[2π 2 +7π+6]
6
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
=
=
(π + 1)(π + 2)+(2π+3)]
6
(π + 1)(π + 2)+(2(π+1)+1)]
6
f) In part b we have completed the basis step and In part e we have
completed the inductive step, so by the principle of mathematical
induction, the statement is true for every positive integer n.
5. Prove that 12 + 32 + 52 +· · ·+(2n + 1)2 = (n + 1)(2n + 1)(2n + 3)/3
whenever n is a nonnegative integer.
Answer:
Basis Step:
P (0): (2β0 +1)2 = (0+1) (2β0+1)(2β0+3)/3
1 = 1 ο§ P(0) is true
Inductive Step:
Inductive hypothesis: assume that P(k) is true for an arbitrary fixed
integer k β₯ 0
12 + 32 + 52 +· · ·+(2k + 1)2 = (k + 1)(2k + 1)(2k + 3)/3
We want to prove P(k+1):
12 + 32 + 52 +· · ·+(2k + 1)2 +(2(k+1) + 1)2 = ((k+1) + 1)(2(k+1) +
1)(2(k+1) + 3)/3
12 + 32 + 52 +· · ·+(2k + 1)2 +(2k + 3)2 = (k + 2)(2k + 3)(2k + 5)/3
Starting from the assumption of P(k) and adding (2k + 3)2 to both sides
12 + 32 + 52 +· · ·+(2k + 1)2 + (2k + 3)2 = (k + 1)(2k + 1)(2k + 3)/3 +(2k +
3)2
= (k + 1)(2k + 1)(2k + 3)+ 3(2k + 3)2/3
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
= (2k+3)[(k + 1)(2k + 1)+3(2k + 3)] /3
= (2k+3)[2k2 + 9k + 10] /3
= (2k+3)(k + 2)(2k + 5)/3
By mathematical induction, P(n) is true for all integers n with n β₯ 0
21. Prove that 2n > n2 if n is an integer greater than 4.
Answer:
Basis Step:
25 > 52 ο¨ 32 > 25
Inductive Step:
Inductive hypothesis: assume that P(k) is true for an arbitrary fixed
integer k β₯ 5
2k > k2
We want to prove P(k+1)
2k+1 > (k+1)2 ο¨ 2β2k > (k+1)2
From the right hand side
(k+1)2 = k2 + 2k + 1 < k2 + 2k + k < k2 + 3k < k2 + 3k (since k >3) < k2 + k2
< k2 + k2 < 2βk2 (and from the Inductive hypothesis) 2βk2 < 2β2k
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
Section 3: Recursive Definitions and Structural Induction
6. Determine whether each of these proposed definitions is a valid recursive
definition of a function f from the set of nonnegative integers to the set of
integers. If f is well defined, find a formula for f (n) when n is a nonnegative
integer and prove that your formula is valid.
a) f (0) = 1, f (n) = βf (n β 1) for n β₯ 1
c) f (0) = 0, f (1) = 1, f (n) = 2f (n + 1) for n β₯ 2
Answer:
a) This is valid recursive definition, since we are provided with the
value at n = 0 and each subsequent value is determined by the previous
one.
f (n) = βf (n β 1) ο¨ f (n) = { -1, 1, -1, β¦ } for n β₯ 1
So we can write it as f (n) = (-1)n for n β₯ 1
To prove that it is a valid formula by induction, that f (n) = βf (n β 1) = (1)n for n β₯ 1
Basis Step:
f (1) = βf (0) = (-1)1 ο¨ -(1) = -1
Inductive Step
inductive hypothesis: f (k) = βf (k) = (-1)k for k β₯ 1
We want to prove f (k+1) = βf (k+1-1) = (-1)k+1 from the inductive
hypothesis.
ο¨ f (k+1) = βf (k) = (-1)k+1 = (-1)k (-1)1 = -(-1)k ο¨ f (k) = (-1)k
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
c) This is invalid. We are told that f(2) is defined in terms of f(3), but
f(3) has not been defined.
8. Give a recursive definition of the sequence {an}, n = 1, 2, 3, . . . if
a) an = 4n β 2.
b) an = 1 + (β1)n
Answer:
a) We can write the first 5 elements and then try to notice a recursive
definition
a1 = 4(1) -2 = 2
a2 = 4(2) -2 = 6 = 2 + 4
a3 = 4(3) -2 = 10 = 6 + 4
a4 = 4(4) -2 = 14= 10 + 4
a5 = 4(5) -2 = 18= 14 + 4
As we notice, an element is equal the an-1 + 4
b)
a1 = 1 + (-1)1 = 0
a2 = 1 + (-1)2 = 2
a3 = 1 + (-1)3 = 0
a4 = 1 + (-1)4 = 2
a5 = 1 + (-1)5 = 0
As we notice, a1 and a2 repeats so if we take them as basis we can write
that an = an-2
DISCRETE MATHMATICS
ECOM 2012
ENG. HUDA M. DAWOUD
Section 4: Recursive Algorithms
7. Give a recursive algorithm for computing nx whenever n is a positive
integer and x is an integer, using just addition.
Answer:
As we know we can represent the multiplication process nx as a n
repeated summation of x.
procedure product(n: positive integer; x: integer)
if n = 1 then return x
else return product(n - 1, x) + x
To understand how the previous procedure works, look at the following
tracing:
P1
Letβs call the procedure to calculate 4β5
product(4,5)
P1 calls P2 and wait for it to return the result
if 4 = 1 then return 5
P2 calls P3 and wait for it to return the result
P3 calls P4 and wait for it to return the result
else return product(3, 5) + 5
P2
if 3 = 1 then return 5
else return product(2, 5) + 5
P3
P4 retruns 5 to P3
P3 returns 5 + 5 to P2
P2 returns 5 + 5 + 5 to P1
P1 returns 5 + 5 + 5 + 5
if 2 = 1 then return 5
else return product(2, 5) + 5
P4
if 1 = 1 then return 5
else return product(0, 5) + 5
Now P1 after waiting the results will return 5 + 5 + 5 + 5
Now you know how recursive algorithms works :D, Try to solve some
other problems on it by yourself.
© Copyright 2026 Paperzz