# 0.5 Discrete structures recursion  (Page 7/8)

 Page 7 / 8

F<- 2 * 3

i<- 3 + 1

producing F = 6 and i = 4.

Since i = 4, the while loop is not entered any longer, F = 6 is returned and the algorithm is terminated.

To prove that the algorithm is correct, let us first note that the algorithm stops after a finite number of steps. For i increases one by one from 1 and n is a positive integer. Thus i eventually becomes equal to n.

Next, to prove that it computes n!, we show that after going through the loop k times, F = k ! and i = k + 1 hold. This is a loop invariant and again we are going to use mathematical induction to prove it.

Proof by induction.

Basis Step: k = 1. When k = 1, that is when the loop is entered the first time, F = 1 * 1 = 1 and i = 1 + 1 = 2. Since 1! = 1, F = k! and i = k + 1 hold.

Induction Hypothesis: For an arbitrary value m of k, F = m! and i = m + 1 hold after going through the loop m times.

Inductive Step: When the loop is entered (m + 1)-st time, F = m! and i = (m+1) at the beginning of the loop. Inside the loop,

F<- m!* (m + 1)

i<- (m + 1) + 1

producing F = (m + 1)! and i = (m + 1) + 1.

Thus F = k! and i = k + 1 hold for any positive integer k.

Now, when the algorithm stops, i = n + 1. Hence the loop will have been entered n times. Thus F = n! is returned. Hence the algorithm is correct.

## Mathematical induction -- second principle

There is another form of induction over the natural numbers based on the second principle of induction to prove assertions of the form ∀x P(x). This form of induction does not require the basis step, and in the inductive step P(n) is proved assuming P(k)   holds for all k<n . Certain problems can be proven more easily by using the second principle than the first principle because P(k) for all k<n can be used rather than just P(n - 1) to prove P(n).

Formally the second principle of induction states that

if ∀n [ ∀k [ k<n $\to$ P(k) ] $\to$ P(n) ] , then ∀n P(n) can be concluded.

Here ∀k [ k<n $\to$ P(k) ] is the induction hypothesis.

The reason that this principle holds is going to be explained later after a few examples of proof. Example 1: Let us prove the following equality using the second principle:

For any natural number n , 1 + 3 + ... + ( 2n + 1 ) = ( n + 1 )2.

Proof: Assume that 1 + 3 + ... + ( 2k + 1 ) = ( k + 1 )2   holds for all k,   k<n.

Then 1 + 3 + ... + ( 2n + 1 ) = ( 1 + 3 + ... + ( 2n - 1 ) ) + ( 2n + 1 )

= n2 + ( 2n + 1 ) = ( n + 1 )2 by the induction hypothesis.

Hence by the second principle of induction 1 + 3 + ... + ( 2n + 1 ) = ( n + 1 )2   holds for all natural numbers.

Example 2: Prove that for all positive integer n, ${\sum }_{i=1}^{n}$ i ( i! ) = ( n + 1 )! - 1

Proof: Assume that

1 * 1! + 2 * 2! + ... + k * k! = ( k + 1 )! - 1   for all k,   k<n.

Then 1 * 1! + 2 * 2! + ... + ( n - 1 ) * ( n - 1 )! + n * n!

= n! - 1 + n * n!    by the induction hypothesis.

= ( n + 1 )n! - 1

Hence by the second principle of induction ${\sum }_{i=1}^{n}$ i ( i! ) = ( n + 1 )! - 1   holds for all positive integers.

Example 3: Prove that any positive integer n, n>1, can be written as the product of prime numbers.

Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
hi
Loga
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
Got questions? Join the online conversation and get instant answers!