Foxmaths! 2.0

March 29, 2008

Multiplication: You’re Doing It Wrong!

Filed under: Maths — Tags: , , , , , — Fox @ 8:23 pm

It is of interest to me the extent to which the traditional long multiplication algorithm is of so little use when multiplying irrational numbers. I mean, consider the below with respect to our traditional place value system.

1.41421356237309504880168872421…

Clearly it trails off infinitely to the right. But the point is, in traditional multiplication, you start at the rightmost digit because you can be guaranteed that no lesser places will effect the multiplication of that place through carrying. For example, multiplying 432*599, looking at the last two digits of 2 and 9, it’s clear to see that the last digit of the product must be an 8, since 9*2 = 18. The next digit can then be worked out, knowing you carry that 1. However, starting from the opposite side, 4*5 = 20, so you ‘know’ that the leftmost side must be around (imagine airquotes around that) 20. But you can’t say for sure, because prior terms in the product will effect the final result. Indeed, a more astute observation would be to say that 599 is almost 600, and 4*6 = 24, so the leftmost side of the product will more closely resemble 24. Of course, we’re already using prior terms to adjust our prediction/calculation about the leftmost side of the product. And indeed, if you calculate the actual product out, 258768, we see that the leftmost part is actually 25 – we were close, but some amount of carrying pushed us off slightly. By starting from the lowest place value, we avoid all this.

So, as it applies to irrational numbers, because they have an infinite decimal representation, there is no lowest place value to start at. There is an obvious starting point, the leftmost place, the 1 before the decimal, but the problem then is that the place values decrease from left to right, so any kind of carrying would just fail, and multiplication would just fall apart.

The point though is that I don’t really care, so what happens if we apply the multiplication algorithm to infinite sequences of digits?

Here, certain things get a little tricky, like notation. For example, traditional sequences are written starting from the left and trailing off with ellipsis on the right, ie 1, 1, 2, 3, 5, 8, … . But as with the problem with irrational numbers, place values actually increase in the opposite direction, so we’ve got to write sequences backwards, … 8, 5, 3, 2, 1, 1. Of course, in our treatment here, we’re thinking about digit sequences, so there’s really no point in paying attention to commas and things. What we’re going to be doing is trying to multiply things like …96310 x …771.

Now, for this to work, we really have to disregard any since of value. Any number represented going to the left like that by an infinite series of digits is itself, infinite, using the traditional place value system, so what we’re going to accomplish here is just a massive amount of digit shuffling. We’re just taking an algorithm, and applying it to inputs.

So the easiest place to start would be something like …1111 x 7. Breaking everything apart, what we’ve got is (1 + 10 + 100 + …)x(7). And pretty clearly that yields (7 + 70 + 700 + …) = …7777. An infinite sequence of 7’s. No carrying – easy. Then consider something like …1111 x 11. Expanding this out in a similar fashion, we’ve got (1 + 10 + 100 + …)x(1 + 10), which we can expand out as (1 + 10 + 100 + …) + (10 + 100 + 1000 + …), which sums to give …2221. An infinite sequence of 2’s terminating in a 1.

Now, assuming that there is sum pattern or period to the infinite sequence, multiplying it by a finite number I’m fairly certain always yields a new, also patterend sequence. This is analogous to the fact that multiplying to rationals always gives a rational (rationals have periodic decimal representation).

But let’s consider multiplying two patterend infinite sequences. Consider, …1111 x …1111. Now, as to calculation, note that it’s really sufficient to multiply some truncated length of each sequence together, and then take some number of digits from the result. For exampe, 1 x 1 = 1, so the last digit will be a 1. 11 x 11 = 121, so the second digit will be a 2. 111 x 111 = 12321, so the last digits will be 321.

Using Mathematica, we find that

…111 x …111 = …987654320987654320987654321

Breaking it up to make the result more readable, what we have is …[987654320][987654320][987654321]. Notice the way, after the first section, the last two sections (reading from right to left), are duplicates. Clearly the sequence has begun to repeat, obeying some kind of pseudo-rational relation along the decimals.

I could go on and talk about periodic behaviors, the range of carrying influence, etc, but I’m really just beating around the bush, and as I’m approaching my standard 1000 word limit, I’ll get to the point. I want to find a sequence, we’ll call it S, such that S x S = S, that the value squared equals the original value – using a convoluted definition of value. For example, …001 x …001 = …001, but that’s a trivial and uninteresting result. Traditional arithmetic to solving x2 = x yields the only solutions as 1 and 0. But let’s see if we can get something much more special.

So, consider S = …a4a3a2a1a0, for ai some digit from 0 to 9. We want to determine values of ai such that S x S = S.

Expanding out as we did before, it becomes S = … + 1000 a3 + 100 a2 + 10 a1 + a0.

Multiplying out and collecting powers of 10, S x S can be written as …

a0*a0
+ 10( a0*a1 + a1*a0 )
+ 100( a0*a2 + a1*a1 + a2*a0)
+ …

The above sum gives us a method for calculating the ‘value’ of the product, but what we really want to be able to do is to calculate the digits of that product sequence.

The first digit of the resulting sequence can be thought of as the remainder when divided by 10. Clearly, as all the higher order terms are divisible by powers of 10, the only term of the sum that contributes to this first digit is a02. Since we want S x S = S, we want the remainder of a02 divided by 10 to be equal to a0, so that the digits of the sequences match.

As a0 can only be between 0 and 9, there are a finite number of possibilities, namely 0, 1, 5, 6, correspnding to 0*0 = 0, 1*1 = 1, 5*5 = 25, with a remainder of 5, and 6*6 = 36, with a remainder of 6. Clearly a0 = 0 corresponds to S = …000, which we trivially do not want. a0 = 1 corresponds to S = …001, which again we do not want. This gives only two possible values of interest for a0, 5 and 6.

We’ll assume that a0 = 5. Then the lowest order term is 25 = 2*10 + 5. Notice now that that 2*10 is carried over into the next term, 10( a0*a1 + a1*a0 + 2). Making the substitution that a0 = 5, we get the coefficient on 10 is 5*a1 + a1*5 + 2, or 10*a1 + 2. Now, to match this with the ’10’s digit on the S sequence, we need the remainder when that value is divided by 10 to be the same as a1. Of course, dividing that by 10 gives a remainder of 2, so trivially it must be that a1 = 2. As such, so far we have

S x S = …25 x …25 = …25

Notice we can check this easily, as 25*25 = 625, and 625 ends in 25 : )

I’ll calculate one more digit, just for fun. Then we can automate…

Now, the ‘100’s place in the product is given by 100*( a0*a2 + a1*a1 + a2*a0), and as I just said, what we have so far amounts to 25*25 = 6*100 + 25, so we’re carrying in an extra 6 term. So the coefficent on 100 is actually

a0*a2 + a1*a1 + a2*a0 + 6

5*a2 + 2*2 + a2*5 + 6

10*a2 + 4 + 6

10*a2 + 10

As before, the 100’s digit in the product is going to be the above value’s remainder when divided by 10. Which is to say, 0. And we want to match this with the 100’s digit in the S sequence, which was a2. Therefore, a2 = 0.

Working out further, we find that

S = …392256259918212890625

What’s interesting about this is that, past the choice of a0, it was completely deterministic what the next digit had to be, which means the entire sequence could be calculated … given an infinite amount of time, anyway. Going back and choosing a0 = 6, we find that S = …9376, but if you do the calculation, you find that every next digit is completely determined.

But this is interesting to me : ) I wonder, were I to calculate far more digits of that first S sequence, would any patterns form? What is it about that sequence of numbers that causes the self-similarity to its square be satisfied? I don’t know. Something to investigate, perhaps.

Until that point, what I’m going to do is flip it around, make it a number, give it a name, and call it mine.

SFOX = 5.26098212819952652293…

It should be noted that this fox constant squared, SFOX2 = 27.677932953234819…, which strikes me as an entirely uninteresting number.

Care to prove me wrong?

3 Comments »

  1. Since by flipping the decimal representation of the number you lose its value, you’re not any closer to an algorithm for multiplying irrationals, but strip that off and the idea of simply multiplying infinite sums is quite interesting. There are only two finite solutions to x^2 – x = 0, but if we consider infinite integers expressed as (sorry, I don’t think I can do subscripts in the comment) a[0] + 10a[1] + 100 a[2] + … then there are two additional solutions. I wonder, then, are there such solutions to other polynomial equations? Can we generalize? Can it be proved that there are only two such infinte integers that satisfy the equation?

    I can’t think of any reason why you couldn’t legitimately multiply such infinite sums, given you’re only interested in the smallest digits of the solution… full-on algebra would get tricky. Interesting, though.

    Meantime, if I were you, I’d claim the pair of infinite sums rather than the flipped-around irrational number… the foxy sums?

    Comment by David — March 31, 2008 @ 3:20 pm

  2. I thought about claiming those infinite sums, but since they didn’t seem to be a well formed mathematical object, I wasn’t really sure … but why not, I claim those too : )

    And I did a little playing, and it seems that, for the most part, for the solutions to a given polynomial equation, in this infinite sum form, the sequence of digits is defined by the choice of the first digit. In computing the solutions to x^2 = x, every other digit fell out after the choice of 5 or 6 as the first, so to choosing 1 and 0, though those solutions are uninteresting. If this holds, then it would seem that the number of solutions to a given polynomial equation would be equal to the number of solutions to f(x) (mod 10) = 0, for x from 0 to 9. Interestingly though, this would give a maximum of 10 solutions to any polynomial equation, so I’m possibly missing something here. More investigation is in order, I do believe.

    Comment by Fox — March 31, 2008 @ 4:10 pm

  3. Why not apply the traditional algorithm from the left? I started doing that (maybe in 3rd grade) because, when the numbers were big, and errors occurred, they were usually further to the right (I was corrected: better to have no errors).

    But I still do long mult left to right. The carries are a bit awkward, but in the case of irrational roots, I like the result.

    Jonathan

    Comment by jd2718 — April 4, 2008 @ 11:24 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.