Skip to main content

Finding Factorial

Factorial of a number is the product of that number and all the numbers below it. 

Factorial 4 is symbolically expressed as:

4!

To calculate Factorial 4:

4! = 4 × 3 × 2 × 1 = 24

So, in calculation of finding the Factorial of '4'  we have taken into account numbers from '4' to '1'. We have moved in descending order upto '1'.

Factorial of a number can also be calculated using recursion. Recursion is a method to solve a problem. Some mathematical problems are nicely solved using recursion.

Let n be a non-negative counting number. n can be zero, let us say. The factorial of n is: 


n! = n × ( n - 1 )! 


By definition, 

0! = 1


Let us find the factorial of '2' using recursion. By the formula,

2! = 2 × ( 2 - 1)! =  2 × 1!  ------ ( i )

1! = 1 × ( 1 - 1 )!= 1 × 0!   ------ ( ii )

0! = 1 (By definition of factorial) ----- (iii)

Now, upon substitution of ( iii ) in  ( ii ), we get:

1! = 1 ×1 = 1 --------- ( iv )

Now, substituting ( iv ) in ( i ) we get,

2! = 2 × 1 = 2

So, 2! = 2 is the answer.

That's it.


Recursion tells to find the solution to a problem ( 2! = ? ) by creating a smaller problem ( 2! = 2 × ( 2 - 1 )! = 2 × 1! ) of similar nature. Now, we move ahead. Now, a smaller problem ( 1! = ? ) is there for us to solve. The solution to this smaller problem ( 1! = ? ) is provided by creating a problem further ( 1! = 1 × ( 1- 1 )! = 1 × 0! ). So, we see the problem ( 2! = ? ) becomes smaller and smaller. At last the problem ( 0! = ? ) is so small that it is readily solved ( 0! = 1).


The last problem ( 0! = ? ) became very small. The  solution to the last problem was readily achieved( 0! = 1 ). In fact, the last solution ( 0! = 1 ) is very clearly stated when a problem is solved using recursion. This is a very important property of recursion. Now, this last problem ( 0! = ? ) was part of a little bigger problem ( 1! =1 × 0! ). 

_____________________

Note: The last solution, in the forward march towards answer using recursion,  is  very clear cut. 

______________________


As we know, the last problem ( 0! = ? ) stands solved by definition ( 0! = 1 ). This last solution ( 0! = 1 ) becomes the part of solution ( 1! = 1 × 0! ) of the little bigger problem ( 1! = ? ) that awaits solution. The little bigger problem ( 1! = ? ) is solved ( 1! = 1 × 0! = 1 ). Similarly we move upwards and solve bigger problems ( as for example, 2! = ? ). At last, the problem ( 2! = ? )that was questioned is solved ( 2! = 2 × 1! = 2). Thus, the solution ( 2! = 2 ) is found using the recursion concept. 

It is clear that in case of recursion the solution to a problem is written in terms of the problem itself.  

We can be  told to solve a problem using recursion. While finding the solution, we will like to express the solution in detail. Now, the solution is based on recursion. So, we will see that the solution part contains a problem. Yes, we have written the solution in terms of the problem of similar nature. 

We can see that finding a solution using recursion leads to development of a new problem. The difference between the old problem and the new problem is there. The new problem is smaller and easier than the old one. So, we have not found the solution yet. But we have moved closer to the solution. This happened when the problem appeared as a new problem. The newer problems are easier. 

The first problem became smaller when it appeared as the second problem. Once the easiest solution ( the last solution) is found, the closest easy problem to the easiest ( the second last ) is solved. This goes on and the original big problem gets a solution.

Let us visualise  things related to recursion practically and very simply.

Developing a pattern, we can easily say that the successive next stage problems are getting smaller and smaller.  This is good for us. Actually, the problem goes on becoming smaller. The problem is becoming small and  getting divided. 


Anything that gets divided naturally becomes small. At last the solution is found. We can say that the problem is Conquered or solved.

The approach of dividing and then solving a problem is called 'Divide and Conquer'. When simplification of the problem has peaked, forward simplification is impossible. The stage is set for the conquest. Steadily the big size of the problem is solved.

So, we say the problem has been  Conquered. The problem of finding Factorial was solved using this very approach- Divide and Conquer. Sounds like Divide and Rule. I cannot help.

Comments

Popular posts from this blog

Interface Message Processor ( IMP )

Interface Message Processor ( IMP ) is a special purpose Computer. The Processor plays a vital role in Host-to-Host communication. IMP is placed between Host Computers.  IMP helps Hosts to exchange information. IMPs ( Interface Message Processors ) form a group. The group dedicates itself towards reliable transmission of Packets. _________________________ Note: An Interface Message Processor can be supposed to have a face. Firstly this supposed face of IMP is in the direction of the first Host, which sends the  message. Secondly, this face is turned towards the other Host.  Now, the IMP,  with its face turned around, communicates with this other Host.  Transformed message from IMP is communicated to this Host. __________________________ Message ( a piece of information ) sent from the Host ( source of information  ) is transformed into Packets. Transformation of the message into Packets is performed by an IMP. These Packets are forwarded to the receiver H...