Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Operations in Nondecimal Bases


Date: 10/16/1999 at 20:02:32
From: Tommy Paley
Subject: Operations in non-decimal bases

Hi doctor,

I understand how to add numbers in other bases, but I was wondering if 
it was possible to subtract, multiply, and divide numbers in other 
bases?

I tried to multiply the base 9 numbers:

       35
     x 28
     -----

When I get 5 x 8 = 40, where do I go from there? I was thinking that 
40 = 4(9^1) + 4(9^0). So I thought I'd place a four in my answer, and 
carry the other 4:

       4
       35
     x 28
     -----
        4

and then I went 3 x 8 + 4 = 28 = 3(9^1) + 1(9^0). Is this right so 
far? If it is, I think the answer should be 1124.

Can you show me how to divide and even square numbers in other bases?

Thanks in advance. I am looking forward to teaching my math 9 classes 
about different bases.

Tommy


Date: 10/16/1999 at 22:58:12
From: Doctor Peterson
Subject: Re: Operations in non-decimal bases

Hi, Tommy.

You'll want to look through our FAQ on bases,

   http://mathforum.org/dr.math/faq/faq.bases.html   

It includes some help on operations in various bases, especially 
binary, as well as a long discussion of "adding in hexadecimal." Some 
of the other information on the meaning of bases and how to convert 
may be of use to you as well.

The operations all work the same in any base; the only things that are 
different are the tables. Your multiplication is exactly right; it 
might go faster if you actually wrote up a multiplication table in 
base 9, so you could see instantly that 5 * 8 = 44 (base 9). That will 
especially help if you try dividing in base 9 - a good table is a 
must, as you may recall from your early experiences with base 10 
division.

Actually, the operations are almost trivial in binary, because there's 
practically no table to learn; that allows you to focus on the 
algorithm alone, so it can be a great teaching tool for kids who 
follow binary well in the first place, but need to see the 
multiplication and division algorithms more clearly. I sort of taught 
my son to multiply in binary before I taught him to do it in decimal.

Since we already cover operations in binary pretty well in our 
archives, let's try a different small base. I'll use 3. First we make 
the tables:

     + | 0 | 1 | 2 |     * | 0 | 1 | 2 |
     --+---+---+---+     --+---+---+---+
     0 | 0 | 1 | 2 |     0 | 0 | 0 | 0 |
     --+---+---+---+     --+---+---+---+
     1 | 1 | 2 |10 |     1 | 0 | 1 | 2 |
     --+---+---+---+     --+---+---+---+
     2 | 2 |10 |11 |     2 | 0 | 2 |11 |
     --+---+---+---+     --+---+---+---+

Now for subtraction, the only trick is borrowing. In decimal, you 
borrow by subtracting one from the column to the left, and adding 10 
to the column you are working in. Here, you do the same thing,
remembering that 10 now means 3. Or if you want, you can add 3 in 
decimal to the digit, since within one digit the base doesn't matter. 
Let's subtract 10 from 15:

                 13
                 //
       15 -->   120
     - 10 --> - 101
     ----     -----
                012 --> 1*3 + 2 = 5

You've shown me how to multiply, but I'll write one out in base 3 so I 
can use it for division:

       20 -->   202
     * 15 --> * 120
     ----     -----
                000
              1111
              202
             ------
             102010 --> ((((1*3 +0)*3 +2)*3 +0)*3 +1)*3 + 0 = 300

(Here I've used one of the easy conversion methods in the FAQ.)

Now let's divide:

         _____120_
     202 ) 102010
            202
            ---
            1111
            1111
            ----
               00

Since there's such a small table, this was pretty easy - all I can 
multiply a number by is 0, 1, or 2, so it's easy to guess a digit for 
the quotient.

To square a number, of course, you just multiply it by itself.

Hope this helps. Let me know if you need any more ideas for teaching 
this subject - it's one of my favorites. (I work with binary and 
hexadecimal all the time in my programming job.)

- Doctor Peterson, The Math Forum
  http://mathforum.org/dr.math/   
    
Associated Topics:
High School Number Theory

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/