# CSCI 2824: Lecture 7

In this lecture we will cover:

1. Divisibility of numbers and modular arithmetic.

2. Some proofs involving divisibility.

Topics covered: Chapter 2.2 of the book.

## Proving Properties of Numbers

An integer is divisible by a non-zero integer , if can be written as for some integers and . In logic, we write:

The following concepts are all equivalent:

• is divisible by

• divides ,

• is a factor of ,

• , and

• is a multiple of .

Divisibility by has a special name: If is divisible by , we call it even, and other wise we call it odd.

Theorem -1: If are divisible by then is divisible by .

Proof

For your convenience, we split the proof step by step to make the flow of reasoning steps clear.

1. Let be any two given numbers such that are divisible by .

2. Therefore, we write , for some integer .

3. And, since is divisible by , for some integers .

4. We note that .

5. Therefore is divisible by .

Important Note

Whenever in a proof, a number can be written as , we conclude that is divisible by . Similarly, if you are told that a number is divisible by , it makes sense to write it as for some .

Theorem-2 If is divisible by and by then is divisible by .

Proof
1. Let be any given numbers such that divides and divides .

2. Therefore, we write for some integer , and

3. for some integer .

4. The number may be written as: .

5. Therefore is divisible by .

### Proofs on Consecutive Numbers

Theorem-3 The product of two consecutive numbers is always even.

Proof
1. Let be any given number and be the next consecutive numbers.

2. We will show that is even.

3. We note that there are two cases based on whether is odd or even.

• Case-1: is odd. In this case, we have being even. Therefore = which is EVEN.

• Case-2: is even. In this case is even too.

1. In either case, is even. QED.

## Proofs by Case-Splitting

A number is a perfect square if for some . Examples of perfect squares include and so on.

Theorem-4 If a perfect square is even, then it is divisible by .

Proof
1. Let be any given perfect square that is even.

2. Since is a perfect square, can be written as for some .

3. We consider two cases based on whether is odd or even.

• Case-1: is odd.

1. In this case, we know that is a product of two odd numbers is odd.

2. However, this conflicts with our assumption that is even.

3. Therefore, this case can never happen.

• Case-2: is even.

1. In this case, for some integer .

2. is divisible by .

Therefore, we conclude that must be divisible by based on case 2, which is the only case that can happen.

QED.

There are other ways of proving this theorem that we will revisit when we study proofs by contradiction.

## Modular Arithmetic

We have been using the “mod” operator so far in some proofs. Let us study the properties of the “mod” operator in more detail.

Modulo Operator

Let be some integer. For a integer say that iff can be written as where is the quotient and is the remainder when is divided by .

Let us look at examples.

Example

We write . Since .

As a convention, the result of a modulo operation is always between and .

Also, we always apply over positive, but can be positive or negative What is ? We write . Therefore .

Note:

• is undefined.

• We will not bother defining for negative .

• We will only apply mod to integers for now. It can be defined on reals but that is not very important to us now.

Odd number: A number is odd iff .

We can distribute over .

Secondly,

Let us prove these facts:

Theorem: Suppose number can be written as for . It follows that .

Proof

Let . Therefore for some . Note that .

Therefore can be written as for . We conclude therefore that is the quotient when is divided by and is the remainder. Therefore,

QED.

Theorem: For any integers and integer , the following statement is true:

Proof

Let us assume and . Therefore, we may write as for some . We also write as for some .

Therefore, .

QED.

Similarly, we can prove that modulo operator distributes over multiplication.

Theorem For any integers , and natural number , the following statement is true:

Proof

Let and , where and . We can write

and .

Therefore, using the distributivity of modulo operator over addition (proved in the previous theorem),

Therefore,

This shows that

(QED)

### Computing modulo

Let us try some interesting problems involving modulo arithmetic.

#### Example 1

For instance, let us try and compute for various values of .

• .

As you can see the pattern that emerges is

• if is even.

• if is odd.

#### Example 2

We know is a really large number. The question is very simple. Suppose we wrote in hexadecimal, what would the last digit be?

In general, the last digit of a number in hexadecimal is simply computed by finding out . So what is ?

, because for some .

#### Example 3

Find the smallest natural number that leaves a remainder of when divided by and a remainder of when divided by .

Let our mystery number be . We require . Therefore, for some .

Now consider .

Therefore, we note that or in other words and for some .

Let us choose to yield and therefore .

The smallest number is indeed .

We will examine more problems of this sort when we look at the Chinese remainder theorem.