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 :ZZ-: \Z \to \Z and the binary operations of addition and multiplication +,×:Z×ZZ+, \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 xyx - 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,cZa, 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: aa=0a - a = 0.
  • Commutative property of multiplication: ab=baa b = b a.
  • Cancellation property of multiplication: If ab=acab = ac and a0a \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, aba \mid b

Let a,bZa, b \in \Z. We say that aa divides bb, denoted by aba \mid b, if there exists an integer cZc \in \Z such that b=acb = ac.

Elementary Properties of Divisibility

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

  • 1n1 \mid n and 1n-1 \mid n.
  • 0n0 \mid n if and only if n=0n = 0.
  • If kmk \mid m and knk \mid n, then km+nk \mid m + n.
  • If kmk \mid m or knk \mid n, then kmnk \mid mn.
  • If kmk \mid m and mnm \mid n, then knk \mid n.

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

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

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

Let x,y,kZx, y, k \in \Z. We say that xx is congruent to yy modulo kk, denoted by xy(modk)x \equiv y \pmod{k}, if kxyk \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,kZx, k \in \Z. We say that xx is a quadratic residue modulo kk if there exists an integer yZy \in \Z such that xy2(modk)x \equiv y^2 \pmod{k}.

Quadratic Residues of Quadratic Forms

Theorem: Let a,b,c,k,x,yZa, b, c, k, x, y \in \Z. If kax2+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 b24acb^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 zZz \in \Z satisfying yz1(modk)yz \equiv 1 \pmod{k}. It follows that:

0=4az204az2(ax2+bxy+cy2)(modk)=4a2x2z2+4abxz+4ac=4a2x2z2+4abxz+b2(b24ac)=(2axz+b)2(b24ac) \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 b24ac(2axz+b)2(modk)b^2 - 4ac \equiv (2axz + b)^2 \pmod{k}, which shows that b24acb^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(5xz)=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 PZ[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 nNn \in \N and PZ[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 nNn \in \N. We say that a polynomial PZ[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)=ax1x2j2xkjk+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 aZa \in \Z, k,j2,,jkNk, j_2, \dots, j_k \in \N, and QZ[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 PZ[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)=ax1x2j2xkjk+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,,a1}x_{k+1}, \dots, x_n \in \{0, \dots, a - 1\}.

Definition: Divisible Variable, Occurs Divisibly

Let nNn \in \N. We say that a polynomial PZ[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 aZa \in \Z and QZ[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 PZ[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.