Generic 3 digit formula

The case of solving for a 3 digit number multiplied by another 3 digit number is done below. First I shall derive an algorithm and then show how it maps into an easier formula when both numbers are the same. Suppose we have two numbers 123 and 456. We have many ways to represent these numbers. For example we could say this:


60 + 60 + 3 = 123


80 + 200 + 100 + 70 + 2 + 2 + 2 = 456


We could also represent them both like this:


(1*100) + (2*10) + (3*1) = 123 and (4*100) + (5*10) + (6*1) = 456


Now lets multiply them together:


(1*100 + 2*10 + 3*1) * (4*100 + 5*10 + 6*1) =


(1*100)(4*100) + (1*100)(5*10) + (1*100)(6*1) +


(2*10)(4*100) + (2*10)(5*10) + (2*10)(6*1) +


(3*1)(4*100) + (3*1)(5*10) + (3*1)(6*1) =



...



(4*10000) + (5*1000) + (6*100) +


(8*1000) + (10*100) + (12*10) +


(12*100) + (15*10) + (18*1) =


See if you notice any patterns above... Do you see the '/' pattern? (it goes 1, 2, 3, 2, 1)


40000 + 5000 + 600 +


8000 + 1000 + 120 +


1200 + 150 + 18 = 56088


That was a lot of work so now lets derive the formula. If we substitute the letters for the following set of numbers in the original problem above:


a = 1; b = 2; c = 3; d = 4; e = 5; f = 6;


we could represent each number like this:


(a*100) + (b*10) + (c*1) = 123 and (d*100) + (e*10) + (f*1) = 456


But since we are solving for any number we don't have to worry about the numbers on the right hand side at the moment. Also note by convention, 100a is considered to be 100*a.


Now lets multiply the general case together


(100a + 10b + c) * (100d + 10e + f) =


10000ad + 1000ae + 100af +


1000bd + 100be + 10bf +


100cd + 10ce + cf =


10000ad + 1000ae + 1000bd + 100af + 100be + 100cd + 10bf + 10ce + cf =


10000ad + 1000(ae+bd) + 100(af+be+cd) + 10(bf+ce) + cf The answer to our problem.


Now suppose the two numbers are the same, that is suppose a is the same number as d and b is the same number as e and so on. This means:


a=d <-- They are the same


b=e <-- They are the same


c=f <-- They are the same


Then we can substitute an 'a' anywhere we find 'd'. We can also substitute a 'b' anywhere we find 'e' and so on. So our formula now becomes:


10000a**2 + 1000(ab+ba) + 100(ac+bb+ca) + 10(bc+cb) + c**2 =


Which simplifies to: 10000a**2 + 2000ab + 100(2ac+b**2) + 20bc + c**2 =


10000a**2 + 2000ab + 200ac + 100b**2 + 20bc + c**2


Now that we have formulas, its interesting to think of the problem like this: (generic a,b,c,d,e,f case)

The original numbers are arranged above the line. The formula generates the grouping below the line and shows them generally aligned according to their units.



Notice in our generic formula, the first digits start in the 1000's column. The last digits start in the one's column.


And the middle sets reside between the two (they actually start in the 10's column, and may overlap into the 1000's column). The middle sets themselves break into three groups.



I find the pictorial way of viewing the numbers with the highlighted groupings a much easier way to solve problems, then just memorizing some formula which you will probably forget . You can think of the pictures of these numbers as patterns. The idea that there is a pattern is the basis of many computer related concepts.


For Example the Object Oriented Methodology is comprised of identifying and using patterns in a meaningful manner. There have been many books written that teach you how to find patterns in the process of Object Oriented Design.


Another use of the pattern is for really huge number arithmetic and how this relates to computer architecture as a whole. Although today's computers are binary(base 2 arithmetic) based and many operations are simply left and right bit shifts, this mechanism lends itself to the idea of using patterns to solve a problem.


Try to derive a pattern that handles 4 digit numbers multiplied by 4 digit numbers: example 0824*1962. I will present the algorithm and pattern soon and you may use that to check your work. The eventual goal is to develop a pattern capable of handling a number of 'n' digits multiplied by a second number of 'm' digits.


Curious? Send me email if curious...
Counter Started
01/26/98:
Thanks for visiting! Back... The 4x4 pattern

Tracfone cell phone deal

Get yourself an awesome deal on a cell phone through TracFone and avoid getting stuck in an endless contract.

Take a look at the world famous beaver cam


Copyright ©1997-2004 David Stockwell All rights reserved