Basics of Number Theory
By Notes Vandar
3.1 Odd, Even and Divisibility Relationships
Understanding the properties of odd and even numbers, as well as divisibility relationships, is fundamental in number theory. Below is a breakdown of these concepts.
1. Odd and Even Numbers
- Even Numbers: An integer nn is called even if it can be expressed as n=2kn = 2k, where kk is an integer. Examples: −4,−2,0,2,4,6-4, -2, 0, 2, 4, 6.
- Odd Numbers: An integer nn is called odd if it can be expressed as n=2k+1n = 2k + 1, where kk is an integer. Examples: −3,−1,1,3,5-3, -1, 1, 3, 5.
Properties:
- Sum of Two Even Numbers: The sum of two even numbers is even.
- 2a+2b=2(a+b)2a + 2b = 2(a + b) (where a,ba, b are integers)
- Sum of Two Odd Numbers: The sum of two odd numbers is even.
- (2a+1)+(2b+1)=2(a+b+1)(2a + 1) + (2b + 1) = 2(a + b + 1)
- Sum of an Odd and an Even Number: The sum of an odd and an even number is odd.
- (2a+1)+2b=2(a+b)+1(2a + 1) + 2b = 2(a + b) + 1
- Product of Two Even Numbers: The product of two even numbers is even.
- 2a⋅2b=4ab2a \cdot 2b = 4ab
- Product of Two Odd Numbers: The product of two odd numbers is odd.
- (2a+1)(2b+1)=4ab+2a+2b+1=2(2ab+a+b)+1(2a + 1)(2b + 1) = 4ab + 2a + 2b + 1 = 2(2ab + a + b) + 1
- Product of an Odd and an Even Number: The product of an odd and an even number is even.
- (2a+1)⋅2b=2(2ab+b)(2a + 1) \cdot 2b = 2(2ab + b)
2. Divisibility Relationships
Divisibility involves determining whether one integer can be evenly divided by another. The notation a∣ba \mid b means that aa divides bb without leaving a remainder.
Key Concepts:
- Divisibility Rule:
- An integer aa divides an integer bb if there exists an integer kk such that b=akb = ak.
- Even and Odd Numbers and Divisibility:
- An even number is divisible by 22.
- An odd number is not divisible by 22.
- Divisibility by Other Numbers:
- Divisibility by 3: A number is divisible by 33 if the sum of its digits is divisible by 33.
- Divisibility by 5: A number is divisible by 55 if its last digit is 00 or 55.
- Divisibility by 10: A number is divisible by 1010 if its last digit is 00.
- Transitive Property:
- If a∣ba \mid b and b∣cb \mid c, then a∣ca \mid c.
- Greatest Common Divisor (GCD):
- The largest positive integer that divides two or more integers without leaving a remainder.
- Least Common Multiple (LCM):
- The smallest positive integer that is divisible by two or more integers.
Example Problems
- Determine if the sum of 8 and 7 is odd or even:
- 88 is even, 77 is odd.
- 8+7=158 + 7 = 15 (odd).
- Check the divisibility:
- Is 2424 divisible by 66?
- Yes, because 24=6×424 = 6 \times 4.
- Calculate GCD and LCM:
- GCD of 1212 and 1818 is 66.
- LCM of 1212 and 1818 is 3636.
3.2 The Divisibility Rules
Divisibility rules help determine whether one integer is divisible by another without performing the actual division. Here are the common divisibility rules for various integers:
1. Divisibility by 2
- Rule: A number is divisible by 22 if its last digit is even (i.e., 0,2,4,6,80, 2, 4, 6, 8).
Example:
- 146146 is divisible by 22 (last digit is 66).
- 135135 is not divisible by 22 (last digit is 55).
2. Divisibility by 3
- Rule: A number is divisible by 33 if the sum of its digits is divisible by 33.
Example:
- For 123123: 1+2+3=61 + 2 + 3 = 6 (divisible by 33). So, 123123 is divisible by 33.
- For 124124: 1+2+4=71 + 2 + 4 = 7 (not divisible by 33). So, 124124 is not divisible by 33.
3. Divisibility by 4
- Rule: A number is divisible by 44 if the last two digits form a number that is divisible by 44.
Example:
- 312312: Last two digits are 1212 (divisible by 44). So, 312312 is divisible by 44.
- 7575: Last two digits are 7575 (not divisible by 44). So, 7575 is not divisible by 44.
4. Divisibility by 5
- Rule: A number is divisible by 55 if its last digit is 00 or 55.
Example:
- 250250 (last digit 00), so 250250 is divisible by 55.
- 3434 (last digit 44), so 3434 is not divisible by 55.
5. Divisibility by 6
- Rule: A number is divisible by 66 if it is divisible by both 22 and 33.
Example:
- 1818: Last digit 88 (even) and 1+8=91 + 8 = 9 (divisible by 33). So, 1818 is divisible by 66.
- 2020: Last digit 00 (even) but 2+0=22 + 0 = 2 (not divisible by 33). So, 2020 is not divisible by 66.
6. Divisibility by 8
- Rule: A number is divisible by 88 if the last three digits form a number that is divisible by 88.
Example:
- 456456: Last three digits 456456 (divisible by 88). So, 456456 is divisible by 88.
- 12341234: Last three digits 234234 (not divisible by 88). So, 12341234 is not divisible by 88.
7. Divisibility by 9
- Rule: A number is divisible by 99 if the sum of its digits is divisible by 99.
Example:
- For 729729: 7+2+9=187 + 2 + 9 = 18 (divisible by 99). So, 729729 is divisible by 99.
- For 123123: 1+2+3=61 + 2 + 3 = 6 (not divisible by 99). So, 123123 is not divisible by 99.
8. Divisibility by 10
- Rule: A number is divisible by 1010 if its last digit is 00.
Example:
- 100100 (last digit 00), so 100100 is divisible by 1010.
- 4343 (last digit 33), so 4343 is not divisible by 1010.
9. Divisibility by 11
- Rule: A number is divisible by 1111 if the difference between the sum of its digits in odd positions and the sum of its digits in even positions is either 00 or divisible by 1111.
Example:
- For 121121:
- Odd positions: 1+1=21 + 1 = 2
- Even position: 22
- Difference: 2−2=02 – 2 = 0 (divisible by 1111). So, 121121 is divisible by 1111.
- For 1234512345:
- Odd positions: 1+3+5=91 + 3 + 5 = 9
- Even positions: 2+4=62 + 4 = 6
- Difference: 9−6=39 – 6 = 3 (not divisible by 1111). So, 1234512345 is not divisible by 1111.
3.3 The Division Algorithm’
The Division Algorithm is a fundamental principle in number theory that describes how integers can be divided by one another. It states that given any two integers aa and bb (where b>0b > 0), there exist unique integers qq (the quotient) and rr (the remainder) such that:
a=bq+ra = bq + r
where 0≤r<b0 \leq r < b.
Components of the Division Algorithm
- Dividend (aa): The number being divided.
- Divisor (bb): The number by which the dividend is divided.
- Quotient (qq): The integer result of the division.
- Remainder (rr): The part of the dividend that is left over after dividing.
Examples
Example 1: Positive Dividend and Divisor
Let’s consider a=17a = 17 and b=5b = 5.
- Perform the Division:
- When 1717 is divided by 55, the quotient qq is 33 (since 5×3=155 \times 3 = 15).
- The remainder rr is 17−15=217 – 15 = 2.
- Verification:
- According to the division algorithm: 17=5⋅3+217 = 5 \cdot 3 + 2
- The remainder 22 is less than 55, satisfying the condition 0≤r<b0 \leq r < b.
Example 2: Negative Dividend
Consider a=−9a = -9 and b=4b = 4.
- Perform the Division:
- When −9-9 is divided by 44, the quotient qq is −3-3 (since 4×−3=−124 \times -3 = -12).
- The remainder rr is −9−(−12)=3-9 – (-12) = 3.
- Verification:
- According to the division algorithm: −9=4⋅(−3)+3-9 = 4 \cdot (-3) + 3
- The remainder 33 is less than 44, satisfying the condition 0≤r<b0 \leq r < b.
Properties of the Division Algorithm
- Uniqueness: The integers qq and rr are unique for given aa and bb. That means for each pair of aa and bb, there’s only one quotient and one remainder.
- Range of the Remainder: The remainder rr is always non-negative and strictly less than the divisor bb.
Applications of the Division Algorithm
- Finding GCD: The Division Algorithm is often used in algorithms for finding the greatest common divisor (GCD) of two integers, such as the Euclidean algorithm.
- Modular Arithmetic: The concept of remainders leads to modular arithmetic, which is fundamental in computer science, cryptography, and number theory.
- Polynomial Division: The Division Algorithm can be extended to polynomials, where for any polynomial P(x)P(x) and a polynomial D(x)D(x) (where D(x)D(x) is not zero), there exist unique polynomials Q(x)Q(x) (the quotient) and R(x)R(x) (the remainder) such that:
P(x)=D(x)Q(x)+R(x)P(x) = D(x)Q(x) + R(x)where the degree of R(x)R(x) is less than the degree of D(x)D(x).
3.4 The Greatest Common Divisor (GCD) and Euclidean Algorithm
. Greatest Common Divisor (GCD)
The Greatest Common Divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder.
Notation: The GCD of integers aa and bb is often denoted as gcd(a,b)\text{gcd}(a, b).
Properties of GCD:
- If aa and bb are both zero, gcd(0,0)\text{gcd}(0, 0) is typically undefined.
- gcd(a,0)=∣a∣\text{gcd}(a, 0) = |a| for any integer aa.
- gcd(a,b)=gcd(b,a)\text{gcd}(a, b) = \text{gcd}(b, a) (commutative property).
- gcd(a,b)=gcd(a,b−ka)\text{gcd}(a, b) = \text{gcd}(a, b – ka) for any integer kk.
2. Finding the GCD: Example
Consider a=48a = 48 and b=18b = 18.
- List the Factors:
- Factors of 4848: 1,2,3,4,6,8,12,16,24,481, 2, 3, 4, 6, 8, 12, 16, 24, 48
- Factors of 1818: 1,2,3,6,9,181, 2, 3, 6, 9, 18
- Identify Common Factors:
- Common factors: 1,2,3,61, 2, 3, 6
- GCD:
- The largest common factor is 66.
- So, gcd(48,18)=6\text{gcd}(48, 18) = 6.
3. Euclidean Algorithm
The Euclidean Algorithm is a method for finding the GCD of two integers using a series of division steps. It is based on the principle that the GCD of two numbers also divides their difference.
Algorithm Steps:
- Given two integers aa and bb (with a>ba > b), divide aa by bb and find the remainder rr:
a=bq+r(0≤r<b)a = bq + r \quad (0 \leq r < b)where qq is the quotient.
- Replace aa with bb and bb with rr.
- Repeat the process until r=0r = 0. The last non-zero remainder is the GCD.
4. Example Using the Euclidean Algorithm
Let’s find the GCD of 4848 and 1818 using the Euclidean Algorithm.
- First Division:
48=18⋅2+1248 = 18 \cdot 2 + 12(Quotient q=2q = 2, Remainder r=12r = 12)
- Second Division:
18=12⋅1+618 = 12 \cdot 1 + 6(Quotient q=1q = 1, Remainder r=6r = 6)
- Third Division:
12=6⋅2+012 = 6 \cdot 2 + 0(Quotient q=2q = 2, Remainder r=0r = 0)
Since the last non-zero remainder is 66, we have:
gcd(48,18)=6\text{gcd}(48, 18) = 6
5. Properties of the Euclidean Algorithm
- Efficiency: The Euclidean algorithm is very efficient and can quickly compute the GCD even for large integers.
- Recursion: The algorithm can be expressed recursively, allowing for elegant implementations in programming.
Recursive Formulation:
gcd(a,b)={bif b=0gcd(b,amod b)otherwise\text{gcd}(a, b) = \begin{cases} b & \text{if } b = 0 \\ \text{gcd}(b, a \mod b) & \text{otherwise} \end{cases}
3.5 Different Base Number System
A number system is a way to represent numbers using a consistent set of symbols and a base. The base (or radix) indicates how many unique digits, including zero, are used to represent numbers. Here’s an overview of some common number systems:
1. Base 10 (Decimal)
- Base: 10
- Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- Description: This is the most common number system used in daily life. Each digit’s place value is a power of 1010.
Example:
- The decimal number 345345 can be expressed as: 3×102+4×101+5×100=300+40+53 \times 10^2 + 4 \times 10^1 + 5 \times 10^0 = 300 + 40 + 5
2. Base 2 (Binary)
- Base: 2
- Digits Used: 0, 1
- Description: This number system is used in digital electronics and computing. Each digit represents a power of 22.
Example:
- The binary number 10111011 can be expressed as: 1×23+0×22+1×21+1×20=8+0+2+1=11 (in decimal)1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 = 8 + 0 + 2 + 1 = 11 \text{ (in decimal)}
3. Base 8 (Octal)
- Base: 8
- Digits Used: 0, 1, 2, 3, 4, 5, 6, 7
- Description: This system is used in some computing applications and represents numbers using powers of 88.
Example:
- The octal number 2727 can be expressed as: 2×81+7×80=16+7=23 (in decimal)2 \times 8^1 + 7 \times 8^0 = 16 + 7 = 23 \text{ (in decimal)}
4. Base 16 (Hexadecimal)
- Base: 16
- Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (where A=10, B=11, …, F=15)
- Description: Commonly used in computing as a more human-readable representation of binary-coded values. Each digit represents a power of 1616.
Example:
- The hexadecimal number 2F2F can be expressed as: 2×161+15×160=32+15=47 (in decimal)2 \times 16^1 + 15 \times 16^0 = 32 + 15 = 47 \text{ (in decimal)}
5. Base 60 (Sexagesimal)
- Base: 60
- Digits Used: 0 to 59
- Description: This system is used in measuring time (seconds and minutes) and angles (degrees).
Example:
- The time 2:302:30 can be thought of as:
- 2×601+30×600=120+30=150 (in minutes)2 \times 60^1 + 30 \times 60^0 = 120 + 30 = 150 \text{ (in minutes)}
Conversion Between Bases
1. Decimal to Binary:
To convert a decimal number to binary, divide the number by 22 and record the remainder. Continue dividing the quotient until it reaches 00. The binary representation is the remainders read in reverse order.
Example: Convert 1313 to binary:
- 13÷2=613 \div 2 = 6 remainder 11
- 6÷2=36 \div 2 = 3 remainder 00
- 3÷2=13 \div 2 = 1 remainder 11
- 1÷2=01 \div 2 = 0 remainder 11
Reading in reverse: 11011101 (binary).
2. Binary to Decimal:
To convert binary to decimal, multiply each digit by its corresponding power of 22.
Example: Convert 11011101 to decimal:
- 1×23+1×22+0×21+1×20=8+4+0+1=13 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 8 + 4 + 0 + 1 = 13
3.6 Modular Arithmetic
Modular arithmetic, often referred to as “clock arithmetic,” is a system of arithmetic for integers where numbers wrap around upon reaching a certain value, called the modulus. It is particularly useful in computer science, cryptography, and number theory.
1. Definition
Given two integers aa and bb, and a positive integer nn (the modulus), we say that aa is congruent to bb modulo nn if nn divides the difference of aa and bb. This is denoted as:
a≡bmod na \equiv b \mod n
This means:
a−b=knfor some integer ka – b = kn \quad \text{for some integer } k
2. Examples of Modular Arithmetic
Example 1: Basic Congruences
- Calculate 17mod 517 \mod 5: 17÷5=3(quotient)17 \div 5 = 3 \quad \text{(quotient)} 17−5×3=17−15=217 – 5 \times 3 = 17 – 15 = 2 Thus, 17≡2mod 517 \equiv 2 \mod 5.
Example 2: Larger Numbers
- Calculate 23mod 723 \mod 7: 23÷7=3(quotient)23 \div 7 = 3 \quad \text{(quotient)} 23−7×3=23−21=223 – 7 \times 3 = 23 – 21 = 2 Thus, 23≡2mod 723 \equiv 2 \mod 7.
3. Properties of Modular Arithmetic
- Reflexivity:
a≡amod na \equiv a \mod n
- Symmetry:
a≡bmod n ⟹ b≡amod na \equiv b \mod n \implies b \equiv a \mod n
- Transitivity:
a≡bmod n and b≡cmod n ⟹ a≡cmod na \equiv b \mod n \text{ and } b \equiv c \mod n \implies a \equiv c \mod n
- Addition:
a≡bmod n and c≡dmod n ⟹ (a+c)≡(b+d)mod na \equiv b \mod n \text{ and } c \equiv d \mod n \implies (a + c) \equiv (b + d) \mod n
- Subtraction:
a≡bmod n and c≡dmod n ⟹ (a−c)≡(b−d)mod na \equiv b \mod n \text{ and } c \equiv d \mod n \implies (a – c) \equiv (b – d) \mod n
- Multiplication:
a≡bmod n and c≡dmod n ⟹ (a⋅c)≡(b⋅d)mod na \equiv b \mod n \text{ and } c \equiv d \mod n \implies (a \cdot c) \equiv (b \cdot d) \mod n
- Exponentiation:
a≡bmod n ⟹ ak≡bkmod nfor any integer ka \equiv b \mod n \implies a^k \equiv b^k \mod n \quad \text{for any integer } k
4. Applications of Modular Arithmetic
- Cryptography: Modular arithmetic is fundamental in various cryptographic algorithms, such as RSA encryption, which relies on properties of prime numbers and modular operations.
- Computer Science: Used in hashing functions, random number generation, and algorithms that require cyclical behavior (e.g., round-robin scheduling).
- Congruences: Solving problems that involve finding numbers that satisfy certain conditions, such as the Chinese Remainder Theorem.
- Clock Arithmetic: Timekeeping is a practical example of modular arithmetic where time wraps around after reaching a certain point (e.g., 12-hour clocks).
5. Solving Modular Equations
To solve equations of the form ax≡bmod nax \equiv b \mod n:
- Identify the integers aa, bb, and nn.
- Find the multiplicative inverse of aa modulo nn if aa and nn are coprime (i.e., gcd(a,n)=1\text{gcd}(a, n) = 1).
- Multiply both sides of the equation by this inverse to isolate xx.
Example: Solve 3x≡6mod 113x \equiv 6 \mod 11.
- Identify: a=3a = 3, b=6b = 6, n=11n = 11.
- Find the inverse of 3mod 113 \mod 11: The inverse is 44 (since 3⋅4≡1mod 113 \cdot 4 \equiv 1 \mod 11).
- Multiply both sides: 4⋅(3x)≡4⋅6mod 11⇒x≡24mod 11⇒x≡2mod 114 \cdot (3x) \equiv 4 \cdot 6 \mod 11 \Rightarrow x \equiv 24 \mod 11 \Rightarrow x \equiv 2 \mod 11