CHAP. XII] PELL EQUATION, ax 2 -\-bx-\- . =D. 365 



seek an integer X for which X 2 =A" (mod 8}. First, let 6 divide A'. Then 

 by (15), 6 divides a. Since k' has no divisor in common with B, which has 

 no square factor, and hence is prime to 0, we can find integers n, p such that 

 k(3 = nk'pd. Hence 



*=Ak* (mod 6), 



^A" (mod 6). 



Second, let 6 be not a divisor of A' and hence not of 0'. We may set 

 a' = np'k f -p8. Then 



Q=A ff k fZ (^-A r )^A"^V-a f2 =^V(A ff -n^ (mode}. 



The preceding result leads to the theorem: The equation x 1 By* = A is 

 solvable in integers if A and B are quadratic residues of each other, and if, 

 in the first transformed equation x 2 By- = A', A' is a quadratic residue of B. 

 We readily deduce the more elegant theorem: If each of the positive 

 numbers a, b, c has no square factor and if no two have a common factor and 

 if there exist integers X, p, v such that 



b cv z a 



c a ' 



are all integers, then ax- -{-by- = cz 2 has integral solutions not all zero; if the 

 three conditions are not all satisfied there are no integral solutions. Apply- 

 ing to (cz) 2 bcy- = acx 2 the earlier theorem, we have the conditions a 2 =bc 

 (mod ac), /3 2 ^ac (mod be), (3' 2 = A' (mod fee). Set a = c/*, & = cv. Then 

 the first two give c^^b (mod a), cv 2 =a (mod &). By (15i), c/j? b = aA'k 2 , 

 while ak 2 is prime to be. Hence the third condition becomes ak 2 (3 f2 = cn 2 b 

 (mod be). This will hold if aX 2 +6 = (mod c) is solvable. For, it is solvable 

 for f3' modulo b since cv z k s p' 2 = cp* (mod b) is solvable for (3'. 



Legendre 88 proved that 3- a?/ 2 = 1 has integral solutions if a is a prime 

 4n+l. Lagrange 74 had stated that he was not certain of a converse that, 

 if a is a sum of two squares, every number x 2 ay 2 is also of the form 

 a>y\ x\', Legendre noted that this is true if a is a prime, but fails for 

 a = 2-17, 5-41, 13-17. If a is a prime 8n+3, ax 2 y 2 = 2 is solvable. If a 

 is a prime Sn 1, y 2 ax* = 2 is solvable. While each of the preceding three 

 theorems was here treated separately, Legendre, in ed. 2, 1808, 54-60, first 

 gave a preliminary discussion applicable to all the cases. Although he 

 took A to be a prime, it suffices [Dirichlet 108 ] to assume that A is positive 

 and has no square factor. Let p, q be the least positive integral solutions 

 of p 2 Aq z = l. The g.c.d. of p 1 and p+1 is/=l or 2. Hence 



p+l=fMg 2 , p-l=fNh 2 , 



where MN = A, fgh-q. By subtraction, 2 =/Mg 2 fNh?. We must take 

 for M, N the various pairs of factors (including unity) of A. Let A be 

 a prime. The case 2 = 2g 2 2Ah 2 is excluded since h<q, g<p. Let A be 

 a prime 4n+l. Then in 2 = Ag 2 h 2 and 2 = g 2 Ah 2 , g and h are not both 



88 Mem. Acad. Sc. Paris, 1785, 549-551; ThSorie des nombres, 1798, 65-67; ed. 3, 1, 1830 

 64-71; Maser, I, 65-72. 



