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

Local-Area Networks

Local-Area Networks ( LANs ) are restricted to a small area. Such Networks may be established within a building. Computers that are part of Local-Area Networks are Personal Computers ( PCs ) or microcomputers. These Computers are connected to each other. Simple communication lines connect these Pers Networks bring people together. When people join  hands teamwork becomes possible. The structural composition of LANs simplifies teamwork. In other words, LAN hardware supports teams having similar processing requirements. LAN Computers readily support personalization of tasks allocated to professionals.  Office staff can work together and share information. This improves the efficiency of the entire workforce. It has been noted that here all the Networked Computers are Personal Computers. They are of equal capacity. Mostly LAN users have similar tasks. If situations allow, a user is independent to access any Computer to serve his purpose. LAN users can exercise the option of secu...

Computers - An Introduction

Computers are man made machines. They are made to work very fast. Working fast they can solve  big and small problems.  Modern science has given us these computers. They are very popular. Computers affect and change lives. They keep us happy.The happiness grows. Computers are quick and smart. Great problem solvers and simplifiers are our computers. They can do our work without stopping. Focus is on doing only what is needed. Not needed, not done.  Computers are  life-less servants. They cannot think or make decisions on their own. They are empowered to work. They are given each and every thing so that they carry out our orders. Orders are respected by computers. The manner in which computers work is wholly dependent on man.  The quality of service provided by computers is remarkable. They are loved by human beings. Computers are known for smart and quick service. Computers do not give wrong results. Correct answers are always given. Questions which are difficult...

Euclid's Algorithm

The Greatest Common Divisor ( GCD ) of  two numbers is a number. The number ( GCD ) causes division of the two numbers. This number ( GCD ) is the greatest number that is possible. This divisor partially forms the two numbers. Adding  the divisor successively may result in formation of the two numbers. One can note that when the divisor is the greatest, the division of the dividend is the sharpest. The division operation is very effective. When the Greatest Common Divisor of two numbers is considered, we think of a number that can cause division of both the numbers. Here the two numbers are unequal. The Greatest Common Divisor causes divisions of the two numbers differently. This is clear from the two different quotient values.  The GCD value is very interesting to note. It relates very well with the two numbers. The GCD of two even numbers is also an even number. The GCD of two odd numbers is an odd number. So, we can say that GCD is an abstraction of the two numbers in ...