• No results found

The division algorithm and number bases

In document SQA Advanced Higher Mathematics Unit 3 (Page 187-193)

n r = 1 (2r - 1) = n2

Q30: Prove that if a0 and bc then abac

Q31: Prove directly using the results of the summations to n terms of r, r2and r3 that n

r = 1

r(r + 1)(r + 2) = n(n + 1)(n + 2)(n + 3)4

Extra Help: Direct proof

An online exercise is provided to help you if you require additional assistance with this material, or would like to revise this subject.

5.7

The division algorithm and number bases

5.7.1 The division algorithm

Æ

Learning Objective

Use the division algorithm and produce the proof

At this point it is convenient to introduce an extra piece of symbolism. Consider the equation 6 = 32. A less precise way of stating this could be 2 divides 6 or 3 divides

6. For ease this is commonly written as 26 or 36.

This symbolism not only is a neat shorthand way of expressing division but also has another advantage over the words: when written in this form, ab, then a is assumed 0 provided that b 0. If, in fact, a does not divide b this can be shown as

Obviously in the integers, 37 but to cope with this most people are taught at an early

age to write this sum with a remainder such that 7 = 23 + 1

In general terms if there are two integers a and b (ab) where ba then this can written

as a = qb + r where q and r are also integers. It is this type of division which forms the basis of the division algorithm.

There are two forms of the algorithm which differ only in the condition placed on the remainder r.

The original form of the division algorithm has the condition 0 r b where b is the

divisor.

The general form of the division algorithm replaces this condition with 0r band

is given in the definition which follows.

Division algorithm

If a and b are integers, b 0, then there are unique integers q and r such that

a = qb + r where 0rb

As in any division, q is the quotient and r is the remainder.

which states that every nonempty set S of nonnegative integers contains a least element. The proof is shown for the original form with 0rb

Proof of the division algorithm

Let S be the set {a - xb such that xand a - xb0}

The steps in the proof are:

• show that the set S is nonempty. • show that S contains a least element. • show that rb

• show the uniqueness of q and r

• S is nonempty: by the condition on b in the definition of the division algorithm b1 soaba

Thus a - (-a)b = a +aba +a0

and so if x = -a, a - xbS

• S contains a least element: by the well ordering principle, since S is nonempty, it contains a least element say r such that r = a - qb for some integer q and r0

• rb: assume rb then

a - (q + 1)b = a - qb - b = r - b0

but r - br which contradicts the fact that r is chosen as the least element in S.

The original assumption is incorrect and rb

• q and r are unique: suppose a = bq1+ r1and a = bq2+ r2with the conditions 0r1b and 0r2b

So bq1+ r1= bq2+ r2 b ( q1- q2) = r2- r1

But then the left hand side is a multiple of b and the condition on r1and r2dictates that

-br2- r1b

But the only multiple of b between -b and b is zero. Hence r2- r1= 0 r2= r1and b ( q1- q2) = 0 q1= q2

Division algorithm example

5 min

There is an example on the web of this algorithm. Here are two examples of the division algorithm.

Examples

1. Find q and r by the division algorithm, such that a = qb + r

5.7. THE DIVISION ALGORITHM AND NUMBER BASES 183

Answer:

-29 = -5 . 6 + 1 where a = -29, q = -5, b = 6 and r = 1

2. Find q and r by the division algorithm, such that a = qb + r

where a = 33 and b = 4 Answer:

33 = 8 . 4 + 1 where a = 33, q = 8, b = 4 and r = 1

Note the convention of expressing the calculation using a dot. This is an important and useful approach to adopt with both the division and the Euclidean algorithm.

At first glance, the subtleties of the division algorithm may go unnoticed. In example one note that, in keeping with the division algorithm r is positive. So -29 = -4 . 6 - 5 is not a solution.

In example two, 33 = 7 . 4 + 5 is not a solution in keeping with the division algorithm since rb (54).

Division algorithm exercise

5 min

There is another exercise on the web for you to try if you wish.

Q32: Using the division algorithm find q and r such that a = qb + r where

1. a = -42 and b = 5 2. a = 25 and b = -7 3. a = 14 and b = -9

Q33: Using the division algorithm find q and r such that a = qb + r where

1. a = -1 and b = 3 2. a = 4 and b = 9 3. a = -12 and b = 3

It may not have been apparent at the time but the division algorithm has been used in some form in many of the proofs in the previous sections. The application of the algorithm produces the integer forms such as 2k for an even integer and 2k + 1 for an odd integer.

It is the condition 0rbthat is used to great effect in determining the form that a

particular number can take.

Example Suppose that b = 4 then in the equation a = qb + r, the division algorithm

shows that a will have one of the following forms • 4k where r = 0 with q = k

• 4k + 1 where r = 1 • 4k + 2 where r = 2

• 4k + 3 where r = 3

In all cases r satisifes the condition 0r b

Q34: Determine all the even forms of a number on division by 8

These types of integer forms are the basis of many proofs.

5.7.2 Number bases

Æ

Learning Objective

Convert decimal integers into other number bases such as binary, octal or hexadecimal

The division algorithm is a simple method to use to convert integers to different number bases. The standard number base used in mathematics is 10, that is the place values of a number are powers of 10. The decimal system, as it is known, has the structure as shown.

A number can be converted and expressed in a different number system using any integer as a number base, but three of the most useful are the bases 2, 8 and 16. These are called binary, octal and hexadecimal respectively and are used extensively in subjects such as computing and electronics.

Binary

In the decimal number system there are ten digits, 0 to 9. In binary, which has a base of two, there are just two digits, 0 and 1. The place values in a binary system are all powers of 2 and another diagram showing these place values can be constructed.

The diagram shows how easy it is to find the decimal form of a binary number. 11010 is 1 x 24+ 1 x 23+ 1 x 21= 26

5.7. THE DIVISION ALGORITHM AND NUMBER BASES 185

The division algorithm is used to find the binary form from the decimal form and is best described by an example.

Example Convert 30 into a binary number.

Answer:

Use the algorithm repeatedly for a = qb + r; in the first case a = 30 and b = 2 (for binary); then a = 15 and b = 2 and so on until the algorithm can be taken no further.

30 = 15 . 2 + 0 15 = 7 . 2 + 1 7 = 3 . 2 + 1 3 = 1 . 2 + 1 1 = 0 . 2 + 1

The binary number is taken directly from the remainders in this calculation by reading them off upwards and is 11110

Octal

This is just as straightforward but uses the powers of 8 as place values. The octal system only uses the eight integers 0 to 7

Example Convert the number 53467 into octal form.

Answer:

In this case the equation a = qb + r has a = 53467 and b = 8 53467 = 6683 . 8 + 3 6683 = 835 . 8 + 3 835 = 104 . 8 + 3 104 = 13 . 8 + 0 13 = 1 . 8 + 5 1 = 0 . 8 + 1

Again the octal number is taken straight from the remainders in the calculation by reading upwards and is 150333

This can be checked in reverse as 3 x 1 + 3 x 8 + 3 x 82+ 5 x 84+1 x 85= 53467

Hexadecimal

This system uses base 16 and has sixteen ’digits’. Since each digit can only occupy one place value a slight modification is needed. In this case the system uses integers 0 to 9 and then A for 10, B for 11, C for 12, D for 13, E for 14 and F for 15

Example Find the hexadecimal form of the number 298047

Answer:

Repeated application of the division algorithm with b = 16 gives 298047 = 18627 . 16 + 15 note: 15F

18627 = 1164 . 16 + 3

1164 = 72 . 16 + 12 note: 12C

72 = 4 . 16 + 8 4 = 0 . 16 + 4

The hexadecimal number read upwards is 48C3F

Number bases exercise

10 min

There is a web exercise for you to try if you prefer.

Q35: Convert the following numbers into binary numbers:

a) 332 b) 501 c) 43 d) 63

Q36: Find the octal forms of the following numbers:

a) 347 b) 2924 c) 3012 d) 534

Q37: Find the hexadecimal equivalent numbers to

a) 4014 b) 364 c) 2179 d) 5034

’Mathematics is the queen of sciences and number theory is the queen of mathematics.’ Carl Gauss 1777 - 1855

In document SQA Advanced Higher Mathematics Unit 3 (Page 187-193)