Division Algorithm
Division Algorithm
IVISION ALGORITHM
What is “Algorithm”?
An ALGORITHM is a process or set of rules to be followed in calculations or other
problem-solving operations, especially by a computer". In mathematics and computer science, an
algorithm is a self-contained step-by-step set of operations to be performed. Algorithms perform
calculation, data processing, and/or automated reasoning tasks.
The English word 'algorithm' comes from Medieval Latin word algorism and the Greek
word "arithmos". The word 'algorism' (and therefore, the derived word 'algorithm') comes from
Al-Khwārizmī, a Persian mathematician, astronomer, geographer, and scholar.
Definition:
Let a and b be two integers with b > 0 or b 0. Then there exist unique integers q, r such
that a = bq + r, where 0 ≤ r < b or 0 ≤ r < |b|. The integer q is called the quotient and r, the
remainder while a is the dividend and b is the divisor.
Proof:
Without loss of generality, assume that a≥0 and consider the set S = {a+bx : x ∈ Z} N.
Clearly, a ∈ S and hence S is a non-empty subset of N. Therefore, by Well-Ordering Principle, S
contains its least element, say s0. That is, there exists x0 ∈ Z, such that s0 = a + bx0. We claim that
0 ≤ s0 < b. As s0 ∈ S ⊂ N, one has s0 ≥ 0. So, let if possible assume that s0 ≥ b. This implies that s0
− b ≥ 0 and hence s0 − b = a + b(x0 − 1) ∈ S, a contradiction to the assumption that s0 was the
least element of S. Hence, we have shown the existence of integers q, r such that a = qb +r with 0
≤ r < b.
Uniqueness:
Let if possible q1, q2, r1 and r2 be integers with a = q1b + r1 = q2b + r2, with 0 ≤ r1 ≤ r2 < b.
Therefore, r1 − r2 ≥ 0 and thus, 0 ≤ (q1 − q2)b = r2 − r1 < b. Hence, we have obtained a multiple of
b that is strictly less than b. But this can happen only if the multiple is 0. That is, 0 = (q 1 − q2)b =
r2 − r1. Thus, one obtains r1 = r2 and q1 = q2 and the proof of uniqueness is complete.
Corollary. Let a, b Z, b 0. There exist unique integers q and r such that a = bq + r
wher
e
0 r < |b|.
Proof:
Examples:
1. Write 10 in a form of a = bq + r.
3
divisor dividend
remainder
Using again on what so called a long division, we could determine the quotient as well
as its remainder. Remember on what you have learned in performing long division when
you were in your senior high school.
quotient
divisor dividend
remainder
On this example you will notice that r = -3 is not on the range of 0 to |b|. Although our
solution is correct but still we could not say that the r here is -3 since it does not follow the
definition of DA. So what are we going to do is to follow the DA by trying a trial and error
method. Remember that a = bq + r. So;
-15 = (4)(q) + r
- 15 = (4)(-3) + (-3) correct but r is not on the range of0 to |b|.
How about if:
-15 = (4)(-4) + (1)
Here, a = -15, b = 4, q = -4 and r = 1 which is a correct equation and r = 1 follows the range of 0
to |b|. Therefore, the value of q is -4 and the value of r is 1.
Example 3. Proving.
a) Prove that the square of an integer has a remainder of 0 or 1 when divided by 4.
Proof:
1. Assume that x be an integer so x Z.
2. By definition of division algorithm, x can be expressed in two cases such as x = 2a (even) and
x = 2a + 1 (odd).
3. Now, x2 = (2a)2 and x2 = (2a + 1)2. So, x2 = 4a2 and x2 = 4a2 + 4a +1. Let a2 = k then x2 = 4k
and it could be written in a form of x2 = 4k + 0 and for x2 = 4a2 + 4a + 1 = 4(a2 + a) + 1 for a2 + a
=k thus it could be written in a form of x2 = 4k + 1. Hence by definition of division algorithm
that is a = bq + r, it is clearly seen that b = 4 which is divisor while r = 0 and r = 1.
4. Therefore, the square of an integer has a remainder of 0 or 1 when divided by 4.
b) Prove that if a is an odd integer, then a2 has the form of 8k + 1 for some k Z.
Proof:
1.Assume that a is an odd integer.
2. By definition of division algorithm with b = 2, it implies that a = 2q + 0 (eq.1) or a = 2q + 1
(eq. 2). Noticing that eq. 2 gives that a is an odd.
3. So, we can say that a = 2q + 1 and we need to show that a2 is in the form of 8k + 1. Now, a2 =
(2q + 1)2 = 4q2 + 4q + 1 = 4(q2+q) + 1. Recall that if q is odd then q2 is also odd and so as the sum
of q2 and q that is q2 + q is even.
4.On the other hand, if q is even then q2 is also even and so as q + q2 is also even.
6. Therefore, a2 = 4(2k) + 1 = 8k + 1.
b) Prove that “Every perfect square is either a multiple of 4 or of the form 4q + 1 for
some integer q.”