Adding and Subtracting Numbers in Different Bases

We can perform the normal arithmetic operations in different bases.

Example: Compute (121)_3+(11)_3.

In order to compute this, we can convert both numbers to the decimal system, add them together and convert back to ternary (base 3) or we can add normally and use the Odometer Principle as presented in lecture.

Odometer Principle
Let the base be given by the natural number b. Start by considering the rightmost digit.
  1. If the digit we are consider is not b-1, then replace it by the next digit in order, and terminate the algorithm.
  2. If we are consider a blank space (to the left of all the digits), then write in it the digit 1, and terminate the algorithm.
  3. If neither of the above holds, we are considering the digit b-1. Replace it with the digit 0, move one place left, and return to step 1.
For the example, consider each of the digit places: (\textcolor{red}{1}\textcolor{blue}{2}1)_3+(\textcolor{blue}{1}1)_3. We have denoted the one’s place in black, the “three’s” place in \textcolor{blue}{\text{blue}} and the “nine’s” place in \textcolor{red}{\text{red}}. In the one’s place 1+1=2, in the three’s place \textcolor{blue}{2+1}=\textcolor{red}{1}\textcolor{blue}{0}, therefore, (according to the Odometer’s Principle) we carry the 1 and get (\textcolor{red}{2}\textcolor{blue}{0}2)_3. This works intuitively just like the base 10 case.

Exercise: Compute (801)_9+(122)_9.

    \[(\textcolor{red}{8}\textcolor{blue}{0}1)_9+(\textcolor{red}{1}\textcolor{blue}{2}2)_9=(\textcolor{purple}{1}\textcolor{red}{0}\textcolor{blue}{2}3)_9\]


Example: Compute (123)_9-(4)_9.

In this problem, we have to regroup just like in normal subtraction. Let’s recall the base 10 case with 123-4. We can’t directly subtract 4 from 3, therefore, we borrow a “ten” and subtract 4 from 13 instead which is 13-4=9. so we get 123-4=119. The one in the ten’s place is not a two because we took away one of the tens.

Now, let’s look at this in base 9. Instead of borrowing a “ten,” we borrow a “nine”, and compute (13)_9-(4)_9=(8)_9, therefore we get (123)_9 - (4)_9 = (118)_9.


Exercise: Compute (801)_9-(122)_9.

    \[(801)_9-(122)_9 = (668)_9\]


Related Topics: Representing Numbers in Different Bases