Friday, 7 June 2013

Chinese Method for Speedy Multiplication of any two integers


You must have read about Shakuntala Devi, the 'Human Calculator'. She use to crunch numbers real fast.

In 1977 in USA she competed with a computer to see who gives the cube root of 188138517 faster, she won. 

At the Southern Methodist University she was asked to give the 23rd root of a 201-digit number; she answered in 50 seconds. Her answer—546,372,891—was confirmed by calculations done at the U.S. Bureau of Standards by the Univac 1101 computer, for which a special program had to be written to perform such a large calculation.

But here's your chance at showing off your own Blazing Fast Multiplication prowess.

Suppose you need to find 2873 X 5964=?

That is an awful lot of multiplication right?
Wrong !! Ancient Chinese had  a dead simple method to do this, here is how:

1. Make a matrix which has n columns and m rows. Where n is the number of digits in number A and m is the number of digits in number B.


Here A=2873, so n=4
B=5964, so m=4 as well.
Let us write them as below in a table n X m (4X4) as in Fig-1 below.
Draw a diagonal line in each square.


 Fig-1

2. Now Start multiplying the number in each column with the number in every row and keep writing the numbers as below. Refer Fig-2
 Fig-2

Notice that 2X5=10, so 1 is written to the left of the diagonal in column 1, Row 1 and 0 is written to the right of diagonal in column 1, Row 1.

Likewise 2X4=8 is written as 0 written to the left of the diagonal in column 1, Row 4 and 8 is written to the right of diagonal in column 1, Row 4.

3. Starting from the bottom, mark the diagonal rows as shown in Fig-3
 Fig-3


So Diagonal D1 has the numbers
D1=2, similarily
D2=8,1,8
D3=2,2,2,1,7
D4=8,3,8,4,3,2,5
D5=0,2,4,2,6,5,1
D6=1,8,7,0,3
D7=1,0,4
And
D8=1

4.       Now sum the numbers in each Diagonal Row,  if the sum is less than 10 write down the digit else if greater than 10, then carryover the 10’s place to the next diagonal. As shown below:

D1=2
D2=8+1+8=17, so take 7 (and carryover 1 to D3)
D3=2+2+2+1+7+(1 from D2)=15, so take 5 (and carryover 1 to D4)
D4=8+3+8+4+3+2+5+(1 from D3)=34, so take 4 (and carryover 3 to D5)
D5=0+2+4+2+6+5+1+(3 from D4)=23, so take 3 (and carryover 2 to D6)
D6=1+8+7+0+3+(2 from D5)=21, so take 1 (and carryover 2 to D7)
D7=1+0+4+(2 from D6)=7 , so take 7
D8=1, so take 1

5   4.      Now simply write down the numbers taken at each of the diagonals starting from D1 on the extreme right to D8 on the extreme left
And we get the answer
** 17134572  **

Beauty is this method works for any size of numbers





No comments:

Post a Comment