160 Online Text Book
160 Online Text Book
160 Online Text Book
1 Introduction 5
1.1 Puzzles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Shunting trains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 River crossings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Scales and balances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6 Modular Arithmetic 69
6.1 Congruent integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.2 Digital Roots and divisibility tests . . . . . . . . . . . . . . . . . . . . . . . . 76
6.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
8 Number bases 95
8.1 Binary numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
8.2 Base-n blocks and the line abacus . . . . . . . . . . . . . . . . . . . . . . . . . 98
8.3 Addition of base-n numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
8.4 Multiplication of base-n numbers . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.5 Subtraction of base-n numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 105
8.6 Switching bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
8.7 Long division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
8.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5
1 Introduction
1.1 Puzzles
This chapter has a few puzzles for you to try. They are mathematical in nature, but do not
require a deep mathematics background. They do depend upon ingenuity and reasoning, and
usually require more than one attempt to solve. The solutions are within your capabilities
and the puzzles are intended for classroom use, so the answers are not given. The best way
(maybe the only way) to learn mathematics is to do it yourself.
The Die Hard jugs. In the film Die Hard With A Vengeance, the characters John
McClane and Zeus Carver open a briefcase only to discover that in doing so they
have armed a powerful bomb. It will explode in a matter of minutes unless they
can disarm it. Inside the briefcase there is a scale. They have at their disposal two
jugs—one holds exactly 5 gallons and the other holds exactly 3 gallons. To disarm
the bomb, they have to fill the 5 gallon jug with exactly four gallons of water and
place it on the scale. An ounce too much or too little will detonate the bomb. The
water can be obtained from a nearby fountain.
How can they disarm the bomb?
Could they do it if the jugs held exactly 9 and 6 gallons?
McClane and Zeus were able to solve the first part of this entertaining puzzle, but they would
have had a lot more difficulty with the the second part. The reason you cannot accomplish
the task with 9-gallon and 6-gallon jugs is that all transactions involve the addition or
subtraction of quantities that are multiples of 3 gallons, so the resulting quantity must
therefore be a multiple of 3 gallons.
If we use jugs that hold exactly 24 gallons and 30 gallons, then any quantity we could
measure would have to be a multiple of 6 gallons, because 6 is a divisor of 24 and 30. More
to the point, 6 is the largest number that divides both 24 and 30, and we express this by
saying that 6 is the greatest common divisor of 24 and 30. You will learn a lot more
about greatest common divisors in Chapter 4. The Die Hard jug problem has more than
one solution, and you will learn a way to find all solutions to problems like it in Chapter 7.
6 CHAPTER 1. INTRODUCTION
Passing Trains. The two trains pictured above have to pass each other. Fortu-
nately, there is a siding, and the cars can be coupled and uncoupled to each other or
to the back of the engines. Unfortunately, there is only room enough on the siding
for one car or one engine, and the engines cannot push or pull cars with their front
ends. How can the trains pass each other?
Can you do it if each train has an engine and two cars?
Train shunting problems were very popular at the beginning of the 20th century. Sam Loyd
(see the references at the end of the these notes) had several, including a version of this
problem with 4 cars per train.
The lettuce fearing leviathan. A farmer is taking his prize lettuce, lion, llama,
and pet leviathan to market. Unsupervised, leviathans eat lions unless a lettuce is
present. A boat awaits him to cross a river, but he can only take one item at a time.
How can the farmer cross the river, without the llama eating the lettuce, the lion
eating the llama, or the leviathan eating the lion?
1.4. SCALES AND BALANCES 7
The second is by Henry Dudeney, a renowned British puzzler from the early 1900’s.
A heavy counterfeit. There are eight coins, all identical in appearance. One
is fake and weighs slightly more than the others. Using a balance scale, find the
counterfeit in as few weighings as possible.
The question is asking for the minimum number of weighings in the worst case scenario. If
your strategy is to compare coin #1 against coin #2, then #2 against #3 etc., you may
be lucky enough to find the counterfeit coin in the first weighing, but in the worst case
scenario, this strategy wouldn’t find the fake until you compare coins #7 and #8, so this
method would take 7 weighings. Most people can find a strategy that guarantees that the
fake can be found in three weighings. The appeal of coin weighing problems is that the
optimal solution is better than “obvious” solution. So, can you do better than three?
Sort the tokens. You have 4 tokens weighing 3, 5, 6 and 9 grams. One is red, one
is white, one is blue and the fourth is green, but none of them have their weights
marked. Using a balance scale what is the least number of weighings needed figure
out their weights? You are only allowed to use the tokens themselves.
8 CHAPTER 1. INTRODUCTION
1.5 Exercises
1. Interchange the positions of the red chips and the
blue chips. The rules are as follows:
R R R
• A chip may be moved into an empty space
that is connected to it by a line.
• A chip may jump over one chip of the opposite
colour provided it jumps in a straight line, B B B
follows the lines of the board, and lands in an
empty space.
2. Cups and ball (From Andy Liu and Bill Sands). There are six cups, all upside
down in a line. Hidden under one of them is a precious spherical jewel. The object
of this game is to find the hidden jewel. You are allowed to lift up the cups one at a
time, however, after each time, you must leave the room and the jewel must be placed
beneath a different but adjacent cup. So, for example, if the jewel was beneath cup #
4, it must be placed beneath either cup # 3 or cup # 5.
You are only permitted 12 tries, and you must announce before the game begins the
order in which you will lift the cups.
If there were only two cups, you could win this game in at most two turns: Look under
cup #1 twice. If there were only three cups, look under cup #2 twice. If there were
4 cups, it becomes more interesting.
3. (From Boris Kordemsky’s The Moscow Puzzles.) Place seven dots on a circle. Get 6
coins, and staring with any dot and counting clockwise and place a coin on the third
dot. Then, starting with any dot that is not yet covered, count clockwise and put a
coin on the third dot. Do not skip dots that are covered. Explain how to place the
six coins so that no two are on the same dot.
4. Smith and Smith Pharmacies has received a shipment of children’s vitamin pills. The
pills are coloured red yellow, green, blue and purple. Unfortunately, all of the pills of
a certain colour are defective, while all the rest are safe. The safe pills each weigh 8
grams. The defective ones each weigh 8.1 grams. How can the pharmacy detect the
defective pills in a single weighing on a scale (not a balance).
5. A wholesaler of golfing equipment was swindling his retailers by including one box
of substandard golf balls to every nine boxes of top grade balls he sold them. Each
box contained 6 golf balls, and the external appearance of all the balls was identical.
However, the substandard balls were each 1 gram too light. The retailers were informed
of this discrepancy. The boxes all arrived in packs of ten, each with one substandard
box—but which one?
Phoebe Fivewood, the professional at a prestigious golf course, had just taken delivery
of a large order so needed to sort them out quickly. She soon found a way to do this
using a pair of scales (not pan balances) which required only one weighing on each
1.5. EXERCISES 9
scale for each batch of ten boxes. How did she do it? Note that she did not need to
know what a golf ball should weigh.
6. Three bears and three humans have to take a boat from one island to another island.
One bear is a special bear who can row the boat. The boat can hold no more than
two. There can never be more bears than humans on either island or the human will
be killed. How can this be done?
7. (Found in several places on the web.) Three warlords are on one side of a river. Each
is accompanied by his young son who is not quite ready for battle yet. All six want to
cross the river but there is only one boat to shuttle them back and forth. This boat
can hold at most two people. All three warlords and the eldest young son (four people
altogether) can operate the boat. How do you scuttle them safely across the river?
Leaving a son unattended by his own father in the presence of another warlord in any
situation will result in terrible death for the young one.
8. (From Brian Bolt’s The Amazing Mathematical Amusement Arcade.) A number of
playing cards of the same suit were arranged in a circle on the table in such a way
that the total of the face values of any set of three adjacent cards differed by at most
one from the total for any similar set. The highes and lowest cards on the table were
the 10♦ and 2♦. The 6♦ was also in the circle. What cards were on the table and
what was their order?
9. Crossing the bridge. This has become a classic. Four people are being pursued by
a menacing beast. It is nighttime, and they need to cross a bridge to reach safety. It is
pitch black, and only two can cross at once. They need to carry a lamp to light their
way. The first person can cross the bridge in no less than 10 minutes, the second in 5
minutes, the third in 2 minutes, and the fourth in 1 minute. If two cross together, The
couple is only as fast as the slowest person. (That is, a fast person can’t carry a slower
person to save time, for example. If the 10-minute person and the 1-minute person
cross the bridge together, it will take them 10 minutes.) The person or couple crossing
the bridge needs the lamp for the entire crossing, and the lamp must be carried back
and forth across the bridge (no throwing, etc.)
If they don’t all get completely across in strictly less than 19 minutes, who ever is on
the bridge or left behind will be eaten by the beast. Is it possible for all of them to
get across?
11
The rational numbers are the numbers that can be written in the form a/b where a
and b are integers and b 6= 0.
The irrational numbers are the real numbers that are not rational numbers.
All natural numbers are integers but not all integers are natural numbers. All integers are
rationals but not all rationals are integers. Similarly, all rational
√ numbers are real numbers,
√
but not conversely—we shall see later that numbers like 2 and 6 are irrational. Because
each set is a subset of the next, it may seem sensible to view the development of the number
system as going from natural numbers to integers to rational numbers to real numbers.
History, however, did not follow this nice logical progression (see the timeline on page 118
in the appendix). By the time written languages appeared, the natural numbers and the
positive fractions were already in use. The natural numbers were needed for counting things
like money or cattle and the fractions were needed to measure and compare things like area
and weight.
Then came the number zero—it popped up at different times in different places, but always
after the development of fractions. Some civilizations never did get around to admitting
zero into their number system. The Romans did not even have a symbol for it.
In The nothing that is: a natural history of zero, Robert Kaplan presents a case that the
zero symbol originated with the Babylonians, was taken up by the Greeks and transported
to India by the armies of Alexander and then to China and Arabia and back to Europe.
Although the Babylonians did have a symbol for zero, the consensus is that zero was never
treated as a number—it was used only as a place holder like the zero in the number 102.
The Babylonians never talked about a zero quantity, but spelled it out verbally: “So-and-so
is owed nothing”.
In 1202 Fibonacci introduced the Hindu-Arabic numerals that we use today: the symbols
from 1 to 9 (which he called figures) and the symbol for zero (which he called a sign rather
than a figure). It took another 300 years before zero was accepted as a member of our
number system. Other civilizations twigged onto the fact somewhat earlier—for example,
by 1200AD in India they had already worked out arithmetic rules for operating with zero
and negative numbers.
12 CHAPTER 2. NUMBERS AND OPERATIONS
By the middle of the 16th century, the number zero was being used more frequently. Negative
numbers were appearing on stage as a necessary part of double entry bookkeeping, and the
number zero became a necessary ingredient in understanding them. Like zero, negative
numbers were slow to be accepted as numbers in their own right. John Napier, the inventor
of logarithms, and the person who popularized our present use of decimal fractions, referred
negative numbers as defectivi at the beginning of the seventeenth century.
From the late fifteenth century through the sixteenth century other changes were happening
to our number system. Decimal fractions were introduced. Also appearing for the first
time were the plus and minus signs as we know them today, the ‘ × ’ for the multiplication
sign, and ‘ = ’ for the equal sign although these were not universally used. (The division
symbol ‘ ÷ ’ first appeared a century later.) In the sixteenth century, people also began
using variables for numbers. At that time, they were still avoiding negative numbers, and the
solutions for quadratic equations would have been broken into special cases: 3x2 −2x−5 = 0
would be transformed into 3x2 = 2x+ 5 and considered to be of the form ax2 = bx+ c rather
than belonging to the general form ax2 + bx + c = 0. Surprisingly, the rules for operating
with negative numbers were known. However, the rules applied only to expressions like
(a − b)(c − d) where the negatives were less than the corresponding positives1 .
To put things in a historical setting, here are a few of the notable events of the sixteenth
century: By 1500, Gutenberg had printed his bibles, Columbus and da Gama had made
their momentous voyages. Da Vinci had painted the Mona Lisa, and Michaelangelo would
soon complete his work in the Sistene Chapel. The Renaissance was underway. A new class
of entrepreneurs was arising—ones who sent other people to buy and sell goods—and this
lead to the creation of double entry bookkeeping mentioned above.
In the sixteenth century the calendar was seriously out of whack. In 1582 a new calendar,
the Gregorian Calendar, was introduced and the discrepancy was fixed by removing the
dates from Oct 5 to Oct 14 for that year2 .
The protestant reformation was underway. By 1534 Martin Luther had translated the Bible
into German. It was not a good time to have unorthodox views—in 1572, 20,000 protestants
were slaughtered on St Bartholomew’s day in Paris. Between 1450 and 1750 about 100,000
witches were killed. The hunt intensified after 1580.
Copernicus died in 1543. He was one of the astronomers who declined an invitation to
participate in the reform of the calendar because he was convinced that it was impossible
to reconcile the discrepancies with an earth-centric approach. His heliocentric theory was
published in the year of his death. Kepler developed his laws for the movements of the
planets by the turn of the century. The telescope was invented in 1608 and Galileo was
imprisoned in 1616.
Further advances in our understanding of the number system occurred in the late eighteenth
1 The rule would say something like this: To find (6 − 4)(5 − 2), multiply the 6 by the 5, add to it 4 × 2,
subtract 4 × 5 and subtract 6 × 2—in other words the negative 4 multiplied by the negative 2 is the positive
4 by 2.
2 The Gregorian calendar is the one we use today, but it was not adopted everywhere at the same time.
Britain adopted it in 1752, Russia in 1917. Even today some religious celebrations are based on the old
Julian Calendar.
2.2. THE BASIC ARITHMETIC OPERATIONS 13
and nineteenth century. The notion of a real number was given a solid foundation, and the
now familiar correspondence between the real numbers and the points on a straight line was
established.
The introduction of numbers to young children generally reflects the historical progression—
first, whole numbers, then fractions, and then the negative numbers. You already have some
familiarity with these concepts, and so it becomes possible to follow the “logical” develop-
ment of the number system—whole numbers, then integers, then rational and irrational
numbers, based on the algebraic rules for dealing with them.
Your favourite number. Everyone has a favourite digit. You can’t have 8 because
that’s mine. The digits that are left form the magic number 12345679. Circle your
favourite digit, perhaps 1, or 2, etc. Jan circled the number 6, and Ali circled number
4. I asked Jan to multiply the magic number by 54 and I asked Ali to multiply the
magic number by 36. They both got a plentiful supply of their favourite digit. What
would you multiply by to get a supply of your favourite digit? Why does this happen?
One of the reasons that mathematicians were hesitant to accept irrationals and negative
numbers as actually being numbers was an incomplete understanding of how they operated.
One of the important things that happened in the nineteenth century was that Algebraists
distilled the rules for operating with real numbers to a very few from which all others
could be derived. This overcame the reluctance and ushered in the modern age of algebra,
for it was soon realized that the rules governing our real numbers also govern many other
mathematical structures—such things as complex numbers, vectors, and a great number of
families of functions. What this meant was that any consequences of the rules told you
things not only about the real numbers, but also about a great many other systems.
The basic rules have had a huge impact on the way mathematics is taught. In this section,
the basic rules are discussed. You will find that they are very familiar, but what might
surprise you is the fact that there are so few of them.
Addition is a binary operation because it applies to two numbers and the result is another
number. Multiplication, subtraction, and division are also binary operations. Taking the
14 CHAPTER 2. NUMBERS AND OPERATIONS
reciprocal of a number is a unary operation because it applies to exactly one number and
produces another number.
Addition and multiplication are viewed as being more fundamental than subtraction and
division because the latter two operations are usually defined as being the ones that “undo”
the former.
By using the binary operation of subtraction, we can extend the trichotomy law to pairs of
real numbers. For real numbers a and b, we define a > b to mean that a − b > 0 and define
a < b to mean that a − b < 0. So the trichotomy law implies that:
2.2.2 Closure
For binary operations, the first questions we ask are:
3. Is it associative or nonassociative?
A set of numbers is closed under a given operation if the result of applying the operation
always produces another number that is in the set.
2.2. THE BASIC ARITHMETIC OPERATIONS 15
Question 2.2.1. Given the following sets of numbers, which are closed under addition?
subtraction? multiplication? division?
(a) The set {1, 2, 4, 8, 16, . . .}. (b) The set {. . . , 81 , 14 , 12 , 1, 2, 4, 8, . . .}.
(c) The set of all integers that are multiples of 3. (d) The set of all odd numbers.
The notions of commutativity grew out of our experience with small natural numbers. If
we have five objects in our left hand and seven in our right hand and if we drop them into
an empty basket, we expect that total the number of objects in the basket will be the same
no matter which hand is used first. In other words, 5 + 7 = 7 + 5.
Similarly, our experience with small collection of objects leads to the associative law. If
we have three piles of objects—the first containing 4 things, the second 5, and the third
6—when we gather the objects into one pile we expect the total number to be the same
whether we combine (that is, associate) piles one and two first, or whether we combine piles
two and three first.
For the set of real numbers, addition and multiplication are associative; subtraction and
division are not. For example, how do you evaluate the expression 24/4/2? Division is a
binary operation, so it only applies to two numbers at a time. With 24/4/2, we seem to
have a choice: Either we first compute 24/4 and then divide that result by 2, or we first
compute 4/2 and then divide 24 by that result. The answers are different, so division is
nonassociative.
If an expression only involves addition, associativity allows us to write a + b + c + d without
causing ambiguity. The same is true for multiplication.
Note that when an expression involves two operations, associativity will not hold for the
mixture. For example, a + (b × c) and (a + b) × c are not likely to be the same.
Question 2.2.3. If you have a basket of 10 apples and remove 2 with your left hand and
4 with your right hand the result is the same as if you remove 4 with your left hand and 2
with your right hand. Doesn’t this prove that subtraction is commutative?
16 CHAPTER 2. NUMBERS AND OPERATIONS
Precedence
Whenever an arithmetic or algebraic expression is given, we would like to have an agreed
upon way of interpreting it. For example, if we are given the following,
7
+ 3 − 8 ÷ 2 × 5,
9
we would like to be able to actually carry out the computation without complaining that it
is ambiguous.
Note that it is impossible to foresee every possible combination. The way out is to restrict
what an arithmetic expression can be—expressions like 6 + 7 − ÷ + 3 or 5 + (÷3) are simply
considered as being invalid. In computing science, you would probably get a “syntax error”
message if you put either of those expressions in your program.
However, for any valid expression, the rules of precedence are well established:
Rules of precedence
When we say that multiplication and division are evaluated left to right it means that in
the absence of any parentheses, an expression like
12 · 6 ÷ 8 ÷ 3 · 5
is evaluated as
(((12 · 6) ÷ 8) ÷ 3) · 5.
A similar meaning applies to addition and subtraction.
When there are parentheses, the rules of precedence force us to begin with the innermost
ones. In the following expression:
5 − (2 − 1) × 9,
we have to evaluate what’s inside the large parentheses before we multiply by 9, that is, we
have to first evaluate 5 − (2 − 1). But the rules of precedence also apply to 5 − (2 − 1) and
this means that we have to evaluate what’s inside the inner parentheses, and so on.
A similar situation arises with respect to functions. In the expression
p
a + (4 + 4) × 8 ÷ 3 ,
2.2. THE BASIC ARITHMETIC OPERATIONS 17
the square root is a function and should be evaluated first. But the input to the square root
function should be a single number, so we have to evaluate (4 + 4) × 8 before we can apply
it.
(a) 1 + 5 · (4 − 2).
(b) 48 ÷ 4 ÷ 2 · 3 + 4 ÷ 2 − 1.
(c) 48 ÷ 4 ÷ (2 · 3) + 4 ÷ (2 − 1).
7
(d) 8÷2×5− 9 − 3.
For small natural numbers, this law is derived from experience with the meaning of addition
and multiplication. Suppose we are trying to compute 4(3 + 2). The parentheses tell us to
compute this as follows: 4(3 + 2) = 4(5) = 20.
For the natural numbers, most people think of multiplication as being repeated addition.
So another way to interpret the expression is
4(3 + 2) = (3 + 2) + (3 + 2) + (3 + 2) + (3 + 2),
and then using the commutativity and associativity properties of addition, we get
4(3 + 2) = (3 + 3 + 3 + 3) + (2 + 2 + 2 + 2)
= 4(3) + 4(2).
We cannot check all possible combinations of natural numbers, but there is no reason to
expect the distributive law to fail no matter how large the numbers are. By extension from
natural numbers to the integers, to the rationals, and finally to all real numbers, we expect
the distributive to hold there as well.
18 CHAPTER 2. NUMBERS AND OPERATIONS
Any element that leaves things unchanged when it takes part in the operation is called
an identity element.
Two elements are said to be inverses of each other if the result is the identity when the
binary operation is applied to them.
For addition, the number 0 is the identity element, and it is sometimes called the additive
identity. The numbers 5 and −5 are inverses with respect to addition in the set of integers
and are often called additive inverses of each other.
The number 1 is the multiplicative identity. In the set of rationals, 7/4 and 4/7 are
inverses with respect to multiplication and so they are said to be multiplicative inverses
of each other.
Do you know why you cannot divide by zero? It is a consequence of the fact that no matter
what a is, the product a · 0 must be zero, a fact that almost everyone takes it for granted.
If you ask them why the product is zero, you might get some curious answers. The reason
it that if we want our number system to follow its laws, we have no choice in the matter,
and here is the proof.
Now let x denote the additive inverse of a(0), and add it to both sides of the equation.
It is this theorem that tells us we cannot divide by zero. Suppose, for example, that 9 could
be divided by zero, and that the result was the number a. Since division is what undoes
multiplication, this means that a · 0 = 9. But we have just seen that for every number a, the
product a · 0 must be zero. So it doesn’t make sense to divide a nonzero number by zero.
2.2. THE BASIC ARITHMETIC OPERATIONS 19
What about 0/0? This doesn’t make sense either. If it did, then 0/0 would have to be a
specific number, say x. Then, by definition of division, 0 = 0 · x. But this is true no matter
what x is, so there is no specific number that works.
Question 2.2.6.
We say that a is greater than b (and we write a > b) if a − b is positive. (Note that ‘ > ’
is a binary relation, not a binary operation.)
The monotone law of addition: If a > b and if c is any number, then a + c > b + c.
The monotone law of multiplication: If a > b and if c > 0 then ac > bc. If c < 0
then ac < bc.
The notation a < b of course is read “a is less than b” and it means exactly the same as
b > a.
The definition of “greater than” implies that −4 > −5. Saying a is greater than b does not
mean that a is farther from 0 than b is. If you display the numbers on a horizontal number
line with the positive numbers to the right of zero, a > b means that a is to the right of b.
20 CHAPTER 2. NUMBERS AND OPERATIONS
The notations a ≥ b and a ≤ b should also be mentioned since they sometimes cause
confusion. ‘Greater than’ and ‘less than’ are binary relations. The notation a ≥ b is read a
is greater than or equal to b, and what it really means is that either a > b or a = b.
Question 2.2.7. For which of the following values of x is the statement x ≤ 5 true?
(a) x = −6, (b) x = 0, (c) x = 4, (d) x = 5, (e) x = 6.
(1) The negative sign represents the binary operation that undoes addition. We are
using this interpretation when we say that 13 − 8 is 5 because 5 is what we have to
add to 8 in order to get 13. People learn this interpretation of the negative sign before
any of the others.
(2) The negative sign is an identification tag, that is, it is used to identify the additive
inverses of the “unsigned” numbers. We are using this meaning when we say that
−8.372 is the additive inverse of 8.372.
(3) To negative sign is a unary operation that means “take the additive inverse” of the
given number. This is close to, but not exactly the same as (2) because here it applies
to all numbers. This interpretation can be also be described by saying that the minus
sign means “take the number with the opposite sign”. This is the meaning that we
are using when we say that −x is the inverse of x, where x represents any number,
positive or negative. For example, if x = −5, then −x is the additive inverse of −5,
which means that −x = 5.
It is no wonder that there is confusion! Here are some examples that may help clarify what’s
happening.
Example 2.3.1. In each of the following cases, identify how the negative signs are be-
ing interpreted, and explain why the equation is true without actually carrying out the
computation.
1. 7 − 5 = 7 + (−5).
2. 6 − (−8) = 6 + 8.
3. (−1)x = −x.
If you can follow the solutions below, you should be equally comfortable with all three
interpretations of the negative sign, and be able to use them with ease.
2.3. THOSE MYSTERIOUS NEGATIVE NUMBERS 21
Solution.
1. The negative sign in 7 − 5 is interpreted as subtraction. The negative sign in 7 + (−5)
is being used as a tag to identify the additive inverse of 5.
The objective is to show that whatever 7 − 5 is, it must be the same as 7 + (−5).
Suppose x = 7 + (−5). Begin by adding 5 to both sides of the equation:
x + 5 = (7 + (−5)) + 5.
x + 5 = 7 + ((−5) + 5) (associative law)
x+5=7+0 (5 and (−5) are additive inverses)
x+5=7 (0 is the additive identity)
x=7−5 (definition of subtraction)
7 + (−5) = 7 − 5 (definition of x)
Note: The important thing here is that we were able to conclude that the expressions
7 − 5 and 7 + (−5) were identical without actually evaluating them.
2. In 6 − (−8) the leftmost negative signs denotes subtraction, the other negative sign is
a tag to identify the additive inverse of 8.
Let x = 6 − (−8). By definition of subtraction, this means that x is the number that
must be added to −8 to get 6:
x + (−8) = 6
(x + (−8)) + 8 = 6 + 8 (Added 8 to both sides)
x + ((−8) + 8) = 6 + 8 (associative law)
x+0=6+8 (8 and (−8) are additive inverses)
x = 6 + 8. (additive identity)
6 − (−8) = 6 + 8. (definition of x)
3. Note that question 3 is really a theorem that shows us that −x can also be interpreted
as (−1)x.
In (−1)x, the negative sign is a tag to identify the additive inverse of 1. In −x the
negative sign is the unary operator that means “take the inverse of the number x”.
The quickest way to prove this is to show that x + (−1)x is always zero:
2.5 Exercises
1. Which of the following sets are closed under (i) addition, (ii) multiplication, (iii)
subtraction, (iv) division.
(a) The set of all multiples of 5.
(b) The set consisting of the single element 0.
(c) The set consisting of the single element 1.
(d) The set of all negative integers.
(e) The set of all rational numbers of the form n/3, where n is a an integer.
2. Here is one of the very earliest methods for multiplication. (This was the method
used by the ancient Egyptians, which may have been borrowed from Africans living
to the south of Egypt.) To multiply 235 by 13, carry out the following: Successively
multiply by 2 (which can be obtained by adding a number to itself):
by 1 = 235
by 2 = 470 (which is 235 + 235).
by 4 = 940 (which is 470 + 470).
by 8 = 1880 (etc.)
Then, look for the numbers on the left that sum to 13 and then the sum of the
corresponding numbers on the right will be 13 × 235. In this case, 1 + 4 + 8 = 13,
so 13 × 235 = 235 + 940 + 1880. Using the basic rules for the arithmetic operations,
explain why this works for the product 26 × 215 without actually carrying out the
computation.
2.5. EXERCISES 23
; 1 2
: a b c d ' 1 2 3 4
3 4
a d b 1 0 1 2 3
1 1 2 3 4
b d a c 2 y 1
2 D 4 6 8
c b b 3 g
3 3 6 9 C
d c b 4 z x
8 C X
A B C
If you draw a multiplication table (even with numbers missing) you will discover that
fragments A and C don’t have the proper “pattern”, and you could use that to convince
the archaeologist that neither is multiplication. It is much more difficult to see why B
also fails to have a proper “pattern”. but after a bit more work, you may be able to
discover it.
N
4. Erica has a faulty calculator. The symbol for multiplication on her calculator is .
Whenever she multiplies two integers, it always produces N an answer that is 1 larger
than it should be. For example when she calculates
N 4 5 it provides an answer of
21 instead of 20, and when she calculates
N 3 9 the result is 28 instead of 27. In
other words the operation shown as is a mathematical operation, but it is not
multiplication.
N
(a) Is commutative? Explain.
N
(b) Is associative? Explain.
5. Does multiplication distribute over subtraction?
6. Does division distribute over addition?
7. I have a calculator that displays 12 digits. Explain how I can use it to find the product
of 123456 and 246897531. I need an exact answer. (Hint: make use of the distributive
law.)
8. You have a calculator with a defective multiplication button. Since multiplication can
be performed by repeated addition, you can compute 13762 × 5 by repeatedly adding
13762 to itself (13762 + 13762 + 13762 + 13762 + 13762). You need to find 13762 × 134
Show how you can use the calculator to find the product by adding 8 numbers.
9. You have a four-function calculator with a defective multiplication button. (The
addition, subtraction, and division functions all work with high precision). Show how
to find the product of 13762 and 134 using this calculator.
24 CHAPTER 2. NUMBERS AND OPERATIONS
10. Find the quotient and remainder when the fifteen digit number 77756 33312 9099 is
divided by 1234567. Assume that you are using a calculator in which you can enter
up to 12 digits. An exact answer is required.
11. You have a two-function calculator—it can perform additions and subtractions. If you
wanted to find the remainder when 314159 is divided by 89746 you could repeatedly
subtract 89746 from 314159 until the result first became less than 89746 (It would
only take 3 subtractions). Use this calculator to find the quotient and remainder
when 314159 is divided by 2718? (It should take less than 10 subtractions).
12. (a) Using the rules of precedence outlined in this chapter, compute 7 − 2 + 4 × 5.
(b) Insert parentheses in such a manner that the computation conforms exactly to
the rules of precedence.
(c) Find all possible different values that can be obtained by using parentheses to
override the rules of precedence. Keep the numbers and signs in the same order.
Make sure that the parentheses only change the precedence and do not introduce
any extra operations. For example, inserting parentheses into 5 − 6 + 1 to get
5−(6+1) just changes the precedence while 5(−6+1) introduces a new operation.
13. Using four 4’s and only the four arithmetic operations and parentheses, make as many
of the integers from 1 to 10 as you can. For example:
44 4 4 4+4+4
= 1, + = 2, = 3.
44 4 4 4
Note: exponentiation is not allowed and all four 4’s must be used.
14. Identify the meaning of the negative signs and explain why (−5)(−4) = 20.
15. Identify the meaning of the negative signs and show that (−a)b = −(ab).
25
The locker problem. There are 1000 lockers numbered in order from 1 to 1000
along a hall. At any given point, each locker is in one of two possible states—either
its door is open or its door is closed. To begin with, all of the of the locker doors are
closed. You are given the following step by step instructions:
Your problem is to determine which lockers will be open and which will be closed.
Here is how you can try to solve the problem: Take several slips of paper, say about 20. On
one side write the numbers from 1 to 20, and on the other side do the same but circle the
numbers. A circled number will indicate that it is an open locker. Put the pieces of paper
in a row with the circled numbers down. Now follow the instructions (you change the state
by turning the slip of paper over). Can you make an educated guess about which lockers
are open? Can you explain why your guess is correct?
A vertical bar is used to denote divisibility: d | a is read “d divides a”. That’s a vertical
bar, not a forward (/) or backward (\) slash, and take note of the order: if you want to
state that 7 divides 21, you write “ 7 | 21 ” not “ 21 | 7 ”. When a does not divide b, we
write a6 | b.
Note that if d divides n then so does −d. For example, the divisors of 6 are ±1, ±2, ±3, ±6.
However, in many cases we are only interested in the positive divisors.
Question 3.1.1. Write down all the positive divisors of the integers 8 through 15. Which
of these integers has the greatest number of positive divisors?
When you are trying to list all positive divisors of a number n, keep in mind that if d is
a divisor, then so is n/d. You can cut your work significantly by using this. For example,
with 24, as soon as we discover that 3 is a divisor we also know that 8 is also a divisor.
In general, when trying to find all positive divisors
√ of an integer n, you only need to check
those integers that are less than or equal to n as Theorem 3.1.4 shows.
√
Theorem 3.1.4. Every √ positive divisor of n that is greater than n must be paired with
one that is less than n.
Proof. To prove this, all you need to know is that when you multiply an inequality by a
positive quantity, it keeps the
√ sense of the inequality. Here’s how the proof
√ goes. Suppose
d is a divisor of n with d > n. Multiply both sides of the inequality by n/d:
√ √
n √ n
d· > n· .
d d
√ n
Then carry out the multiplication to get n> .
d
Example 3.1.5. Find all divisors of 1092.
√
Solution. Since 1092 < 34, we need only test the integers from 1 to 33. Here are the
divisors, paired as indicated:
d= 1 2 3 4 6 7 12 13 14 21 26 28
1092/d = 1092 546 364 273 182 156 91 84 78 52 42 39
3.2. DIVISIBILITY 27
3.2 Divisibility
Theorem 3.2.1 (Basic properties of divisibility).
1. If d | b and b | c then d | c. (This is also phrased by saying that divisibility is transi-
tive.)
2. If d | b then d | nb for any integer n.
3. If a = b + c, and if d divides any two of a, b, and c, then d also divides the third one.
a = nd − md = (n − m)d.
Question 3.2.2. Use the basic properties of divisibility to explain the following.
Recall that cancellation law states that if a 6= 0 and ax = ay, then x = y. This is useful
when dealing with divisibility.
Example 3.2.4. Given that a, b and c are three positive integers, and that the integer x
is larger than 1 and is divisor of abc + 1, explain why x must be different than a, b, or c.
Solution. Let y = abc + 1. We are told that x | y. If x were one of a, b, or c, then x | abc.
Since y = abc + 1, it would now follow from statement 3 of Theorem 3.2.1 that x | 1. But
this cannot be, because x > 1.
28 CHAPTER 3. INTRODUCTION TO NUMBER THEORY
Example 3.2.5. I am thinking of two different single digit numbers. Neither is divisible
by 8, but both their sum and difference are. What are the digits.
Solution. Let the numbers be x and y. We are told that x + y and x − y are divisible by
8. So when we add and subtract x + y and x − y, then the results (2x and 2y) must also
be divisible by 8. So x and y must be divisible by 4. Since x is divisible by 4, the only
possibilities for x are −8, −4, 0, 4, 8. Since x is not divisible by 8, this rules out −8, 0, and
8. So x is either 4, or −4, and since y is not the same as x, it follows that the two numbers
are 4 and −4.
Remainders
In Number Theory, the remainder is usually far more important than the quotient. However,
we have to be a little careful with the meaning of the word “remainder”. Given integers a
and d, with d > 0, there are infinitely many values of q and r for which a = q · d + r. For
example, here are several possible values of q and r that satisfy 26 = q · 7 + r:
q = 1 , r = 19 that is 26 = 1 · 7 + 19
q = 2 , r = 12 26 = 2 · 7 + 12
q = 3, r = 5 26 = 3 · 7 + 5
q = 4 , r = −2 26 = 4 · 7 − 2
q = 5 , r = −9 26 = 5 · 7 − 9
Although each of the above statements is true, only the the third one yields the correct
quotient and remainder when 26 is divided by 7.
1 A little unfortunate—in mathematics there are two different meanings for the word divisor. We will use
it primarily in the former sense as on page 25. The context will make it clear.
3.2. DIVISIBILITY 29
There is a theorem that tells us that r is always smaller than the divisor d.
Theorem 3.2.6 (The Division Algorithm). If a and d are integers and d > 0, then
there are unique integers q and r such that a = qd + r, with 0 ≤ r < d.
We have to be careful when the integer a is negative. For example, when 27 is divided by 4
the remainder is 3. When −27 is divided by 4 the remainder is 1, not −3. The reason for
the last statement is that the remainder has to be nonnegative.
Example 3.2.7. Find the quotient and remainder when −54 is divided by 7.
Solution. We are looking for r so that −54 = q · 7 + r. If we use a calculator, we get
−54/7 = −7.714. . . . A common error is to conclude that q = −7, but this would lead to
a negative remainder, which is not allowed—remember that a remainder is defined to be
nonnegative. The quotient in this case is actually −8. Here’s the comparison between the
two values for q:
Given integers a and b, any integer d that divides both a and b is called a common
divisor of a and b. The largest of all common divisors is called the greatest common
divisor of a and b, and is denoted gcd(a, b).
There are several ways to find the greatest common divisor of two integers. For now, we
will use the most obvious one, which is to simply list the divisors of both numbers and by
comparison find the greatest common one.
Example 3.2.8. To prepare a classroom display, Ms. Jesse wants to cut a piece of red
poster board into equal sized squares without any material left over. The poster board is
242 cm by 110 cm. What are the largest squares that she can cut?
Solution. If the squares were d cm along each side, then to avoid any waste, d would have
to divide 242 and 110. So what we are looking for is the largest number that divides both
242 and 110, that is, we want to find gcd(242, 111).
30 CHAPTER 3. INTRODUCTION TO NUMBER THEORY
Question 3.2.9.
(a) What is gcd(0, 4)?
(b) What is gcd(21, −14)?
(c) What can you deduce about a and b if gcd(a, b) = b?
The next theorem tells us that we can always reach gcd(a, b) no matter what a and b are.
Theorem 3.2.10 (The Linear Divisibility Theorem). Given positive integers a and b,
the smallest positive value of ax + by is d where d is the greatest common divisor of a and
b.
The proof is in appendix A — It is not constructive, which means that it does not tells you
how find x and y. That is the subject of the chapter on Linear Diophantine Equations. At
this point, all we need to know is that there is a solution.
Proof. By Theorem 3.2.10, there is some value of x and y such that ax + by = gcd(a, b). By
the basic properties of divisibility every divisor of a and b also divides ax + by.
Proof. By Theorem 3.2.10, there are integers x and y such that dx + ay = 1. If we multiply
the equation by b we get dbx + aby = b. Now d | dx and d | aby, so by the basic properties of
divisibility, d must also divide b.
c = 4a = 4(9b) = 36b,
showing that 36 | c.
Is 123456789012345 divisible by 7? Even with a calculator it looks like this is going to take
some work. There is a test for divisibility by 7 that will enable you to use your calculator
to answer this question fairly rapidly.
Divisibility by 2, 4, 8, etc:
An integer is divisible by 2 iff its last digit is divisible by 2.
An integer is divisible by 4 iff the number formed by its last two digits is divisible by 4.
An integer is divisible by 8 iff the number formed by its last three digits is divisible by 8.
Examples.
145764 is divisible by 4 because 64 is divisible by 4.
145794 is not divisible by 4 because 94 is not divisible by 4.
21824 is divisible by 8 because 824 is divisible by 8.
555668 is not divisible by 8 because 668 is not divisible by 8
Divisibility by 3 and 9:
An integer is divisible by 3 or by 9 iff the sum of its digits is divisible by 3 or by 9 respectively.
Example. Test 123456654321 for divisibility by 3.
Solution. 1 + 2 + 3 + 4 + 5 + 6 + 6 + 5 + 4 + 3 + 2 + 1 = 42, so the original number is divisible
by 3 iff 42 is divisible by 3. Now, 4 + 2 = 6 which is divisible by 3 so 42 is divisible by 3, so
123456654321 is divisible by 3.
Divisibility by 11:
An integer is divisible by 11 iff the alternating sum of its digits is divisible by 11.
Example. Test 123456 and 7719822 for divisibility by 11.
Solution. For 123456 the alternating sum is 1 − 2 + 3 − 4 + 5 − 6 = −3. Since −3 is not
divisible by 11, it follows that 123456 is not divisible by 11.
3.3. TESTS FOR DIVISIBILITY 33
Remark: Note that it doesn’t matter whether we start with a negative or a positive digit.
That is, to test 123456 we could use either 1 − 2 + 3 − 4 + 5 − 6 or −1 + 2 − 3 + 4 − 5 + 6,
because one sum is just the negative of the other.
Partition the integer into groups of 3 beginning at the right (that is, where the commas
would appear). Alternately add and subtract these groups. The result is divisible by 7 (or
11, or 13) iff the original number is divisible by 7 (or 11, or 13).
Proofs.
There are several special cases on which the proofs are based.
The first special case says that 2n always divides 10n , so 2|10, 4|100 8|1000, and so on. The
reason for this is clear: 10n = (2 · 5)n = 2n · 5n , so by definition, 2n | 10n .
Proof of the divisibility test for 5 and 10, and for 2, 4, 8, etc. In each of these cases,
the proof uses a similar idea. For example, to verify that the test for divisibility by 4 works,
observe that a number uvwxyz (where u, v, etc. are the digits of the number) is the same
as uvwx00 + yz. Now uvwx00 = (uvwx) · (100) which is divisible by 4. Hence, 4 | uvwxyz
if and only if 4 | yz.
34 CHAPTER 3. INTRODUCTION TO NUMBER THEORY
Proof of the divisibility tests for 3 and 9. The proofs for 3 and 9 are the same. To
verify the test for 3, let us suppose that the number is wxyz. This is the number
1000w + 100x + 10y + z.
Rewrite this as
(999w + w) + (99x + x) + (9y + y) + z.
Rearrange it as follows:
(999w + 99x + 9y) + (w + x + y + z).
The number in the first set of parentheses is always divisible by 3. So the entire number is
divisible by 3 if and only if (w + x + y + z) is divisible by 3.
Proof of the divisibility tests for 6 and 12. The proofs of these follow from Theorem
3.2.13.
Proof of the divisibility tests for 11. There are certain numbers that are easily seen to
be divisible by 11:
The integers composed of an even number of 9’s are divisible by 11. This is easy to check:
99 = 11 · 9
99 99 = 11 · 909
99 99 99 = 11 · 90909
99 99 99 99 = 11 · 9090909, etc.
There is also another useful set of numbers that are divisible by 11, namely the integers
1 00 1, 1 00 00 1, 1 00 00 00 1, etc. These are the numbers that begin and end with the
digit 1 with an even number of zeros between the two 1’s
This is also easy to check:
1 00 1 = 990 + 11
1 00 00 1 = 99990 + 11
1 00 00 00 1 = 9999990 + 11
1 00 00 00 00 1 = 999999990 + 11, etc.
To check the test for 11, let us suppose that the number is uvwxyz. Write this as
100000u + 10000v + 1000w + 100x + 10y + z.
Rewrite this as
(100001u − u) + (9999v + v) + (1001w − w) + (99x + x) + (11y − y) + z.
3.3. TESTS FOR DIVISIBILITY 35
Now each of the numbers 100001, 9999, 1001, 99, and 11 is divisible by 11, so the number
(100001u + 9999v + 1001w + 99x + 11y) is divisible by 11. Consequently, the entire number
is divisible by 11 if, and only if (−u + v − w + x − y + z) is divisible by 11.
Proof of the divisibility tests for 7, 11, and 13. The proof for this resembles the proof
for the divisibility test for 11. Let’s consider the integer ab,cde,f gh,ijk, where the letters
are the digits of the integer. We want to show that this is divisible by 7, 11, or 13 if and
only if (−ab + cde − f gh + ijk) is divisible by 7, 11, or 13 respectively.
As we learned from the 1001 card trick, the integer 1001 is the product of 7, 11, and 13. We
begin by observing that the numbers 999,999, 1,000,000,001, and so on are all divisible
by 1001. The table explains why:
1,001 obviously
999,999 because 999,999 = 1,001,000 − 1,001
1,000,000,001 because 1,000,000,001 = 999,999,000 + 1,001
999,999,999,999 because 999,999,999,999 = 1,000,000,001,000 − 1,001
Except for the number 1,001, each number on the left is obtained by multiplying the one
above it by 1000 and adding or subtracting 1001. This means that the numbers in question
are all divisible by 1001.
Now let’s get back to the integer ab,cde,f gh,ijk. Write this as
Rewrite this as
Rearrange to get
3.5 Exercises
1. Which of the following statements are true?
(a) 3 | 6, (b) 1 | 5, (c) 6 | 3, (d) 2 | 0, (e)0 | 2.
6. Classify each of the following as true or false, and if the statement is false, give an
example showing it is false or explain why it is false.
(a) If positive integer is divisible by a and by b, then it must be divisible by a · b.
(b) If a number is divisible by 8, then it is also divisible by 4.
3.5. EXERCISES 37
7. List all divisors of x and y, circle the common divisors, and find the gcd(x, y).
(a) x = 108, y = 144. (b) x = 132, y = 0. (c) x = 17, y = 38.
8. When asked to check whether 28 divides 14 · x, a student says yes it does and gives
the following reason: 28 = 2 · 14 and since both 2 and 14 divide 14 · x, then 28 must
also divide 14 · x. What is wrong with the reasoning?
9. Use the Linear Divisibility Theorem to show that if gcd(p, q) = d, then p/d and q/d
are relatively prime.
10. (a) When a certain positive integer is divided by 6, my calculator showed that the
part to the right of the decimal point was .666667. What is the actual remainder?
(b) When I divided a certain negative number by 7, my calculator gave the answer
as −xxxxx.28571429, where the x’s represent other digits (not necessarily all the
same). What is the actual remainder?
11. Use the divisibility test for 3 to determine what possible values of x would make
1234x51234 divisible by 3.
12. (From Boris Kordemsky’s The Moscow puzzles) Find the integer t and the digit a
which makes the following equation valid:
2
3(230 + t) = 492a04.
15. Take any two digit number, say ab. Repeat the digits four times, producing the
number abababab. Divide this number by 137. Divide that result by 101. Divide that
result by your original number. What’s the answer? Explain.
39
Example 4.1.1. Write 252 as the product of three integers all greater than 1.
The usual way to find such an answer is to first factor 252 into the product of two integers
and then factor one of the two integers. For example,
252 = 4 · 63 and 63 = 7 · 9, so 252 = 4 · 7 · 9 .
Sometimes we have to continue the process, obtaining more than three factors:
252 = (4)(63) = (2 · 2)(7 · 9) = (2 · 2)(7 · 3 · 3) = 2 · 2 · 7 · 3 · 3 .
40 CHAPTER 4. COMMON MULTIPLES AND DIVISORS
We can go no farther. The numbers 2, 3, and 7 do not yield any more factors. Such numbers
are called prime numbers.
The number 3 has two divisors: 3 and 1, so 3 is a prime. The number 4 has three divisors:
1, 2, and 4, so 4 is a composite number prime. What about the number 1? The definition
excludes the number 1 as being either a prime or composite number because the number 1
has only one divisor.
When we write a number as the product of its prime factors, the result is called the prime
factorization of the number. If you use two different methods to find the prime factorization,
the result will always be same, except for the order of the primes. For example, we could
have taken a different road to find the prime factorization of 252:
The usual practice is to arrange the factors in ascending order, raising any repeated primes
to the appropriate power:
252 = 22 · 32 · 7 .
126 = (2)(9)(7) = 2 · 32 · 7.
Part (b) of Example 4.1.4 illustrates the simplest test to see whether a positive√ integer n
is a prime: If n is not prime, it will have a prime
√ factor less than or equal to n. So try
divding n by the primes less than or equal to n. Although the test is simple, it loses it
appeal when n is a very large number.
Suppose we want to find all the primes up to 200. Make a list of all the integers from 1 to
200. The sieve of Eratosthenes is a method that filters out all the non-prime numbers and
leaves only the primes.
2. Circle the smallest number that has not been crossed-out and then cross out all other
multiples of that number. In this case, the circled number is 2 and all other multiples
2 are crossed-out. The crossed out numbers cannot be primes.
3. Circle the smallest number that is not crossed out. (It is a 3.) Now cross out all other
multiples of that number. The newly crossed out numbers cannot be primes.
4. Circle the smallest remaining number that is not crossed out. Then cross out all other
multiples of that number. The newly crossed out numbers will not be prime.
Keep doing this until all numbers are either circled or crossed out. The circled numbers
are the primes, the crossed-out numbers are the composite numbers (except for the
number 1).
You will best understand this if you actually carry it out. The first part of your list should
look like this, where the numbers are boxed rather than circled:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
If you actually carried out this procedure on the numbers from 1 to 200 you will have noticed
that after you circled the prime number 13, you did not cross out any new numbers. The
reason for this is that the first multiple of any prime p that is not already crossed out (other
than p itself) is p2 . We explain this using the prime number 7:
The multiples of 7 that are less than 72 are:
2 · 7, 3 · 7, 4 · 7, 5 · 7, 6· 7.
But, these have already been crossed out for the following reasons:
2 · 7, because all multiples of 2 have been crossed out;
3 · 7, because all multiples of 3 have been crossed out;
4 · 7, because all multiples of 4 are multiples of 2 and have been crossed out;
5 · 7, because all multiples of 5 have been crossed out;
6 · 7, because all multiples of 6 are multiples of 2 and have been crossed out.
In general, by the time you are ready to circle prime p, the multiples 2p, 3p, 4p, . . . , (p−1)p
have already been crossed out.
4.2. FINDING THE GCD 43
Proof. Let p be any prime number. We will show that there is a prime larger than p, which
means that there is no largest prime. Take the product of all the primes up to p and add 1,
to form the number
n = 2 · 3 · 5 · 7 · · · p + 1. (4.1)
Then, n cannot be divisible by any prime q less than or equal to p. Suppose, for a contradic-
tion, that this were the case. Then since q is one of the primes 2, . . . , p, it would follow that
in equation (4.1), q divides both n and the product 2 · 3 · 5 · 7 · · · p. By the basic properties
of divisibilty q would have to divide 1, which is clearly impossible.
Since n is not divisible by any of the primes from 2 to p, it follows that n is either a prime
or else is a composite number with prime factors that are larger than p. In either case, we
have shown that there is a prime larger than p.
242 = 2 · 112
110 = 2 · 5 · 11
The greatest common divisor is the product of the lowest power of the prime factors that
appear in both factorizations. In this case, the primes 2 and 11 are the only ones that
appear in both. The lowest power of 2 that occurs in both is 21 . The lowest power of 11 is
111 . So gcd(242, 110) = 2 · 11 = 22.
44 CHAPTER 4. COMMON MULTIPLES AND DIVISORS
Here is why this method works: If d is any divisor of both 242 and 110, then any prime
factor p of d must also be a prime factor of both 242 and 110. So p must be either 2 or 11.
This means that the prime factorization of d only contains 2’s and 11’s, so must be of the
form 2x · 11y .
Since 2x divides both 2 · 112 and 2 · 5 · 11, then the maximum value of x is 1. Similarly, the
maximum value of y is 1, so the gcd is 21 · 111 .
Here is another example using the prime factorization method, with the solution expressed
in a slightly more systematic way.
Solution. The primes involved are: 2, 3, 7, 13, and 23. So the greatest common divisor will
be an integer of the form
2a · 3b · 7c · 13d · 23e .
where a, b, c. etc., are the smallest of the powers in each number.
The value of a is the smaller of 3 and 0, so 2a = 20 .
The value of b is the smaller of 0 and 2, so 3b = 30 .
The value of c is the smaller of 2 and 3, so 7c = 72 .
The value of d is the smaller of 3 and 4, so 13d = 133 .
The value of e is the smaller of 2 and 1, so 23e = 231 .
Consequently, gcd(a, b) = 20 · 30 · 72 · 133 · 231 .
Since 20 and 30 are both 1, and since 231 = 23,we write this as gcd(a, b) = 72 · 133 · 23.
Warning: To use the prime factorization method, the numbers must be factored into
powers of primes. For example, 122 · 132 has not been factored into primes, because 12 is
not a prime number.
Lemma 4.3.1 (The Euclidean Lemma). If a, b, q and r are positive integers with
a = bq + r , (4.2)
then gcd(a, b) = gcd(b, r).
It may be easier to comprehend when actual numbers are used: Consider the following
equation:
78 = 30 · 2 + 18.
The Euclidean lemma tells us that gcd(78, 30) = gcd(30, 18).
Proof of the Euclidean Lemma. Suppose that d divides a and b. Then d divides both a
and bq in equation (4.2). Then d must also divide r. On the other hand, if d divides b
and r, then in equation (4.2) d divides bq and r, and so divides a. It now follows that
gcd(a, b) = gcd(b, r).
The next example shows that the Euclidean Algorithm works well for larger numbers.
Solution.
A problem of tarts. The bakery shop had prepared 16 dozen tarts, but before
they could be put on the display shelf, a few were sold. When the baker tried to
arrange them in rows of four, there were two left over. He tried placing them in rows
of five, but again there were two left over. Then he tried six and still there were two
left over. Finally, when he tried putting them in rows of seven, none were left over.
How many tarts were sold?
The solution to this depends upon the notion of common multiples. Common multiples live
in partnership with common divisors, and in fact common multiples are probably used more
frequently.
Given integer a and b, any integer that is a multiple of both a and b is called a common
multiple of a and b. The least common multiple which is defined to be the smallest
positive common multiple, is denoted by lcm(a, b).
Two positive integers have only a finite number of common divisors, but they have infinitely
many common multiples. One way to find the greatest common divisor is to examine all
4.4. LEAST COMMON MULTIPLES 47
divisors of both a and b. You cannot use exactly the same strategy to find the lcm(a, b).
However, since the least common multiple cannot be greater than ab, you only need to list
common multiples up to ab. A more reasonable approach is to proceed as follows: consider
the positive multiples of a one by one, and at each stage test whether the multiple is divisible
by b.
Question 4.4.2. Is there a similar strategy to increase the efficiency of the list method for
finding the gcd?
Question 4.4.3.
(a) What can you say about a and b if lcm(a, b) = b?
(b) What is lcm(−21, 7)?
(c) Why can’t we specify what lcm(0, 4) is?
Then take the highest power of each prime that appears. In this case, the primes involved
are 2, 3, 5, and 7. The highest powers of each are: 22 , 3, 52 and 73 . The lowest common
multiple is the product of these:
lcm(6860, 150) = 22 · 3 · 52 · 73 = 102900,
The reason this works is as follows: The result, 22 · 3 · 52 · 73 , is a multiple of the two numbers
because it is divisible by every prime power of both integers. It is easy to understand why
there is no smaller common multiple: the prime factorization of any multiple cannot contain
a power of 2 that is less than 22 , and the same reasoning applies to all other prime factors.
6860 = 22 · 5 · 73
150 = 2 · 3 · 52 .
Note that if we use the factorization method to find the gcd, we take the lowest powers of
each prime. So in the above, we would select the unboxed prime powers. Together, the gcd
and lcm contain all of the factors of both 6860 and 150. This means that
lcm(6860, 150) · gcd(6860, 150) = 6860 · 150.
In general, if a and b are two positive integers, we always have the following relationship:
Theorem 4.4.5.
ab
lcm(a, b) · gcd(a, b) = ab, or, equivalently lcm(a, b) = .
gcd(a, b)
When using this method to find the lcm, you can find the gcd in any manner that you want.
92·172 92·172
Solution. We find gcd(92, 172) = 4, so lcm(92, 172) = gcd(92,172) = 4 = 3956 .
4.5. WHEN THERE ARE THREE OR MORE INTEGERS 49
If there were d bags, then d | 260, d | 195, and d | 234, so we are looking for gcd(260, 195, 234).
A little experimentation will lead you to the answer. The objective here is to find a system-
atic way of finding the greatest common divisor of three or more integers, and to understand
why it works.
Proof. If the positive integer d divides e, then it divides b and c, and so if d divides a and
e it must be a common divisor of a, b, and c. On the other hand, if d is a common divisor
of a, b, and c, then by the Common Divisor Theorem it certainly divides e = gcd(b, c), and
so is a common divisor of a and e.
It follows that the greatest common divisor of a, b, and c is the same as the greatest common
divisor of a and e.
This tells us how to solve the candy factory question and others like it.
Solution to the candy factory problem. Recall that we are trying to find gcd(260, 195, 234).
Now, gcd(195, 234) = 39 (by whatever method you use). So, by the theorem,
So it is possible to make 13 bags. In each bag there will be 20 (= 260/13) yellow beans,
15 (= 195/13) red beans, and 18 black beans.
Similar results hold for least common multiples, and we state them without proof.
Theorem 4.5.3.
Example 4.5.4.
Solution.
1. lcm(4, 5, 6, 9) = lcm(lcm(4, 5), lcm(6, 9)) = lcm(20, 18) = 180.
2. 4 = 22 , 5 = 5, 6 = 2 · 3, 9 = 32 , so lcm(4, 5, 6, 8) = 22 · 32 · 5 = 180.
4.7 Exercises
1. Find the prime factorizations of the following numbers.
(a) 5040 (b) 299 (c) 33000
(d) 499 (e) 123123 (f) 8437
2. Use the sieve of Eratosthenes to find all the primes up to 200. (It serves somewhat as
a visual check if you put the integers in rows that contain a multiple of 6 elements.)
3. Alice is using the sieve of Eratosthenes to find all primes up to 500. She has eliminated
all multiples of 2, 3, 5, 7, 11, 13, 17, and 19. The next lowest number that has not
been eliminated is 23. Does she have to continue eliminating numbers, or has she
already found all of the primes below 500? Explain.
4. Gerry is trying to factor the number 704791. By testing all primes in succession, she
has found that the smallest prime that divides 704791 is 89. The square root of 704791
is approximately 839.5, so at first she thinks that she still has a way to go. Then she
realized that she didn’t need to go any farther, and she was correct. Why?
5. People sometimes argue that the number n provided by equation (4.1) must always
be a prime number. Show that this is not the case by finding a prime factor of
2 · 3 · 5 · 7 · 11 · 13 · 17 + 1.
6. (From Brain Bolt’s Mathematical Funfair ). A computer programmer worked the prod-
uct of her age in years, the age of her cat in years, and the number of her house. Given
that the product was 17654, how old was she?
7. Find the greatest common divisor of 564 and 180.
4.7. EXERCISES 51
10. There are three ways of finding the greatest common divisor of two positive integers,
namely, by
(a) listing the divisors of each number
(b) finding the prime factorization of both numbers,
(c) the Euclidean Algorithm.
Show how each of these can be used to find gcd(92, 36)
11. Find the gcd and lcm of (17)2 · (18)3 · (19)4 and (15)3 · (16)2 · (17)3 by using prime
factorizations.
14. Jen claims that in order to find all common divisors of a and b, she just needs to find
all the divisors of gcd(a, b). Explain why she is correct.
15. We know that gcd(a, b) · lcm(a, b) = a · b. Is it also true that gcd(a, b, c) · lcm(a, b, c) =
a · b · c? Explain why or give a counter-example.
17. The sailors from two navy vessels are to be combined to march in a military tattoo.
The smaller unit, which has 408 sailors, will be at the front. The larger, which has
578 sailors, will follow right behind. The two units must have the same number of
columns. What is the greatest number of columns that they can have?
18. (from Martin Gardner’s Aha! Insight. Originally from a Hindu arithmetic book of
the seventh century) A lady is carrying a basket of eggs. She drops the basket and
all the eggs break. When asked how many eggs she had, she says that she is poor in
arithmetic but remembers that when she counted the eggs by twos, threes, fours and
fives she had remainders of 1, 2, 3, and 4 respectively. What’s the smallest number of
eggs that she could have had in the basket?
52 CHAPTER 4. COMMON MULTIPLES AND DIVISORS
19. Pat pressed a button that started two bells ringing. The first bell rings for 4 seconds
at the beginning of every 36 minutes and the second rings for four seconds at the
beginning of every 40 minutes. Pat pressed the button at midnight and both bells
rang together.
(a) When was the next time that both bells rang together?
(b) If this continues forever, what is the shortest possible time between the beginning
of two consecutive rings? Explain.
20. First, 40 pupils are separated into teams, with each team having the same number of
pupils. Later, 24 more pupils are distributed equally to the teams, with no one left
over. What is the greatest number of teams possible?
21. An elementary art teacher has 3 art classes with 21, 35, and 28 students, respectively.
The teacher wants to order some equipment that can be used by equal-sized groups
in each class. What is the largest number of students in a group in each class so that
each group has the same number of students?
22. Jane is planning a party at which she expects 16, 24, or 12 guests. Because she is
unsure of the number of guests but wants to have available an equal number of hors
d’oeuvres for each guest with none left over, how many should she order?
23. Before checking with the caterer, a cook cuts a cake into 35 equal pieces and an
identical cake into 42 equal pieces. The caterer, however, insists that the cakes be cut
exactly alike, that is, the caterer wants each piece to have the same volume. Into how
many pieces must each cake now be cut?
53
5.1 Fractions
The set of positive integers is closed under multiplication but not under division. The
inclusion of the positive fractions solves the problem. Despite this bit of serendipity, it is
not the reason fractions were introduced—as mentioned in Chapter 2 they were introduced
to enable people to measure things like weight and area. Fractions were not called numbers;
instead, they were magnitudes, and before the middle of the sixteenth century number and
magnitude were considered to be different. The word number invariably meant what we
mean now by “positive integer”. The rest of the (positive) numbers were called magnitudes.
The distinction was based on the anticipation of what each would be used for: numbers were
for discrete “indivisible” things, magnitudes were for measuring “continuous” quantities.
The word “fraction” is related to “fracture”, meaning to break apart, and that is close to
original meaning of “fraction”. Colloquially, here is what a fraction is:
Suppose p and q are positive integers. To get the fraction p/q, take an object
and divide it into q equal parts, and then take p of those parts.
The notation p/q can cause confusion when fractions are first introduced. Just as the
negative sign has different meanings, so does the division line. Before, the division symbol
represented a binary operation: 8/6 meant divide 8 by 6. Now the division symbol seems
to mean something different.
The notation makes sense as soon as you consider concrete examples. If you divide a cake
into 5 equal pieces, the combined measure of two of those pieces is denoted 2/5. The
combined measure of ten pieces is denoted 10/5, and 10 pieces is the same as 2 cakes. The
fraction 8/5 the same as 1 cake plus 3 additional pieces. That is also what you get when
you divide 8 by 5, so it really does make sense to use the division line when representing
fractions.
Today we use the words “rational number” instead of “fraction”, and the rational numbers
include negative fractions as well as the positive ones. Here is the formal definition.
A rational number is one that can be expressed in the fractional form p/q where p and
q are integers and q is nonzero. Then integer p is called the numerator and q is called
the denominator.
The word “rational” is to remind us that a rational number is the “ratio” of two integers.
Although it is possible to develop the properties of rational numbers directly from the
54 CHAPTER 5. FRACTIONS, DECIMALS, AND PERCENTAGES
definition, it is better to stick closer to the historical perspective. The definition of rational
numbers occurred many years after they had been in use. It is a goal to be achieved, not a
starting point.
The second statement provides the basis for several properties of rational numbers. For
example, it implies that
a c
= if and only if ad = bc.
b d
To see why, we note that
a ad c bc
= and = ,
b bd d bd
and therefore the two rationals are equal if and only if ad = bc.
−a a
Another consequence is that = . This can be checked by noting that
b −b
−a −1 · (−a) a
= = .
b −1 · b −b
−a a
It will also turn out that = − but before we can justify that statement we need to
b b
know more about the arithmetic operations on rationals
5.1. FRACTIONS 55
Multiplication
This is the easiest of the operations to learn. If you have, say, 4/7 of a cake, and you take
2/3 of it, then how much cake do you have? To do this pictorially, divide the 4/7 into three
equal pieces and take two of them. Each of the 1/7 pieces is divided into three equal parts,
and each of these parts is then 1/21 of the cake. Here’s what we get:
4/7
Question 5.1.1.
Division
Dividing by a number is the same as multiplying by the inverse of that number.
c a c a d
If 6= 0, then = × .
d b d b c
56 CHAPTER 5. FRACTIONS, DECIMALS, AND PERCENTAGES
To explain division of rationals, use the fact that division is the operation that undies
multiplication. So when trying to divide 3/4 by 2/5 we ask what do we have to multiply
a
2/5 by in order to get 3/4 ? If we let be the rational number we are looking for, we would
b
have
a 2 3
· = .
b 5 4
5
We can solve this by multiplying both sides of the equation by , and we get
2
a 2 5 3 5
· = ·
b 5 2 4 2
a 2 5 3 5
· = ·
b 5 2 4 2
a 3 5
= · .
b 4 2
a c ad + bc a c ad − bc
+ = − = .
b d bd b d bd
−a a a
The first statement implies what we said earlier, namely that = − . The notation −
b b b
a −a a
denotes the additive inverse of , so all we have to do is check that + = 0, and this
b b b
follows from the first statement above.
We use the idea in the second statement when comparing rational numbers, that is, we bring
things to a common denominator.
5.2. DECIMALS 57
Note that the preceding comparison test may fail if the rationals are not positive: For
a 5 c −6 a c
example if = and = , then ad = 35 and bc = 42, but > .
b −7 d 7 b d
5 −6
Question 5.1.3. Explain why >
−7 7
5.2 Decimals
Decimal numbers were introduced by Simon Stevin towards the end of the sixteenth century.
The current notation, where a period is used to separate the integer and fractional parts,
was devised by John Napier at the beginning of the seventeenth century. The notation was
rapidly adopted, and it provides a clear picture of the relative sizes of numbers.
1 7 8 9
46.1789 = 46 + + + + .
10 100 1000 10000
However, by bringing everything to the common denominator 10000 we end up with what
we had before
The advantage of the more complicated expression is that it enables us to define what we
mean by an number with an infinite number of digits after the decimal point.
But it is also true that when we replace the 6 by a 7 no matter what we substitute for the
dn ’s
0.129847347 > 0.129847346d1d2 d3 d4 d5 . . . .
So, no matter what we use for the dn ’s, the number is somewhere between 0.129847346 and
0.129847347. To put it another way, adding those extra digits will not increase the number
by more than 0.000000001.
Suppose we had an infinite decimal number. Using the same reasoning, if we approximate
it by truncating it after its first 10 decimals, then the rest of the decimals can’t increase
the approximation by more than 1/1010. If we use the first 100 decimals, then the rest of
the decimals can’t increase the approximation by more than 1/10100. And so on. Adding
more and more decimals just makes the approximation more and more accurate. So it is
reasonable to believe that an infinite decimal actually does represent a number. We no
longer try to prove this, but now accept it as an axiom.
By using the fact that you get better and better approximations as you take more and
more decimal places, you can effectively deal with infinite decimals. For example to find
12 × 0.412412412 . . . where the block of digits repeats forever, you get better and better
5.2. DECIMALS 59
approximations by computing
12 × 0.412 = 4.944
12 × 0.412412 = 4.948944
12 × 0.412412412 = 4.948948944
and it is pretty clear that the answer is 4.948948948 . . ., where the 948 block repeats forever.
If an infinite decimal has a repeating block of digits, indicate the repeating block by putting
a bar over it: 0.412 and 4.948. So the approximations that we carried out show that
12 × 0.412 = 4.948.
Note: The example above used an infinite decimal with a repeating block of digits. It is
not the case that all infinite decimals have a repeating block like this—we will see in the
next two sections that any decimal that ends in a block of digits that endlessly repeats must
actually be a rational number.
Question 5.2.1.
(a) How many decimal places should you keep if you want an infinite decimal number
to be approximate to within 0.00001? (Consider the number as being truncated, not
rounded.)
(b) If two numbers with infinite decimal expansions are truncated after the third decimal
place, what can you tell about the accuracy of the decimal digits when the two numbers
are multiplied? (Try some examples!)
The next example is related to a “debate” that appears with astonishing regularity. The
debate is about whether there is any difference between the number 1 and the number
0.99999 . . . , where the 9’s repeat forever. Once you accept the axiom that every infinite
decimal expansion represents a number, there is really no debate.
At this point where we have taken an approximation that uses ten 9’s, we see that the dif-
ference between 1 and the approximation is 1/1010. This means that the difference between
1 and 0.9 is also less than 1/1010. If we used one thousand nines in the approximation,
the difference would be 1/101000 . If we used a google 9’s, the difference would be 1/10google
and that’s quite a small number1 . The point is, that if we agree that 0.9 is a number, then
it differs from the number 1.0 by some nonnegative number that is less than any positive
number we can think of. But the only such number is the number 0. So the difference
between 1.0 and 0.9 is 0, and the two numbers must be the same.
.4318
1.72 (b) 44 19.00000
(a) 25 43.00 17 6
25
14 0
18 0 13 2
17 5
80 (∗)
50 44
50
360
0 352
8 (∗∗)
You can verify that 43/25 = 1.72 by multiplying both sides of the equation by 25. In
example (b), the remainder of 8 appears in line (∗) and then reappears in line (∗∗). Once
a remainder reappears, the digits start repeating. So 19/44 = 0.4318. You can verify that
19/44 = 0.4318 by multiplying both sides of the equation by 44. However, you have to use
approximations:
As we take more and more of the repeated blocks, the difference between the product and
19 becomes numerically smaller than any number we can think of, so we can say that
44 × 0.4318 = 19.
Example 5.2.3. When you divide another integer by 44, how many different remainders
can appear?
Solution. The possible remainders are 0, 1, 2, . . ., 43. So there are only 44 possible remain-
ders.
1A google is the number 1 followed by one hundred zeroes.
5.2. DECIMALS 61
If divide another integer by 44, and if the long division process does not terminate, then
at each step in the division the remainder must be 1, or 2, or, . . ., or 43. So after at most
43 steps we are guaranteed to encounter a remainder that has already appeared, and then
we obtain a repeating decimal. This same reasoning works no matter what integer we are
dividing by.
Theorem 5.2.4. Every rational number can be expressed in decimal form, and the decimal
form either terminates or ends in a repeating sequence of digits.
The repeating cycle in the number .4318 consists of two digits, so we say that the cycle has
period 2. The argument that we gave above shows that when the rational p/q is expressed
in decimal form, the length of the repeating cycle is at most q − 1. There is no formula for
predicting exactly what the length will be—for example the repeating cycle in the decimal
expansion for 1/44 has period 2, while the repeating cycle for 1/7 has period 6.
Solution. There is no mystery to this, for we encountered it when we introduced the decimal
notation on page 57.
3170532
31.70532 =
10000
1000x = 31719.19
10x = 317.19
990x = 31402,
31402
x= .
990
62 CHAPTER 5. FRACTIONS, DECIMALS, AND PERCENTAGES
In both of the above examples, it is customary, although not necessary, to reduce the fraction
to a form p/q so that p and q have no common divisor. So 3170532 10000 would be reduced to
792633 31402 15701
2500 , and 990 to 495 . Since the denominators are typically of the form 100 . . . 0 or
99 . . . 900 . . . 0 they are not too difficult to factor, and the reduction is usually fairly simple.
The two examples demonstrate how to turn a decimal that terminates or repeats into a
fraction. Combining this with Theorem 5.2.4 we can describe what numbers are rational by
their decimal expansions.
Theorem 5.2.7. A number is rational if and only if its decimal expansion either terminates
or ends with a repeating cycle of digits.
Irrational numbers
Theorem 5.2.7 makes it easy to produce a whole slew of irrational numbers—just make up
an infinite decimal number which does not end in a repeating cycle. Here are two examples:
0.101001000100001000001000000100000001 . . .
0.12345678910111213141516171819202122 . . .
The fact that the rationals are closed under addition and multiplication is frequently useful
when trying to decide whether a given number is rational or irrational.
Example 5.2.8. Given that π is irrational, explain why π/2 is also irrational.
Solution. Let x = π/2. Then π = 2x. If x were rational, then π would also have to be
rational since it is the product of two rational numbers.
Example 5.2.9. The number e is perhaps even more ubiquitous than π. The decimal
expansion of e begins with 2.71828182845904523 . . ., and, like π, the number e is also known
to be irrational. Use this fact to show that (e + 2)1/3 is also irrational.
Solution. Let x = (e + 2)1/3 . Then x3 = e + 2. If x were rational, then x3 would also be
rational, and so e + 2 would be rational. Then (e + 2) − 2 would also be rational. But this
is not the case, so we have to conclude that x is irrational.
Sometimes the Fundamental Theorem of Arithmetic is used to show that a number is irra-
tional.
5.3. PERCENTAGES 63
√
Example 5.2.10. Show that 3 is irrational.
√
Proof. The proof is by contradiction. Suppose that 3 were rational. We will show that
this assumption leads to a logical contradiction, and so the assumption must be incorrect.
√ √
Assuming that 3 is rational, then 3 = p/q for some integers p and q where q 6= 0 and
where p and q have no common factor. Squaring both sides of the equation and rearranging
it we get p2 = 3q 2 , which means that p2 is divisible by 3. Since 3 | p2 it follows that 3 | p
(Theorem 3.2.12), so p = 3m, and p2 = 32 m2 = 3q 2 .
This means that 3 | q 2 and so 3 | q.
Consequently, we have shown that p and q both have 3 as one of their prime factors.√But
this contradicts the fact that they have no common factor. So we must conclude that 3 is
not rational.
5.3 Percentages
The word “cent” is French for 100, and it forms parts of some English words like “percent”,
“century”, and “centennial” So “percent” means “per hundred” or “out of a hundred”.
When we say that 15% of the needles from the Spindle and Spool company are defective,
we mean that on the average, 15 out of every 100 needles are defective.
People have enormous difficulties with percentages. Most of us understand how to turn a
decimal number into a percentage: just multiply by 100. So the numbers 0.342 and 34.2%
are exactly the same as are 4.2 and 420%. And to turn a percentage into a decimal fraction
we just reverse the process and divide by 100. So what’s the problem? The problem is that
a percentage conceals the base population.
This is very handy when you are comparing the results for collections of different sizes as
in Example 5.3.1 below. On the other hand, the hidden base can cause percentages to be
misleading as in the California style example.
64 CHAPTER 5. FRACTIONS, DECIMALS, AND PERCENTAGES
Example 5.3.1. Out of 1872 cars from the Red Onion plant we found that 712 had defective
tires, and that 871 out of 2541 cars from the Green Frog factory had defective tires. A new
factory—the Blue Water company—started up and 529 out of 1263 Blue Water cars had
defective tires. Which plant had the better record?
Solution. In this case the base populations are 1872, 2541, and 1263 which makes it awkward
to compare in fractional form. However, converting to decimal fractions or percentages
provides a quick comparison:
712
= 0.380 = 38.0%
1872
871
= 0.343 = 34.3%
2541
529
= 0.419 = 41.9%
1263
So the Green Frog factory is slightly better than the other two.
Percentages may be very deceptive when the base populations shift. This is what happened
in “California Style”. A similar effect happens when you have to combine discounts and
surcharges.
Example 5.3.2. The Whitestar Superlimo dealer normally charges $1580.00 for a new
heater for their limousines. Whitestar also charges an additional 40% of the cost of the item
for installation. There was a sale and the heaters were reduced by 40%. Since the forty
percents cancel each other, I ended up buying my heater and had it installed for a total of
$1580.00. This was a good deal—I saved the installation fee of $632.00. Any comments?
Solution. This is a case where the base shifts in a sneaky way. The reduction in price is
based on a cost of $1580.00, but the installation is based on the purchase price, which,
because of the discount is considerably less than $1580.00. Here is the actual computation:
Purchase price: 1580.00 − 1580.00 × 40% = 948.00
Installation: 948.00 × 40% = 379.20
Total cost: 948.00 + 379.20 = 1327.20
So in fact, I paid $252.80 too much!
Example 5.3.3. On the markdown table at the Bay department store, items are displayed
under a sign that says “40% off.” A weekend sale advertises “Receive an additional 25%
off on all already reduced merchandize.” This sometimes confuses customers. What total
discount will you receive if you purchase an item from the markdown table.
Solution. Many customers add the discounts and expect a total reduction of 65%, but this
is not what they will receive. How much should you expect to pay for an item from the
markdown table whose original price was $100.00? The markdown price will be $60.00 and
you will have that price reduced by a further 25%, that is by $15.00. So you will pay $45.00
and the total reduction is $55.00. Your total discount is therefore 55%, not 65%.
Another problem occurs when we talk about percentage increases or decreases. Again, using
a sample base population may help spot the error.
Example 5.3.4. Last Sunday, after the visit by a well known evangelist, 17% of the resi-
dents of the town attended church as compared to the usual 8%. The represents an increase
of over 200%. This seems right—17/8 is more than 200%. Comment.
Solution. Suppose the population of the town were 1000. Then 80 normally attend church.
Last Sunday 170 attended. That’s an increase of 90 people. The base is 80, so the increase
is 90/80 or 112.5%. That’a a big increase, but it’s not more than 200%.
This sort of error, where the word “increase” is used instead of “difference” may not appear
to be very serious. But consider a a small business whose sales were $80000.00 in July and
$96000.00 in August. If the head of sales reports an “increase of 120%”, the business owner
might believe that sales in August were $96000.00 more than July’s. This could lead to a
bad business decision.
5 5·7 35 −35
= = = .
−6 −6 · 7 −42 42
−6 −6 · (−6) 36 −36
= = = .
7 −6 · 7 −42 42
−35 −36
Since −35 > −36, we have > .
42 42
5.5 Exercises
1. Assume that distributive law for integers holds, show that the distributive law also
holds for rational numbers with addition and multiplication as defined above. That
is, show that
p a c p a p c
+ = · + ·
q b d q b q d
3. (a) Find all n for 2 ≤ n ≤ 50 for which the decimal expansion of 1/n is finite.
(b) Conjecture (without proof) which positive integers n are such that 1/n has a
finite decimal expansion.
(a) 0.3143.
(b) 2.03123.
(c) 0.1006100.
5. Suppose that x is a rational number and that y is irrational. Explain why x + y must
also be irrational. What about xy?
5.5. EXERCISES 67
√
6. In decimal form, 2 is 1.41421356 . . . . If we drop the integer part of the decimal ex-
pansion the resulting number is 0.41421356 . . . . Is that number rational or irrational?
Explain.
√ p√
7. We know that 2 is irrational. What about 2? Explain your answer.
p √
8. Show that 1 + 2 is irrational.
√
9. Show that 6 is irrational.
√
10. Show that 15 is irrational.
12. Give an example of two irrational numbers a and b such that ab is rational.
13. The golden ratio is the positive real number φ which satisfies the equation φ2 − φ = 1.
(a) Use the quadratic formula to find φ.
(b) Show that φ is irrational.
14. Explain why φ and φ2 have the same decimal part. (Hint: Use the equation that
defines φ which is given in the previous question.)
15. (From Edward MacNeal’s Mathsemantics.) Express the following items as percentages
to the nearest whole percent.
7 3
(a) (b) 0.814 (c) 12 ÷ 3 (d) (e) .9 .
10 5
(Note: Edward MacNeal was a consultant for the American airline industry, and this
question appeared on a quiz for prospective secretarial and clerical employees for his
firm. One hundred and ninety-six people took the quiz. The percentages of people
who got the correct answers were (a) 48%, (b) 35%, (c) 25%, (d) 48%, (e)43%. The
figures so alarmed him that throughout the book he used expressions like “84 out of
196” rather than “43 percent”.)
68 CHAPTER 5. FRACTIONS, DECIMALS, AND PERCENTAGES
17. Comment on the following statement, and give a more accurate comment than the
minister.
Podunk University authorities are concerned. They found that thirty per-
cent of the male students and twenty percent of the female students have
cheated on an exam at one time or another. The minister of education said
“We will no longer fund an institution where 50 percent of the students are
cheaters.”
69
6 Modular Arithmetic
The Keystone Kidnapper. The police of Keystonia had a crack swat team. Their
mission was to rescue the prime minister’s daughter, but they have run into a prob-
lem. Through a sequence of blunders, they enabled the kidnapper to capture them.
He has herded them and the young lady into a room containing seven caskets.
“You’re puny intellect amuses me,” said the kidnapper. “You have one hour to figure
out how escape from this room. Sixty minutes after I leave, six of the seven caskets
will disintegrate releasing venomous snakes. The other casket contains the key to
the door. Find the key before the hour is up and you can escape. I’ll give you a
clue—the key is in casket number 54321. And I’ve done you a favour. The caskets
are not locked.”
“But,” said the team leader, “The caskets are numbered from 1 to 7. None of them
is numbered 54321.”
“I’ll give you another clue: Start counting,” and the kidnapper showed them how.
Casket 1 was 1, casket 2 was 2, and so on until casket 7 which was 7. Then the
kidnapper started counting backwards: casket 6 was number 8, casket 5 was number
9, and so on until casket 1 which was number 13. Then the count reversed once
more, and casket 2 was 14, casket 3 was 15. “You get the idea,” said the kidnapper,
“Goodbye,” and he left them in the locked room.
“Well,” said the team leader, “let’s start counting.”
“Hold it,” said the young lady. “We have less than 60 minutes—that’s 3600 seconds,
and my calculator says that 54321 divided by 3600 is about 15. We would have to
count 15 caskets per second and not make a mistake.”
The prime minister’s daughter figured it out. Which casket contained the key?
Modular arithmetic is the arithmetic of remainders. It is a simple but powerful tool. You
have already worked a bit with remainders, so some of what is done here will seem familiar.
70 CHAPTER 6. MODULAR ARITHMETIC
Two integers are said to be congruent modulo m if any one of the these three conditions
hold:
The example below should convince you that the three statements are mathematically equiv-
alent. Any one of them may be taken as the definition of congruence.
The notation for congruence is “ ≡ ”, and the symbolism is
a ≡ b (mod m).
Example 6.1.1. Use each of the three definitions to verify the following statement.
16 ≡ 28 (mod 6).
Solution.
Example 6.1.2. Describe all the integers that are congruent to 7 modulo 3.
Solution. What we want is all of the integers that differ from 7 by a multiple of 3. We can
write this in two ways:
or
Residue classes
Given a positive integer m, and a fixed integer x (which may be positive or negative), the
set of all integers that differ from x by a multiple of m is called a residue class modulo
m, or a congruence class modulo m. We denote the congruence class containing x by
the symbol [x]. The set in the previous example is the congruence class [7] modulo 3. It
is also the congruence class [1], the congruence class [4], the congruence class [10] and so
on. It is very common to use the smallest nonnegative member n of the congruence class to
denote it, so usually we would use [1] instead of [7].
Properties
Congruency is what is known as an equivalence relation. This means that it has the three
basic properties of equality—reflexivity, symmetry, and transitivity:
Reflexivity: a ≡ a (mod m). In words, every integer is congruent to itself.
Symmetry: If a ≡ b (mod m), then b ≡ a (mod m).
Transitivity: If a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m)
Algebraically, congruences are handled very much like equations. Recall that you can add
equations, multiply equations by a nonzero constant, and so on.
If a≡b (mod m)
and c≡d (mod m)
then a + c ≡ b + d (mod m)
and ac ≡ bd (mod m)
The preceding could be summarized by saying that if you select any x from [a] and any y
from [c] then x+y always in in the congruence class [a+c] and xy is always in the equivalence
class [ac]. Because of this consistency, we can conceive of adding and multiplying equivalence
classes as shown in the table on the next page.
72 CHAPTER 6. MODULAR ARITHMETIC
+ [0] [1] [2] [3] [4] × [0] [1] [2] [3] [4]
[0] [0] [1] [2] [3] [4] [0] [0] [0] [0] [0] [0]
[1] [1] [2] [3] [4] [0] [1] [0] [1] [2] [3] [4]
[2] [2] [3] [4] [0] [1] [2] [0] [2] [4] [1] [3]
[3] [3] [4] [0] [1] [2] [3] [0] [3] [1] [4] [2]
[4] [4] [0] [1] [2] [3] [4] [0] [4] [3] [2] [1]
A useful technique
One of the consequences of the previous properties is that if we have a congruence like
a+b≡c (mod m)
then we can replace a with any number from the congruence class [a], we can replace b with
any number from the congruence class [b], and we can replace c with any number from the
congruence class [c]. Everyone who works with congruences exploits this technique.
The integer 13 belongs to the congruence class [1], the integer 10 belongs to [4], and the
integer −9 belongs to [3]. So the values of x that satisfy the congruence (6.3) also satisfy
the congruence
1 + 4x ≡ 3 (mod 6),
or, equivalently,
4x ≡ 2 (mod 6).
This is now easily solved by substituting x = 0, 1, 2, 3, 4, 5 and seeing which values satisfy
the equation: the solution is x = 2 and x = 5.
6.1. CONGRUENT INTEGERS 73
Example 6.1.5. Given that in 2002, Halloween fell on a Thursday, what day of the week
will Halloween fall on in 2102?
The strategy is to count the number of days from October 31, 2002 to October 31, 2102
and divide by 7. If the remainder is 0, then Halloween 2102 will fall on Thursday, if the
remainder is 1, it will fall on Friday and so on.
The fact that some years have 366 days instead of 365 adds a minor complication. The
Gregorian Calendar, the one that we currently use, determines leap years according to
the following rules:
The Gregorian Calendar assumes that a year is exactly 365.2425 days, and the leap days are
necessary to correct for the .2425. In fact the year is closer to being 365.24219 solar days
long, and because of this the year 2800AD should not be a leap year. In other words, to
correct the Gregorian calendar we need to omit a leap year for every year that is divisible
by 2800. (So in 2800, the Gregorian calendar will incorrectly add a leap day. No doubt we
will have switched to the corrected calendar by the time.)
Solution for Example 6.1.5. There are 100 years from Oct 31, 2002 to Oct 31, 2102, so there
are 365 × 100 days plus a number of leap days. A leap day is added in each of the years 2004,
2008, . . . , 2096, but not in 2100. The number of leap days is therefore (2096 − 2004)/4 + 1,
or 24. So, we want to find the smallest nonnegative x such that
x ≡ 365 × 100 + 24 (mod 7).
Since 100 ≡ 2, and 365 ≡ 1, and 24 ≡ 3, this is the same as finding x such that
x≡1×2+3 (mod 7),
So x = 5 and so Halloween falls on a Tuesday in 2102.
26 ≡ −1 (mod 9)
=⇒ 2635 ≡ (−1)35 (mod 9)
35
=⇒ 26 ≡ −1 (mod 9)
≡ 8 (mod 9)
So the remainder is 8.
27 ≡ 2 (mod 5)
=⇒ 272 ≡ 22 (mod 5)
≡ 4 ≡ −1 (mod 5).
17
Now 2735 = 27 · 2734 = 27 272 . We have
272 ≡ −1 (mod 5)
17
=⇒ 272 ≡ (−1)17 ≡ −1 (mod 5)
so the remainder is 3.
Note that 27(−1) was replaced by 2(−1) because 27 ≡ 2 (mod 5), that is, 2 is in the
congruence class that contains 27.
3=3
32 = 9
33 = 3 · 32 ≡ 3 · 9 ≡ 27 ≡ 5
34 = 3 · 33 ≡ 3 · 5 ≡ 15 ≡ 4
35 = 3 · 34 ≡ 3 · 4 ≡ 12 ≡ 1
6.1. CONGRUENT INTEGERS 75
So the remainder is 9.
So you see the general procedure: to find the remainder when xn is divided by m, first
replace x by the remainder, r, when x is divided by m. This works because xn ≡ rn
(mod m). (If r = m − 1, replace x by −1 instead, and then use the fact that xn ≡ (−1)n .)
Now start taking powers of r, all the time reducing the result modulo m. Keep doing this
until you get a result of m − 1, m, or 0.
This method cannot always be followed exactly. The following example shows how the ideas
can be adapted.
so
373136 = 3737·19 3733 ≡ (−3)19 117 (mod 1000).
Now,
(−3)19 = −1162261467 ≡ 533 (mod 1000),
so
373136 ≡ 533 · 117 = 62361 ≡ 361 (mod 1000),
so the last three digits are 361.
6≡6
62 ≡ 6 · 6 ≡ 36 ≡ 10
63 = 6 · 62 ≡ 6 · 10 ≡ 60 ≡ 8 (6.4)
4 3
6 = 6 · 6 ≡ 6 · 8 ≡ 48 ≡ 9
65 = 6 · 64 ≡ 6 · 9 ≡ 54 ≡ 2
66 = 6 · 65 ≡ 6 · 2 ≡ 12 ≡ −1 .
76 CHAPTER 6. MODULAR ARITHMETIC
Then, break down 6567 into as many powers of 66 as we can: 6567 = 63 (6564 ) = 63 (66 )94
Now use the fact that 66 ≡ −1 and raise both sides of the congruence to the 94th power:
and multiplying by 63 :
so the remainder is 8.
In many of the previous examples with small numbers we were always able to find some
power that was congruent to 1 or to −1. This is not always possible, but usually a pattern
emerges that lets you solve the problem. (See Exercise 8.)
Theorem 6.2.1. If n is a positive integer, then n is congruent modulo 9 to the sum of its
digits.
This theorem says that if we have a number abcde, where a, b, etcetera, are the digits of the
number, then
abcde ≡ a + b + c + d + e (mod 9).
This is more powerful than the divisibility test itself, but the proof is not much different.
Proof of Theorem 6.2.1. The number abcde is 10000a + 1000b + 100c + 10d + e and we have
Given a positive integer, sum its digits to get another positive integer. If the new integer
has two or more digits, sum the digits again. Keep doing this until you end up with a single
digit. If the single digit is 9, replace it by 0. The single digit that you end up with is called
the digital root of the original number. The previous example shows that the digital root
of 176459883 is 6.
6.2. DIGITAL ROOTS AND DIVISIBILITY TESTS 77
A better way to find the digital root is to cast out nines as you add the digits: sum the
digits from left to right, and as soon as the sum exceeds 9, subtract 9 from the sum (this is
what is meant by casting out a nine). The single digit that you end up with must be the
digital root. For example with the number 176459883 we have
1 + 7 = 8,
8+6=5 (A 9 has been cast out.)
5+4=0 (Another 9 has been cast out.)
Continue in this fashion. What you are actually doing is just adding the digits modulo 9 as
you go along.
Example 6.2.3. Without actually doing the calculation, show that 163168632818 cannot
be the product of 317177 and 514434.
Solution. The digital roots of 163168632818, 317177, and 514434 are, respectively, 8, 8, and
3. This means that
317177 ≡ 8 (mod 9)
514434 ≡ 3 (mod 9)
but since
163168632818 ≡ 8 (mod 9)
163168632818 and 317177 × 514434 are not congruent modulo 9, so they cannot be the same
number.
Before the advent of calculators, bookkeepers used digital roots as a quick check of the
accuracy of their arithmetic. Note that this does not catch all errors, and if a calculation
passes the digital root test it is not necessarily correct. (However, since bookkeepers were
“good with sums”, that together with the digital root test meant there was a high probability
that the computation was correct.)
78 CHAPTER 6. MODULAR ARITHMETIC
6.3 Exercises
1. (a) How many leap days are there between Jan 1, 2003 and Jan 1, 2503?
(b) Given that Jan 1, 2003 was a Wednesday, what day of the week is Jan 1, 2503?
2. (a) Assuming the more correct calendar is used, (that is, the one where 2800 is not
a leap year) how many leap days are there in the period from Jan 1, 2003 and
Jan 1, 3003?
(b) What day of the week does Jan 1, 3003 fall on.
3. The difference in time between Vancouver and Beijing is 9 hours. The international
dateline passes through the Pacific ocean between Vancouver and Beijing.
(a) What time and day is it in Vancouver when it is 7 am Friday in Beijing?
(b) What time and day is it in Vancouver when it is 7 pm Tuesday in Beijing?
(c) The flying time from Beijing to Vancouver is 10 hours. If you leave Beijing at
4pm Monday (Beijing time) at what time will you arrive in Vancouver (Vancouver
time)?
2(5x) ≡ 14 (mod 9)
Since 2(5) ≡ 1 (mod 9), then x ≡ 14 ≡ 5 (mod 9). So the solution is the congruence
class [5].
Use the inverses from Exercise 4 to solve each of the following congruences:
(a) 3x ≡ 2 (mod 5). (b) 4x ≡ −3 (mod 7). (c) 37x ≡ 12 (mod 5).
6.3. EXERCISES 79
6. In ordinary arithmetic, if the product of two numbers is 0, then at least one them
must be 0.
(a) Is this true in “mod 3” arithmetic? (The easiest way to answer this is to check
all products xy where x and y are positive integers less than 3.)
(b) Is this true in “mod 6” arithmetic?
(c) Is this true in “mod 7” arithmetic?
(d) Is this true in “mod 9” arithmetic?
(e) For which positive integers m is the statement true in “mod m” arithmetic?
12. Using digital roots, what can you conclude about the correctness of 1765 × 3227 =
5695565?
13. In this question, dr(x) denotes the digital root of x.
(a) Given x = 30986 and y = 443092 find dr(x + y) and dr(dr(x) + dr(y)).
(b) Using modular arithmetic, explain why dr(x + y) = dr(dr(x) + dr(y)) for all
positive integers x and y.
(c) Using digital roots show that 123456 + 87876 + 450993 6= 662825.
14. Given a positive integer x, rearrange its digits to form another integer y. Explain why
x − y is divisible by 9.
15. Using Modular arithmetic show that abcdef and −a + b − c + d − e + f have the same
remainder when divided by eleven. Note: The alternating plus and minus signs are
arranged so that the last or rightmost digit is added. For example, the remainder when
7113156 is divided by 11 will be the same as the remainder when 7−1+1−3+1−5+6
is divided by 11.
81
Karate Frog. Euclid the frog lives at the end of a line of lily pads. He has to visit
his doctor whose office is on the next lily pad.
If he hops 9 forward and 7 backward, he just misses the doctor’s lily pad by 1. If he
hops 7 forward twice and 9 backward he misses the doctor’s lily pad by 4.
How can Euclid hop to his doctor’s lily pad?
This is one puzzle that is completely solved here, so if you want to try it yourself, do it now
before reading further.
One strategy that works is to do forward jumps of 9 and backward jumps of 7, (so long as
Euclid doesn’t back up beyond his own lily pad). Labelling Euclid’s pad as 0, the doctor’s
pad as 1, etc, Here’s what happens:
jumps lands at
Forward 9 9
back 7 2
forward 9 11
back 7 4
forward 9 13
back 7 6
forward 9 15
back 7 (two jumps) 1
jumps lands at
Forward 14 (two jumps) 14
back 9 5
forward 7 12
back 9 3
forward 7 10
back 9 1
In the first case Euclid made a total of 4 forward jumps and 5 backward jumps. He could
have combined all forward jumps and all backward jumps and the equation for this becomes:
9 · 4 + 7 · (−5) = 1.
In the second case, there are 4 forward jumps of 7 and three backward jumps of 9 and the
equation becomes:
9 · (−3) + 7 · 4 = 1.
Other solutions are possible, for example, 11 forward jumps of 9 and 14 backward jumps of
7, which gives the equation:
9 · 11 + 7 · (−14) = 1.
A Diophantine equation is one where the coefficients and variables are all integers.
The Diophantine equation a1 x1 + a2 x2 + · · · + an xn = c is called a linear Diophantine
equation in n variables x1 , x2 , . . . , xn , where the coefficients a1 , a2 , . . . , an are not
all 0.
There is a solution to ax = c if and only if a|c, and the unique solution is x = c/a. It is far
more interesting when there are two variables, as in 9x + 7y = 1.
7.2. THE HOMOGENEOUS CASE 83
Note: The solution (x, y) = (5k, 3k), where k = 0, ±1, ±2, . . ., is called the general solu-
tion, or simply, the solution of the equation 3x = 5y. If a specific numerical value of k is
used, the result is called a particular solution. For example if we set k equal to 1, the
result, namely (x, y) = (5, 3), is a particular solution.
From these two examples, we see that to solve the equation ax + by = 0, we should first
check if gcd(a, b) = 1. If this is not so, divide the equation by the greatest common divisor
to obtain a new one for which this is the case.
abk = −by0 ,
and solving this for y0 gives y0 = −ak. This completes the proof.
(a) no solutions?
Solution. The numbers involved are relatively small, and by inspection we can pick out the
particular solution (x, y) = (−2, 2). We can obtain other solutions by incrementing x as
before. Rewrite the equation in the form 5y = 4 − 3x. If we increase x by 5, then the right
side of the equation is decreased by 15. To maintain balance, we must decrease y by 3. This
leads to the general solution (x, y) = (−2 + 5k, 2 − 3k).
7.3. THE LINEAR CASE 85
Note that (x, y) = (−2, 2) is a particular solution to 3x + 5y = 4 while (x, y) = (5k, −3k)
is the complete solution to the homogeneous equation 3x + 5y = 0. When we add the
corresponding components of both solutions, we get the complete solution for the original
equation. This illustrates the typical approach in solving a linear Diophantine equation:
First find a particular solution and then obtain the general solution by incorporating the
general solution for the homogeneous case.
Here is the same solution presented in a different way to emphasize the role of the homoge-
neous components.
A particular solution to the equation 4x + 6y = 2 is
Some people prefer to solve Example 7.3.4 by first dividing the equation 4x + 6y = 12 by
gcd(4, 6) obtaining the new equation 2x + 3y = 6. This is the approach that we used in
Example 7.3.2. It introduces an extra step, but it does work. The drawback to solving
the equation this way is that it is not necessary to do so, and there are equations like
247x + 221y = 78 where it is not obvious what gcd(247, 221) is.
These examples suggest the following general method for solving the Diophantine equation
ax + by = c.
(a) Let a′ = a/d, b′ = b/d. Note that the greatest common divisor of a′ and b′ is 1.
(b) The family of solutions is given by (x, y) = (u+b′ k, v−a′ k) where k is an arbitrary
integer. Note that we must use a′ and b′ instead of a and b, otherwise we will
miss some solutions.
So far, we have found particular solutions “by inspection”, which is just a fancy way of
saying we tried a few different values for the variables until we found some that worked. It
is not always easy to obtain a particular solution in this manner. Fortunately, the Euclidean
Algorithm will always rescue us:
Solution. We first determine the greatest common divisor of 143 and 105 by the Euclidean
Algorithm.
143 − 105 = 38
105 − 2(38) = 29
38 − 29 = 9
29 − 3(9) = 2
9 − 4(2) = 1 (7.1)
2 − 2(1) = 0
Stepping backwards through the Euclidean algorithm, beginning with equation (7.1) we
solve 143x + 105y = 1. The computations are shown below.
1 = 9 − 4(2)
= 9 − 4(29 − 3(9)) = 13(9) − 4(29)
= 13(38 − 29) − 4(29) = 13(38) − 17(29)
= 13(38) − 17(105 − 2(38)) = 47(38) − 17(105)
= 47(143 − 105) − 17(105) = 47(143) − 64(105).
Note the signs in the general solution for Example 7.3.6 are positive due to the negative
coefficient in the Diophantine equation.
88 CHAPTER 7. LINEAR DIOPHANTINE EQUATIONS
3. Pour everything from one jug into the other leaving the first jug empty and partially
filling the second jug.
4. Pour enough from one jug into the other to fill the second jug, leaving some contents
in the first jug.
Only the first two actions change the amount of water in the system, so all we are really
doing is adding and subtracting multiples of 5 and 3 in order to end up with 4. In other
words, we are trying to solve the linear Diophantine equation 3x + 5y = 4.
The constraint on this puzzle is that at any given time you cannot have more than 3
gallons in the 3 gallon jug or more than 5 gallons in the 5 gallon jug. When there are
constraints there is still some work to be done to apply the solution of the Diophantine
equation to the original problem. Let us pick some particular solutions from the general
solution (x, y) = (−2 + 5k, 2 − 3k) and see how each solves the jug problem.
Case 1: k = 0. Here x = −2, y = 2, which says fill the 5-gallon jug twice and empty the
3-gallon jug twice. In order to do this, of course, we have to transfer water from the 5-gallon
jug to the 3-gallon jug as needed. It goes like this: Fill the 5-gallon jug and empty it into
the 3-gallon jug, then empty the 3-gallon jug. This leaves the system with 2 gallons in the 5
gallon jug. Pour the 2 gallons into the 3-gallon jug, then fill the 5-gallon jug. We now have
7 gallons in the system. Using the five gallon jug, top up the 3-gallon jug and then empty
the 3-gallon jug. We are left with 4 gallons in the system.
Case 2: k = 1. Then x = 3, y = −1, which says fill the 3-gallon jug three times and empty
the 5-gallon jug once. We leave the details as an exercise.
Case 3: k = −1. Then x = −7 and y = 5. This tells us to fill the 5-gallon jug 5 times and
empty the 3-gallon jug 7 times, transferring water from the 5-gallon jug to the 3-gallon jug
as needed.
The Karate Frog problem also has constraints because the hopping has to be arranged so
that the frog always lands on a lily pad with number 0 or more (there are no lily pads with
negative numbers). In this case it is relatively easy to satisfy the constraints: Do all the
forward hops before any of the backward hops.
7.4. WHEN THERE ARE CONSTRAINTS 89
Here is a problem where there are constraints on the values of variables in the Diophantine
equation that arises.
Example 7.4.1. A person has a collection of silver coins of two different types. One type
is worth 4 dollars, the other is worth 7 dollars. She wants to use the coins to pay a debt of
29 dollars. The person she is paying cannot make change. Can she pay off her debt with
the silver coins?
Solution. It is quite easy to find a solution by trial an error: 2 of the four dollar coins plus
3 of the seven dollar coins will total 29. However, for other problems, it may not always be
as easy to find a solution, so let us proceed in a more systematic way.
We begin by writing the corresponding Diophantine equation.
4x + 7y = 29. (7.2)
Since the person who is owed the money cannot make change, both x and y must be
nonnegative integers. That is, the constraints are x ≥ 0, and y ≥ 0.
We will solve the equation using the method outlined on page 86. Since gcd(4, 7) = 1, there
will be a solution. Following usual procedure in dealing with an equation like ax + by = c,
we replace c by the greatest common divisor of a and b and first solve the equation ax+ by =
gcd(a, b). In this case we want to solve
4x + 7y = 1. (7.3)
Either by inspection or by using the Euclidean Algorithm, we see that (x, y) = (2, −1) is a
particular solution for equation (7.3). If (x, y) satisfies equation (7.3), then (29x, 29y) will
satisfy equation (7.2). So to obtain a particular solution for equation (7.2) we multiply the
solution for equation (7.3)
by 29. In other words, a particular solution for equation (7.2) is
(x, y) = 29(2), 29(−1) = (58, −29).
To obtain the general solution, we incorporate the general solution for the homogeneous
equation 4x + 7y = 0, which is (x, y) = (7k, −4k). The general solution for equation (7.2) is
Now we want a particular solution that fits the constraints of the original problem. We
must have −29 − 4k ≥ 0 and 58 + 7k ≥ 0. The first constraint implies that k cannot be
larger than −8 and the second constraint means that k cannot be smaller than −8. So, k
must be −8, and then
(x, y) = 58 + 7(−8), −29 − 4(−8) = (2, 3).
This shows that the person can pay off her debt using the strange silver coins but in one
and only one way.
90 CHAPTER 7. LINEAR DIOPHANTINE EQUATIONS
The following problem frequently appears in puzzle books and it illustrates more realistically
the need for our formalized method. Note that again there are constraints on the values of
the particular solution.
Example 7.4.2. When Mrs. Brown cashed her pay cheque, the absent-minded teller gave
her as many cents as she should have dollars, and as many dollars as she should have cents.
Equally absent-minded, Mrs. Brown left with the cash without noticing the discrepancy. It
was only after she spent 5 cents that she noticed now she had twice as much money as she
should. What was the amount of her cheque?
Solution. Let x be the number of cents in the amount of the cheque, and let y the number
of dollars. Note that the constraints on x and y are that 0 ≤ x < 100 and 0 ≤ y < 100.
The amount of the cheque in cents is 100y + x (we choose cents to avoid decimals).
The amount of cash Mrs. Brown left with is 100x + y, and after her expenditure, she had
100x+y−5 left. Since this is double 100y+x, we have our equation 100x+y−5 = 2(100y+x),
which simplifies to 98x − 199y = 5. Using the Euclidean Algorithm to find the gcd we get
199 − 2(98) = 3
98 − 32(3) = 2
3−2 = 1.
So, gcd(199, 98) = 1, and this means that there is a solution. Back-stepping through the
algorithm, we get a particular solution to 98x − 199y = 1:
1=3−2
= 3 − (98 − 32(3))
= 33(3) − 98
= 33(199 − 2(98)) − 98
= 33(199) − 67(98).
For the solution to make sense, we must have 0 < x < 100. From 0 < 199k − 335 < 100,
the only possible integer value is k = 2. Hence (x, y) = (63, 31). Note that this also satisfies
the constraint on the variable y, so that Mrs. Brown’s cheque was for $31.63.
7.5. WHEN THERE ARE MORE THAN TWO VARIABLES 91
We now return to the equation 3w = 60x + 51y, which may be rewritten as 20x + 17y = w.
We have gcd(20, 17) = 1 = 6(20) − 7(17) from which we get
The last two examples shows how our method for solving linear Diophantine equations with
two variables can be extended to solve those with more variables. With two variables, the
solution family has a single parameter which we call k. With three variables, the solution
family has two parameters k and ℓ. The number of parameters in the solution family is
always one less than the number of variables.
92 CHAPTER 7. LINEAR DIOPHANTINE EQUATIONS
7.6 Exercises
1. Are there any solutions of the following linear Diophantine equations? In each case
give reasons.
(a) 5y = 3;
(b) 3x + 5y = 3;
(c) 6x + 4y = 3;
(d) 8x + 4y = 28;
(e) 12x + 18y = 3?
6. You have collection of 25 and 40 gram weights. Show how to weigh a 5 gram marble
using an accurate pan balance.
8. Complete the solution to the Die Hard Jug problem for case 2 on page 88.
9. In the Die Hard Jug problem, something strange happens when we try to use the
particular solution for case 3 on page 88. What is strange about it?
7.6. EXERCISES 93
10. Karate frog again. Euclid the frog wants to visit his friend Sammo, who lives on
lily pad #5 (Read about Euclid on page 81.)
Euclid can hop back and forth along the line of lily pads but he is not allowed to get
his injured leg wet. This time if he hops with his right leg, he always lands exactly 11
lily pads away. If he jumps with his left he always lands exactly 7 lily pads away.
How can Euclid hop to Sammo’s lily pad?
(a) Write the linear Diophantine equation that describes the puzzle, and explain how
the equation relates to the problem.
(b) Find the family of all solutions.
(c) Find two different particular solutions and explain how these solve the puzzle.
11. A pet shop owner bought an even number of hamsters at $2 each, and the same number
of parakeets at $1 each. Each pet was marked up 10%, and when all but seven of them
had been sold, the original cost had been recovered. What was the potential profit,
as represented by the retail value of the remaining pets?
12. Mrs. Kalinski has a collection of two types of ceramic tiles. One type measures 14 × 5
cm, the other, 8 × 5 cm. She wishes to tile the top of a small table that is 96 cm wide
by 125 cm long. She realizes that 125 is a multiple of 5, so she could tile it with 25
rows if she could find a way to fit a mixture of the 14 cm and 8 cm tiles that fit in
each row. Can she do this? A typical row of the table might look something like this:
5 cm ...
13. Cuisenaire rods are coloured sticks of lengths measuring from 1 cm to 10 cm that
represent the integers from 1 through 10. They are sometimes used to help teach
arithmetic. When several rods are placed end to end the result is called a train. For
what values of n can a train of 6-rods differ from a train of n-rods by exactly one
4-rod?
14. The admission fee for a year-end banquet was $35.00 for professors and $27.00 for
students. The admission fees totalled $1432.00. How many of each attended?
95
8 Number bases
You are so familiar with how we represent numbers that it can disguise the problems that
youngsters have with simple arithmetic. You know how to multiply and divide multi-digit
numbers, but if you are pressed for an explanation you might be forced to say “Because
that is the way it is done”.
Numbers and the symbols that represent them are not one and the same. The number
“fifteen” can be written “15”, or “F ”, or “XV”—the first uses decimal digits, the second is
a hexadecimal representation, and the third uses Roman numerals. The method that we use
to represent numbers does not affect their basic properties: 15 + 12 is the same as 12 + 15;
F + B is the same as B + F ’, and XV + XII is the same as XII + XV.
There is a big difference, however, between the first two representations and the Roman nu-
meral system. Decimal and Hexadecimal numbers are positional systems; Roman numerals
are not.
The Romans represented the numbers 1 through 15 as follows:
The use of IV and IX to represent 4 and 9 did not occur until the middle of the dark
ages. In the Roman system, the symbols I, V, and X have very specific meanings and do
not depend upon where they occur in the number. They are, in effect, the “atoms” of the
Roman numbering system.
The Roman numeration system has two serious defects. First, as the numbers get larger
and larger more and more symbols have to be introduced. The second and most obvious
defect is that Roman numerals are very inconvenient for calculations, so cumbersome, in
fact, that the Romans did not use Roman numerals for calculations! Roman numerals were
primarily for recording numbers. A Roman mathematician would use a counting board
or an abacus to do arithmetic calculations. The Roman numeral representation would be
transformed to beads or pebbles on a counting board, the computation would take place
by moving the beads or pebbles, and the result would be transformed back into Roman
numerals. By using an abacus, the Romans were effectively converting their numbers to a
positional system before doing the arithmetic.
A positional system overcomes both defects. In a positional system, the numbers are rep-
resented by a string of digits but the meaning of the digits depends upon where they occur
in the number—91 and 19 are not the same number. With a positional system there is
no need for a welter of symbols. Every positive integer can be represented using only a
finite number of digits. Moreover, positional systems possess the amazing property that it
is possible to use them directly for calculating. The rules for computing with a positional
96 CHAPTER 8. NUMBER BASES
system actually reflect exactly what you would do on an abacus, and as people became more
and more skilled with the decimal system this eventually led to the decline of the abacus.
Our number system uses ten digits. There are positional systems that use a different number
of digits. The base-2 system uses two digits, 0 and 1. Base-six numbers use six digits, 0, 1,
2, 3, 4, and 5. A system that uses n digits is called a base-n system.
In this chapter we will learn how to perform the basic arithmetic calculations using different
bases. Your inexperience with these bases will likely cause some confusion, the same sort of
confusion that youngsters have—when children start learning math, they are as unfamiliar
with base-ten numbers as you are with base-five or base-twelve numbers. In fact, you have
a decided advantage: you already have base-ten as a model; the children have nothing as a
model.
1 3 5 2 3 6 4 5 6 8 9 10
7 9 11 7 10 11 7 12 13 11 12 13
13 15 14 15 14 15 14 15
A B C D
Each of the numbers from 1 through 15 appear on one or more of the cards shown
above. A spectator chooses a number, and tells you which cards contain the number.
For example, if the secret number is 11, the spectator will say that the number is on
cards A, B, and D. Then you immediately tell the spectator what the chosen number
is.
This is one of the oldest mathematical tricks. The secret is to add the numbers in the upper
left hand corners of the named cards. The numbers on cards A, B, and D are 1, 2, and 8,
so the number 11 must have been chosen. If you repeat the trick enough times, eventually
everyone you show it to will know the secret. But knowing how it is done doesn’t explain
what numbers should be on what cards.
8.1. BINARY NUMBERS 97
The distribution of the numbers is determined by using their binary expansions. Every
number from 1 to 15 can be written as a sum of the numbers 1, 2, 4, and 8. In fact every
positive integer can be written in a unique way as the sum of powers of 2. The following
example is not a proof, but it should convince you that the preceding statement is true:
1 2 4 8 16 32 64 128 256 . . .
We stop here because 128 < 221 < 256, that is, because 128 is the largest power of two that
does not exceed 221. This means that 128 is one of the powers of two that will be used to
create the sum. We remove 128 from 221, and then look for the next largest power that can
be removed. The full process looks like this:
221 = 128 + 93
= 128 + 64 + 29
= 128 + 64 + 16 + 13
..
.
= 128 + 64 + 16 + 8 + 4 + 1
231 = 27 + 26 + 24 + 23 + +22 + 20 .
If we are going to write lots of numbers as powers of 2, it is tedious to use the preceding
notation. Instead, we use a positional notation to indicate which powers of two are present,
the rightmost position being for 20 . We put 1’s or 0’s in the position according to whether
the indicated power of 2 appears or does not appear in the expansion obtained. So, for 221,
you would get
1 1 0 1 1 1 0 1
7 6 5 4 3 2 1
2 2 2 2 2 2 2 20
221(10) = 11011101(2) .
98 CHAPTER 8. NUMBER BASES
Solution. Here is the number with the powers of 2 written below the corresponding digits:
1 0 1 1 1 0 1 0
27 26 25 24 23 22 21 20
Base-4 Blocks
1 2 3 10
11 12 13 20
The problem arises because the shape of a block corresponds to the size of the digit rather
than its position in the number. If you were to use base-ten blocks to represent the number
111, you could use one large slab-like block for the 100, a rod for the 10, and a cube for
the unit. However, for even moderately sized numbers, you will need many different sized
blocks! Does this sound familiar? Using different shaped blocks to represent numbers is
really not very much different than using Roman numerals.
A line abacus consists of a set of parallel lines with the numbers 1, 10, 100, etc, written
below them starting with 1 on the right. Numbers are represented by placing tokens on
various lines. If you are in base-n, you can place at most n − 1 tokens on a line. The
diagram below shows the first few numbers using a base-4 line abacus.
1 2 3 10
11 12 13 20
In base-4 the digits are 0, 1, 2, and 3. We would count: 1, 2, 3, 10, 11, 12, 13, 20, 21, and
so on. When we count objects in base-4 like this, each place tells us how many groups of
objects we have. The rightmost digit tells us how many groups of size 1 we have, the next
digit to the left tells us how many groups of size four (which is 10(4) ) we have, the next digit
tells us how many groups of size sixteen (which is 100(4)), the next tells how many groups
of size sixty-four (which is 1000(4)), and so on.
100 CHAPTER 8. NUMBER BASES
NOTE: When counting in a base other than ten, it is a good practice to avoid using the
words “ten”, “eleven”, “twelve” and so on. The reason is that the association of these
numbers with the base-10 system is so strong that it may cause you to think in base-ten
rather than in the base you are working in. So, when you are counting in base-4, think
Solution. Counting the base-5 numbers starting with 13 (that’s one-three in base 5):
13 14 20 21 22 23 24
+1 +2 +3 +4
So in base-5, 13 + 4 is 22.
8.3. ADDITION OF BASE-N NUMBERS 101
1000 100 10 1
1000 100 10 1
After doing this the unit line is OK, but now there are too many
counters on the 10 line.
1000 100 10 1
Remove five counters from the 10 line and place an extra counter
on the 100 line. All lines are now OK, and the sum is 212.
1000 100 10 1
102 CHAPTER 8. NUMBER BASES
As you can see, a line abacus is useful in describing the arithmetic of positional systems. It is
an interesting sidelight to note that prior to the universal adoption of our base-10 positional
system, calculations were performed on some sort of abacus. They are very efficient for
adding and subtracting numbers1 , and are still in use in many places around the world.
In the western hemisphere they seem to be relegated to helping elementary students learn
basic arithmetic. This is somewhat ironic, because in the past it was the great efficiency of
the abacus that hindered the adoption of the base-10 system.
Base-5
+ 1 2 3 4
1 2 3 4 10
2 3 4 10 11
3 4 10 11 12
4 10 11 12 13
The carrying process described with the line abacus has a direct counter part in pencil and
paper calculation.
Example 8.3.3. Compute 134(5) + 23(5) using pencil and paper computation.
Solution. Using the addition table for base-5, we have 4 + 3 = 12, and 3 + 2 = 10, so
1 1
1 3 4
+ 2 3
2 1 2
1 A person who is skilled on an abacus can beat an electronic calculator—you cannot punch numbers into
Notice the connection between Example 8.3.3 with the line abacus. The second step with
the line abacus was to remove five of the counters from the unit line and put an additional
counter on the 10 line. By doing so, we are replacing the “4 + 3” on the unit line with “1”
on the 10 line and“2” on the unit line. That is, we are saying that in base-5, 4 + 3 = 12.
0 1 2 3 4 10 11 12 13 14 20 21 22 23
3 1 3 2 3 3 3 4
To perform multiplication requires the use of multiplication tables (and this is true even
with a line abacus). To create a multiplication table, start with the column on the left, and
repeatedly add the appropriate number. For example, to get the row for 3 × n, start with
3 and increase by 3 for each column to the right. In the multiplication table there is really
no need to include 0 or 1, however, some people prefer to include 1 to make it the same size
as the corresponding addition table. You may also take advantage of commutativity—the
table is symmetric with respect to the diagonal, and this will cut your work in half.
Base 5
× 1 2 3 4
1 1 2 3 4
2 2 4 11 13
3 3 11 14 22
4 4 13 22 31
The figure below shows how the addition step in Example 8.4.1 is performed on a line
abacus.
31
+
220
+
1300 2101
Let us see how to turn this into the usual format for paper and pencil multiplication. First,
write it as shown in Figure (a) below, then drop the trailing zeroes as in Figure (b), and
then collapse it as in Figure (c). In Figure (c), the numbers 31, 22, and 13 have been written
on a slant like this: 31 , 22 , and 13 .
The final stage is to carry out the implied additions in Figure (c) as you go along and end
up with Figure (d), which is the usual way multiplication is displayed.
234
42
1023 (234 × 2)
21010 (234 × 40)
22033
8.5. SUBTRACTION OF BASE-N NUMBERS 105
Example 8.4.3. Compute 12A(12) × 57(12) . Use the base-12 tables on page 113.
Solution. As mentioned earlier, we use letters to denote the extra digits in base-12, so the
digits are 0, 1, 2, . . ., 7, 8, 9, A, B.
12A
57
87A (12A × 7)
6220 (12A × 50)
6A9A
Solution. The reason for such a simple example is to illustrate two different ways that
subtraction can be performed. Both involve “borrowing” from the digit on the left.
3
12 3
base+2
4 2 4 2
− 4 − 4
3 3 3 3
The computation on the left is probably closest to the way you learned it. To get the boxed
number 3, you borrow the 1 from the 4, forming the base-5 number 12(5) . You have to find
a number which added to 4(5) will give you 12(5) . You find this number by looking in the
base-5 addition table.
The computation on the right uses what is called subtraction from the base. No matter
how we do the subtraction, we are adding the base to the number 2, and the computation
we are performing is (base + 2) − 4. In the first computation, we visualized this as being
12(5) − 4(5) . With the second method, we do not combine the base and the digit 2, but use
the commutativity of addition and proceed as follows
(base + 2) − 4 = (base − 4) + 2 .
In this case the base is 5, so (base − 4) = 1 and the computation becomes
(base − 4) + 2 = 1 + 2 = 3 .
Both methods can be extended to numbers involving any number of digits. It is an in-
teresting exercise to interpret the two methods using a base-5 line abacus as we did for
addition.
106 CHAPTER 8. NUMBER BASES
To switch from base-10 to a different base, we use powers of the base we want to switch to.
The idea is to express the given base-10 number as sums of multiples of the powers of the
base. Earlier, we had shown how to express 221 as a binary number. The next example
asks us to express it as a ternary (base-3) number.
1 3 9 27 81 243 . . .
30 31 32 33 34 35
Proceed as before, this time using the division algorithm to obtain multiples of powers of
three.
Another way to do the conversion, is to use repeated division by the base and collect the
remainders as you go along. This is how it would be used to answer Example 8.6.2:
3 221 R2
3 73 R1
3 24 R0
3 8 R2
3 2 R2
16 1251 R3
16 78 R12
16 4 R4
0
The remainder of 12 (which is a base-10 number) has to be converted to the base-16 digit
“E”, and then this gives us the answer: 1251(10) = 4E3(16) .
In base-16 notation, the expression on the right is 4·102 +E·10+3, and so 1251(10) = 4E3(16) .
Note that the final division, namely 16 4 R4 , does not give us any more infor-
0
mation.
108 CHAPTER 8. NUMBER BASES
Given positive integers a and d, there are two other integers q and r, with 0 ≤
r < d, such that
a = q · d + r.
The division algorithm just tells us that the quotient and remainder exist. It is really a bit
of a stretch to call it an algorithm, because it does not tell us how to find the quotient and
remainder. The long division algorithm, however, does describe how to find them. It is not
clear why it the word long is used, but at least it makes a distinction between the two.
The purpose of this section is to gain an understanding of the long division algorithm and
why it works. The algorithm depends upon the fact that our number system is a positional
system. It works for all bases, but we begin with base-10 numbers simply because we are very
familiar with the base-10 multiplication tables. (By the time children start long division,
they should also be quite used to the base-10 system).
Multiplication can be thought of as being repeated addition. Since division is the operation
that undoes multiplication, then division can be thought of as being repeated subtraction.
Although this does not immediately explain why the long division algorithm works, its serves
as a starting point.
Example 8.7.1. Find the quotient and remainder when 481 is 481
divided by 89 by using repeated subtraction. − 89
392
Solution. Start with 481 and subtract 89 repeatedly until the
− 89
result is less than 89 for the first time. In this case, we subtracted
303
89 five times. leaving us with 36, so
− 89
481 = 5 · 89 + 36. 214
− 89
The quotient is 5 and the remainder is 36. 125
− 89
36
Repeated subtraction is not very efficient, and it is pos-
sible to guess that the quotient is 5. This is accom-
plished by approximating the divisor and dividend by
481
simpler numbers. Note that 89 is approximately 90 and
− 5 · 89 = − 445
481 is approximately 480, so 481 ÷ 89 is approximately
36
480 ÷ 90. But 480 ÷ 90 = 48 ÷ 9 and in this case the
quotient is 5. So, we proceed as shown on the right and
get the same answer as before.
8.7. LONG DIVISION 109
About the only hard and fast rule for estimating the divisor and dividend is that the estimate
for the dividend should have at least as many zeros as does the estimate for the divisor.
Your guess may not always be accurate, but it usually provides enough information so that
you only need one additional estimate.
Example 8.7.2. Find the quotient and remainder when 179981 is divided by 25443 by
estimating the quotient.
Solution.
25443 is approximately 30000 and 179981 is approximately 179981
180000, so the quotient is probably 18 ÷ 3 or 6. Using this − 6 · 25443 = − 152658
estimate, we proceed as shown on the right. 27323
Our guess was wrong. The remainder is too large—it has to be a nonnegative number that
is less than 25443.
We have to revise the quotient estimate upwards. Since
179981
27323 is close to the divisor, it seems likely that the quotient
− 7 · 25443 = − 178101
should be 7. The result is shown on the right, and it shows
1880
that the quotient is 7 and the remainder is 1880.
Even though 6 was an intelligent guess for the quotient, the estimate was not bang on.
Sometimes it will be too high, sometimes too low, but it will at least be close to the quotient.
In the above case, the “remainder” of 27323 was close to the divisor 25443, so we know that
although the estimate of 6 is not accurate, it is within 1 of the correct quotient.
If instead of 30000 we used 20000 as the estimates for 25443
(still using 180000 to estimate 179981), then we would try
18 ÷ 2, or 9, as the quotient. When you try it, you see 179981
that the remainder is negative and numerically almost twice − 9 · 25443 = − 228987
the size of the divisor, so you would have to reduce the −49006
estimated quotient by 2.
Our objective is to find the digits x, y, and z and the number r. The three digit number is
really x · 100 + y · 10 + z, so the previous equation becomes:
5173 = (x · 100 + y · 10 + z) · 6 + r
and expanding it we get
5173 = 600 · x + 60 · y + 6 · z + r
Now, we can find x, y and z very systematically. First, we find x. Think of the previous
equation as being
5173 = 600 · x + r1 , where r1 = 60 · y + 6 · z + r.
The approach is the same for all single-digit divisors. For example, when dividing 127116
by 8, you first divide by 80000, then divide the resulting remainder by 8000, and so on
down through 800, 80, and finally 8. In fact the approach is the same when the divisor has
multiple digits. For example, to divide 230073 by 731, our successive divisors will be 73100,
7310, and finally 731. Here is how it would appear in the “long-winded” version and in a
more usual format (note that at each stage, the guess and adjust approach must be used).
314
230073 731 230073
− 3×73100 = − 219300 219300
10773 10773
− 1×7310 = − 7310 7310
3463 3463
− 4×731 = − 2924 2924
539 539
Example 8.7.3. Using the tables below, carry out the long division algorithm to find the
quotient and remainder when 12513(6) is divided by 24(6) .
× 1 2 3 4 5 + 1 2 3 4 5
1 1 2 3 4 5 1 2 3 4 5 10
2 2 4 10 12 14 2 3 4 5 10 11
3 3 10 13 20 23 3 4 5 10 11 12
4 4 12 20 24 32 4 5 10 11 12 13
5 5 14 23 32 41 5 10 11 12 13 14
8.8 Exercises
1. Explain, with diagrams, how to use a line abacus to compute 42(5) − 4(5) .
5. Using the base-6 tables from page 111, compute 532(6) × 42(6) .
6. What are the numbers, in base twelve, that precede the following. (Recall that the
digits in base twelve are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B.)
(a) 1000(12) (b) B0(12) (c) 99A(12) .
8. Using the base-5 multiplication table on page 103, find the remainder when 2340(5) is
divided by 12(5) . Use long division. Do not convert to base-10 to do the calculation.
9. Convert 274(10) to (a) base-4, (b) base-5, and (c) base-12. (Use symbols A and B for
the extra digits for base-12.)
11. The base-8 number 40401(8) happens to be a perfect square. Will it also be a perfect
square when it is converted to base-12?
13. In each case, find the base b that makes the following equation valid or else explain
why no such base exists.
(a) 54(b) = 213(4). (b) 1110(b) = 124(5). (c) 403(b) = 124(5) .
8.8. EXERCISES 113
14. For a positional number system, which of the following statements are true?
(a) A number n(b) is divisible by 5(10) if and only if its rightmost (units) digit is a 5.
(b) A number n(b) is divisible by 10(b) (that’s one-zero) if and only if it ends in a
zero.
(c) A number n(b) where b ≥ 5(10) is divisible by 5(b) if and only if its rightmost
(units) digit is a 5.
× 1 2 3 4 5 6 7 8 9 A B
1 1 2 3 4 5 6 7 8 9 A B
2 2 4 6 8 A 10 12 14 16 18 1A
3 3 6 9 10 13 16 19 20 23 26 29
4 4 8 10 14 18 20 24 28 30 34 38
5 5 A 13 18 21 26 2B 34 39 42 47
6 6 10 16 20 26 30 36 40 46 50 56
7 7 12 19 24 2B 36 41 48 53 5A 65
8 8 14 20 28 34 40 48 54 60 68 74
9 9 16 23 30 39 46 53 60 69 76 83
A A 18 26 34 42 50 5A 68 76 84 92
B B 1A 29 38 47 56 65 74 83 92 A1
8.8. EXERCISES 115
Appendix A
Proof of the the Linear Divisibility Theorem
The theorem states:
Proof. Let k be the smallest positive value of ax + by. We will prove the theorem in two
steps. First, we will show that k is at least as small as both a and b. Second we will show
that if k > d, then we can find a positive value for ax + by that is smaller than k which
contradicts the definition of k.
Step 1. k ≤ a and k ≤ b: This is clear because with x = 1 and y = 0 we get ax + by = a, so
k ≤ a. Similarly, with x = 0 and y = 1 we get ax + by = a, so k ≤ b.
Step 2. If k > d, then we can find x and y so that ax + by < k:
To see why, let us suppose that x′ and y ′ are integers for which
ax′ + by ′ = k. (8.1)
Now, k must be strictly less that the smaller of a and b. Moreover, k cannot divide both
a and b (because our assumption is that k is larger than the greatest common divisor of a
and b). So let us suppose that k does not divide b. This means that k 6= b and so by step
1, we have k < b. Then by the division algorithm,
Substitute the value of k from equation (8.1) into equation (8.2) to get:
b − (ax′ + by ′ )q = r
This implies that a(−x′ q) + b(1 + y ′ q) = r, which shows that if x = −x′ q and y = 1 − y ′ ,
we get a value of ax + by that is positive but strictly smaller than k.
This finishes the proof.
116 CHAPTER 8. NUMBER BASES
Proof. We have
p1 p2 · · · pk = q1 q2 · · · qr .
Since p1 divides the left side of the equation, it must also divide the right side of the equation,
so by the Lemma, p1 must be one of the primes q1 , . . ., qk . Remove the factor p1 from both
sides of the equation. The equality is preserved, since this amounts to dividing both sides
by p1 . Repeat this process, until we exhaust all of the prime factors on the left. Then we
must end up cancelling all prims factors on the right. But the process removes primes in
pairs, one member of the pair from each side of the equation. This shows that the two prime
factorizations must have been identical, except for the order of the factors.
As you continue travelling eastward, the time changes to 0230 Tuesday, then 0330 Tuesday,
and for your friend in Europe its much later in the morning on Tuesday. Further on, its
noon on Tuesday. In Asia its Tuesday evening, and so on.
Now, eventually we will come full circle. But something is wrong. We never cross midnight
again! so it seems that as we travel east, it remains forever Tuesday. But how can that be?
You are in Edmonton and it is Monday! There must be some place where Tuesday turns
back into Monday, and indeed there — its called the international dateline.
The international dateline is a fixed imaginary line running from the north to the south pole
through the pacific ocean and it geographically separates one day from the next. As you
cross the date line travelling from west to east, the day changes back to the previous one.
This stops the apparent contradiction.
Tuesday Monday
118 CHAPTER 8. NUMBER BASES
A history timeline
The next three pages are a time chart of some of the significant developments of our number
system alongside some selected historical events. As you can see, the development of our
number system was sporadic, and took many centuries to reach its current state. The geo-
graphical progress of so called western mathematics travelled from very ancient civilizations,
to classical Greece, then to the arabic world, and finally back to Europe. It should be men-
tioned that many civilizations had just as interesting mathematics as the Arabic/Western
world, and discovered similar or identical results without contact between the civilizations.
For example, the Chinese and Indian civilizations had independently discovered and proved
Pythagoras’ Theorem. These developments of other civilizations are not included in the
following chart, and it would be interesting to make a similar one for them.
1300 – 1450
Decimal notation used by Arabic Chaucer. Hundred year’s war. Black Death
mathematicians. Percent symbol (%) in Europe. Witch hunts begin. Death of Joan
introduced of Arc. Gutenberg invents his printing press.
Renaissance Period (1450–1600)
1450 – 1500
Positive and negative symbols (+ and −) voyages of Columbus and da Gama
used for surpluses and deficits
1500 – 1550
Euclid translated into most languages. Copernicus dies. Martin Luther’s 95 Theses.
Positive and negative symbols used to denote Da Vinci paints the Mona Lisa. Michelangelo
operations. paints the ceiling of the Sistine chapel.
Protestant reformation. Watch invented.
1550 – 1600
Zero and negative numbers used for double Growth of the merchant class and
entry bookkeeping. Equality (=) symbol international trade. Gregorian (present day)
used for the first time. Complex numbers. calendar introduced throughout Roman
Symbols for inequality (>, <). Catholic world. Elizabeth I. Shakespeare.
Magellan circumnavigates the globe.
Enlightenment Period (1600 – 1800)
1600 – 1650
Modern decimal notation introduced by Galileo imprisoned. African slaves imported
Napier. Introduction of multiplication to North America. Descartes.
symbols (× and ·) and division division
symbol (÷). Exponentiation notation (eg 35 ).
1650 – 1700
Rembrandt. Rubens. Louvre museum.
Milton’s Paradise Lost. Newton and gravity.
Plague in London. Salem witch hunts end.
1700 – 1750
The symbols for pi (π) and base of natural Kingdom of Great Britain formed. Louis
logarithm (e) introduced. Symbols for ‘not XIV dies.
equal’ (6=) etc. a/b used for fractional
notation.
1750 – 1800
Mozart. French Revolution. Plains of
Abraham. American Declaration of
independence. Cook’s voyages to British
Columbia. Rosetta Stone found.
120 CHAPTER 8. NUMBER BASES