Skip to main content

Notes on Elementary Number Theory

David K. Zhang
Last Modified 2022-06-06

In these notes, we assume that the reader is familiar with the set of integers, denoted by Z≔{…,−2,−1,0,1,2,… }\Z \coloneqq \{ \dots, -2, -1, 0, 1, 2, \dots \}, along with the unary operation of negation −:Z→Z-: \Z \to \Z and the binary operations of addition and multiplication +,×:Z×Z→Z+, \times: \Z \times \Z \to \Z. As is usual in higher mathematics, we will not explicitly write the multiplication sign ×\times; instead, we denote the product of xx and yy simply by juxtaposition, as in xyxy. We will also write x−yx - y to abbreviate the expression x+(−y)x + (-y).

We state without proof the following facts about the arithmetic operations +,−,×+, -, \times on Z\Z. (Giving full proofs of these statements would require us to work with rigorous, axiomatic definitions of the set Z\Z and the functions ++, −-, and ×\times, which are surprisingly both difficult to construct and cumbersome to understand. We refer the interested reader to the Wikipedia article on the construction of the integers.)

Elementary Properties of Integer Arithmetic

Theorem: The following statements hold for all a,b,c∈Za, b, c \in \Z.

  • Commutative property of addition: a+b=b+aa + b = b + a.
  • Cancellation property of addition: a+b=a+ca + b = a + c if and only if b=cb = c.
  • Additive identity property: a+0=aa + 0 = a.
  • Additive inverse property: a−a=0a - a = 0.
  • Commutative property of multiplication: ab=baa b = b a.
  • Cancellation property of multiplication: If ab=acab = ac and a≠0a \ne 0, then b=cb = c.
  • Multiplicative identity property: 1a=a1a = a.
  • Zero-product property: ab=0ab = 0 if and only if a=0a = 0 or b=0b = 0.
  • Distributive property: a(b+c)=ab+aca (b + c) = ab + ac.

Definition: Divisibility, a∣ba \mid b

Let a,b∈Za, b \in \Z. We say that aa divides bb, denoted by a∣ba \mid b, if there exists an integer c∈Zc \in \Z such that b=acb = ac.

Elementary Properties of Divisibility

Theorem: The following statements hold for all k,m,n∈Zk, m, n \in \Z.

  • 1∣n1 \mid n and −1∣n-1 \mid n.
  • 0∣n0 \mid n if and only if n=0n = 0.
  • If k∣mk \mid m and k∣nk \mid n, then k∣m+nk \mid m + n.
  • If k∣mk \mid m or k∣nk \mid n, then k∣mnk \mid mn.
  • If k∣mk \mid m and m∣nm \mid n, then k∣nk \mid n.

Proof: Let k,m,n∈Zk, m, n \in \Z be given.

  • n=1n=(−1)(−n)n = 1n = (-1)(-n).
  • 0a=00a = 0 for all a∈Za \in \Z, so we can write n=0an = 0a for some a∈Za \in \Z if and only if n=0n = 0.
  • If m=akm = ak and n=bkn = bk for some a,b∈Za, b \in \Z, then m+n=(a+b)km + n = (a + b)k.
  • If m=akm = ak for some a∈Za \in \Z, then mn=(an)kmn = (an)k. Similarly, if n=bkn = bk for some b∈Zb \in \Z, then mn=(mb)kmn = (mb)k.
  • If m=akm = ak and n=bmn = bm for some a,b∈Za, b \in \Z, then n=(ab)kn = (ab)k. ∎

Definition: Modular Congruence, x≡y(modk)x \equiv y \pmod{k}

Let x,y,k∈Zx, y, k \in \Z. We say that xx is congruent to yy modulo kk, denoted by x≡y(modk)x \equiv y \pmod{k}, if k∣x−yk \mid x - y.


In this section, we will study the theory of quadratic residues, which answers the following question: when does an element of Z/pZ\Z/p\Z have a square root in Z/pZ\Z/p\Z?

Definition: Quadratic Residue

Let x,k∈Zx, k \in \Z. We say that xx is a quadratic residue modulo kk if there exists an integer y∈Zy \in \Z such that x≡y2(modk)x \equiv y^2 \pmod{k}.

Quadratic Residues of Quadratic Forms

Theorem: Let a,b,c,k,x,y∈Za, b, c, k, x, y \in \Z. If k∣ax2+bxy+cy2k \mid ax^2 + bxy + cy^2 and gcd⁡(k,x)=1\gcd(k, x) = 1 or gcd⁡(k,y)=1\gcd(k, y) = 1, then b2−4acb^2 - 4ac is a quadratic residue modulo kk.


Proof: By swapping xx and yy if necessary, we may assume without loss of generality that gcd⁡(k,y)=1\gcd(k, y) = 1. This implies that yy has a modular inverse z∈Zz \in \Z satisfying yz≡1(modk)yz \equiv 1 \pmod{k}. It follows that:

0=4az2⋅0≡4az2(ax2+bxy+cy2)(modk)=4a2x2z2+4abxz+4ac=4a2x2z2+4abxz+b2−(b2−4ac)=(2axz+b)2−(b2−4ac) \begin{aligned} 0 &= 4az^2 \cdot 0 \\ &\equiv 4az^2(ax^2 + bxy + cy^2) &\pmod{k} \\ &= 4a^2x^2z^2 + 4abxz + 4ac & \\ &= 4a^2x^2z^2 + 4abxz + b^2 - (b^2 - 4ac) & \\ &= (2axz + b)^2 - (b^2 - 4ac) & \\ \end{aligned}

Thus, we have proven b2−4ac≡(2axz+b)2(modk)b^2 - 4ac \equiv (2axz + b)^2 \pmod{k}, which shows that b2−4acb^2 - 4ac is a quadratic residue modulo kk. ∎


Definition: Diophantine Equation

A Diophantine equation is a polynomial equation with integer coefficients, in any (finite) number of variables, for which we seek integer solutions.

For example, the following equations could all be Diophantine equations (if we add the stipulation that we are looking for integer solutions):

x+y=5 x + y = 5 a2+b2=c2 a^2 + b^2 = c^2 3x2y4+10z(5−xz)=6xyz2 3x^2 y^4 + 10z(5 - xz) = 6xyz^2

However, the following equations are not considered Diophantine equations, even if we stipulate that we are only interested in integer solutions:

2x+y=31 2^x + y = 31 sin⁡(a)+exp⁡(b)=0 \sin(a) + \exp(b) = 0 14x2+πy3z=2z \frac{1}{4} x^2 + \pi y^3 z = \sqrt{2z}

Note that, by moving all terms to the left-hand side, every Diophantine equation can be written in the form

P(x1,…,xn)=0 P(x_1, \dots, x_n) = 0

for some polynomial P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n]. Unless otherwise specified, we will assume that all Diophantine equations are presented in this form.

Definition: Solution, Satisfiable, Unsatisfiable

Let n∈Nn \in \N and P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n]. A solution of the Diophantine equation P(x1,…,xn)=0P(x_1, \dots, x_n) = 0 is a point (s1,…,sn)∈Zn(s_1, \dots, s_n) \in \Z^n for which P(s1,…,sn)=0P(s_1, \dots, s_n) = 0. We say that the Diophantine equation P(x1,…,xn)=0P(x_1, \dots, x_n) = 0 is satisfiable if it has a solution in Zn\Z^n; otherwise, we say that the equation P(x1,…,xn)=0P(x_1, \dots, x_n) = 0 is unsatisfiable.

Definition: Linear Variable, Occurs Linearly

Let n∈Nn \in \N. We say that a polynomial P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n] contains a linear variable if, after some permutation of the variables x1,…,xnx_1, \dots, x_n, we can write P(x1,…,xn)P(x_1, \dots, x_n) in the form

P(x1,…,xn)=ax1x2j2⋯xkjk+Q(xk+1,…,xn) P(x_1, \dots, x_n) = a x_1 x_2^{j_2} \cdots x_k^{j_k} + Q(x_{k+1}, \dots, x_n)

for some a∈Za \in \Z, k,j2,…,jk∈Nk, j_2, \dots, j_k \in \N, and Q∈Z[xk+1,…,xn]Q \in \Z[x_{k+1}, \dots, x_n]. If this is the case, then we say that the variable x1x_1 occurs linearly in PP.

Note that this notion of “linearity” is not equivalent to x1x_1 having degree 11 in PP, which is necessary but not sufficient.

If a polynomial P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n] contains a linear variable, say x1x_1, then the corresponding Diophantine equation

P(x1,…,xn)=ax1x2j2⋯xkjk+Q(xk+1,…,xn)=0 P(x_1, \dots, x_n) = a x_1 x_2^{j_2} \cdots x_k^{j_k} + Q(x_{k+1}, \dots, x_n) = 0

is satisfiable if and only if it is possible for Q(xk+1,…,xn)Q(x_{k+1}, \dots, x_n) to be a multiple of aa. This can be tested algorithmically by computing Q(xk+1,…,xn)Q(x_{k+1}, \dots, x_n) modulo aa for all values of xk+1,…,xn∈{0,…,a−1}x_{k+1}, \dots, x_n \in \{0, \dots, a - 1\}.

Definition: Divisible Variable, Occurs Divisibly

Let n∈Nn \in \N. We say that a polynomial P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n] contains a divisible variable if, after some permutation of the variables x1,…,xnx_1, \dots, x_n, we can write P(x1,…,xn)P(x_1, \dots, x_n) in the form

P(x1,…,xn)=x1Q(x2,…,xn)+a P(x_1, \dots, x_n) = x_1 Q(x_2, \dots, x_n) + a

for some a∈Za \in \Z and Q∈Z[x2,…,xn]Q \in \Z[x_2, \dots, x_n]. If this is the case, then we say that the variable x1x_1 occurs divisibly in PP.

If a polynomial P∈Z[x1,…,xn]P \in \Z[x_1, \dots, x_n] contains a divisible variable, say x1x_1, then the corresponding Diophantine equation

P(x1,…,xn)=x1Q(x2,…,xn)+a=0 P(x_1, \dots, x_n) = x_1 Q(x_2, \dots, x_n) + a = 0

is satisfiable if and only if it is possible for Q(x2,…,xn)Q(x_2, \dots, x_n) to be a (positive or negative) divisor of aa. This reduces the original Diophantine equation P(x1,…,xn)=0P(x_1, \dots, x_n) = 0 to a finite disjunction of Diophantine equations Q(x2,…,xn)−b=0Q(x_2, \dots, x_n) - b = 0 in one fewer variable, one for each divisor bb of aa.