# Pythagorean triples with additional parameters

I want to find solution in $\mathbb{Z}$ to the following quadratic Diophantene equation:

$$na^2 + kb^2 = c^2$$

where $n,k,a,b,c \in \mathbb{Z}$, $n,k > 0$ and $(n,k) = 1$

I know that for some this won't work for all values of $n$ and $k$ that satisfy the upper condition, but anyone know what will be the condition, so the Diophantene equation will have integer solution.

My second question is: "Let the equation have integer solution for some values of $n$ and $k$, is there infinite amount of them or their numbers is finite?"

And my third and last question is how to solve this type of equation. I'll give you one specific example:

$$19a^2 + 5b^2 = c^2$$

I don't know whether this equation has integer solution, but I hope it have because I found it in a book and it says: "Solve this equation in $\mathbb{Z}$". And if there is a infinite amount of solution is there any general formula to generate them?

I decided to try using congruence, because I suspect there is a "by-the-book" way to solve this, so we must make some restriction, but I didn't make a progress.

As I said I suspect there is a "by-the-book" way to solve this type of equation, but any method (e.g. congruence relations) would be helpful.

• You can do this yourself. Start with the rational point $\left( \frac{2}{11}, \frac{3}{11} \right)$ on the ellipse $19 x^2 + 5 y^2 = 1.$ draw lines of rational slope through that base point; see math.stackexchange.com/questions/249735/… for an example of the method. Sep 4, 2013 at 1:58
• I edited in a second formula that gives the primitive solutions with $c$ even and $a$ odd. Sep 4, 2013 at 18:35

For $$19 a^2 + 5 b^2 = c^2,$$ there are infinitely many.

Let $u,v$ be any integers, then take $$a = 2 u^2 + 2 u v - 2 v^2, \; \; b = u^2 - 8 u v - 3 v^2, \; \; c = 9 u^2 + 4 u v + 11 v^2.$$ If $\gcd(u,v) = 1$ and $u,v$ are not both odd, then $a,b,c$ might be relatively prime.

To get both $a,b$ odd while $c$ is the one that comes out even, $$a = u^2 + 4 u v - v^2, \; \; b = -5u^2 + 4 u v + 3 v^2, \; \; c = 12 u^2 - 2 u v + 8 v^2.$$

Those two recipes together give you all primitive solutions, that is $\gcd(a,b,c) = 1.$ To get other solutions, multiply through by a number. For example, these recipes do not give $a=14,b=21,c=77.$ However, they do give $a=2,b=3,c=11,$ then you multiply all by $7.$

The essential condition is that your form lie in the principal genus. The form $\langle 5,0,19 \rangle$ is indeed in the principal genus, of binary quadratic forms, for discriminant $-380.$ In the class group, it is the square of $\langle 9,4,11 \rangle$ and the square of $\langle 9,-4,11 \rangle.$ I learned from a large number of books; I recommend Binary Quadratic Forms by Duncan A. Buell, Binary Quadratic Forms by Buchmann and Vollmer, Primes of the Form $x^2 + n y^2$ by David A. Cox. Buell's book gives careful algorithms for composition, which is the topic here. Indeed, let's display that, it is how I solved the problem, $$\langle 9,4,11 \rangle^2 = \langle 5,0,19 \rangle$$ in the group of equivalence classes of positive (primitive) forms of this discriminant.

I did not initially notice that there needed to be a way to generate primitive solutions with $a$ odd and $c$ even. I fiddled a bit, the result uses the "imprimitive" form $\langle 8,2,12 \rangle$ near the beginning of the output below. The class number is $8.$ There are four classes in the principal genus, the list below called "squares."

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$./classGroup Absolute value of discriminant? 380 Impr 2 2 48 Impr 4 2 24 Impr 6 2 16 Impr 8 2 12 Impr 10 10 12 class number 8 all ( 1, 0, 95) ( 3, -2, 32) ( 3, 2, 32) ( 5, 0, 19) ( 8, -6, 13) ( 8, 6, 13) ( 9, -4, 11) ( 9, 4, 11) squares ( 1, 0, 95) ( 5, 0, 19) ( 9, -4, 11) ( 9, 4, 11) Discriminant -380 h : 8 Squares : 4 jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Anyway, easy enough to print out just the PRIMITIVE solutions. I took a,b positive and up to 1100. I had to repeat the value of c as both the first and fourth column, to allow the computer to sort by size of c without extra work on my part.

19 a^2 + 5 b^2 = c^2

       c           a           b           c =  Factored
8           1           3           8 = 2^3
9           2           1           9 = 3^2
11           2           3          11 = 11
12           1           5          12 = 2^2 * 3
39           2          17          39 = 3 * 13
48          11           1          48 = 2^4 * 3
52          11           9          52 = 2^2 * 13
61           2          27          61 = 61
101           2          45         101 = 101
108          19          31         108 = 2^2 * 3^3
111          22          25         111 = 3 * 37
128          29           9         128 = 2^7
132           1          59         132 = 2^2 * 3 * 11
132          29          17         132 = 2^2 * 3 * 11
139          22          45         139 = 139
148          31          27         148 = 2^2 * 37
149          22          51         149 = 149
159           2          71         159 = 3 * 53
169          38          15         169 = 13^2
192          31          61         192 = 2^6 * 3
201          22          79         201 = 3 * 67
208           1          93         208 = 2^4 * 13
212          41          51         212 = 2^2 * 53
229          22          93         229 = 229
268          61          15         268 = 2^2 * 67
271          62           9         271 = 271
288          11         127         288 = 2^5 * 3^2
288          41         101         288 = 2^5 * 3^2
291          38         107         291 = 3 * 97
309          62          67         309 = 3 * 103
311          58          81         311 = 311
312          59          79         312 = 2^3 * 3 * 13
312          61          73         312 = 2^3 * 3 * 13
321          22         137         321 = 3 * 107
339          58         101         339 = 3 * 113
351          22         151         351 = 3^3 * 13
352          19         153         352 = 2^5 * 11
352          71          75         352 = 2^5 * 11
359          82          15         359 = 359
381          82          59         381 = 3 * 127
388          89           3         388 = 2^2 * 97
412          11         183         412 = 2^2 * 103
428          59         153         428 = 2^2 * 107
429          58         155         429 = 3 * 11 * 13
429          62         149         429 = 3 * 11 * 13
432          89          85         432 = 2^4 * 3^3
452          11         201         452 = 2^2 * 113
468         101          71         468 = 2^2 * 3^2 * 13
468          71         157         468 = 2^2 * 3^2 * 13
479          38         201         479 = 479
481          58         183         481 = 13 * 37
499          22         219         499 = 499
501          82         157         501 = 3 * 167
508          31         219         508 = 2^2 * 127
519         118          31         519 = 3 * 173
528         109         103         528 = 2^4 * 3 * 11
528          79         179         528 = 2^4 * 3 * 11
541         118          75         541 = 541
571         122          93         571 = 571
572         131          15         572 = 2^2 * 11 * 13
572          41         243         572 = 2^2 * 11 * 13
579          62         229         579 = 3 * 193
592         101         177         592 = 2^4 * 37
619         142           3         619 = 619
631          62         255         631 = 631
648          11         289         648 = 2^3 * 3^4
648         131         137         648 = 2^3 * 3^4
668         151          51         668 = 2^2 * 167
669          58         277         669 = 3 * 223
681         142         127         681 = 3 * 227
689         158           9         689 = 13 * 53
691           2         309         691 = 691
692         109         225         692 = 2^2 * 173
701         118         213         701 = 701
719          82         279         719 = 719
729         122         223         729 = 3^6
732         121         227         732 = 2^2 * 3 * 61
732         149         151         732 = 2^2 * 3 * 61
761          58         321         761 = 761
768          79         307         768 = 2^8 * 3
769         158         153         769 = 769
771         158         155         771 = 3 * 257
772          79         309         772 = 2^2 * 193
792         151         197         792 = 2^3 * 3^2 * 11
792         181          31         792 = 2^3 * 3^2 * 11
792          31         349         792 = 2^3 * 3^2 * 11
792          59         335         792 = 2^3 * 3^2 * 11
832         139         255         832 = 2^6 * 13
848          29         375         848 = 2^4 * 53
871         178         177         871 = 13 * 67
879         122         313         879 = 3 * 293
881          62         375         881 = 881
888         199          85         888 = 2^3 * 3 * 37
888          41         389         888 = 2^3 * 3 * 37
891         202          61         891 = 3^4 * 11
891          82         365         891 = 3^4 * 11
892         199          93         892 = 2^2 * 223
908         181         201         908 = 2^2 * 227
921         142         305         921 = 3 * 307
951         218          17         951 = 3 * 317
968         149         321         968 = 2^3 * 11^2
968         211         135         968 = 2^3 * 11^2
972          29         431         972 = 2^2 * 3^5
999         118         383         999 = 3^3 * 37
1011         158         331        1011 = 3 * 337
1028         209         213        1028 = 2^2 * 257
1031          58         447        1031 = 1031
1048         121         405        1048 = 2^3 * 131
1048         239          51        1048 = 2^3 * 131
1049         202         255        1049 = 1049
1061         242          51        1061 = 1061
1069         218         219        1069 = 1069
1072          71         459        1072 = 2^4 * 67
1089         122         425        1089 = 3^2 * 11^2
1089           2         487        1089 = 3^2 * 11^2
1119         242         167        1119 = 3 * 373
1149         178         379        1149 = 3 * 383
1172          79         501        1172 = 2^2 * 293
1179         178         397        1179 = 3^2 * 131
1179          58         515        1179 = 3^2 * 131
1188         139         457        1188 = 2^2 * 3^3 * 11
1188         191         379        1188 = 2^2 * 3^3 * 11
1212         211         353        1212 = 2^2 * 3 * 101
1212         239         277        1212 = 2^2 * 3 * 101
1221         278          67        1221 = 3 * 11 * 37
1221          38         541        1221 = 3 * 11 * 37
1228          59         537        1228 = 2^2 * 307
1248         229         335        1248 = 2^5 * 3 * 13
1248         281         107        1248 = 2^5 * 3 * 13
1259         262         237        1259 = 1259
1261         242         309        1261 = 13 * 97
1268         179         447        1268 = 2^2 * 317
1272         209         397        1272 = 2^3 * 3 * 53
1272         271         211        1272 = 2^3 * 3 * 53
1279         278         183        1279 = 1279
1299         298           5        1299 = 3 * 433
1301         122         531        1301 = 1301
1331         118         549        1331 = 11^3
1332         121         547        1332 = 2^2 * 3^2 * 37
1332          29         593        1332 = 2^2 * 3^2 * 37
1339         142         531        1339 = 13 * 103
1348          61         591        1348 = 2^2 * 337
1369          82         591        1369 = 37^2
1391         302         201        1391 = 13 * 107
1431         142         577        1431 = 3^3 * 53
1441         298         279        1441 = 11 * 131
1441          62         633        1441 = 11 * 131
1452         269         383        1452 = 2^2 * 3 * 11^2
1452         331          73        1452 = 2^2 * 3 * 11^2
1461         278         365        1461 = 3 * 487
1469         218         501        1469 = 13 * 113
1489         202         537        1489 = 1489
1492         281         381        1492 = 2^2 * 373
1499          22         669        1499 = 1499
1528          29         681        1528 = 2^3 * 191
1528         331         225        1528 = 2^3 * 191
1532         349          81        1532 = 2^2 * 383
1552         139         639        1552 = 2^4 * 97
1569         358          73        1569 = 3 * 523
1572         241         523        1572 = 2^2 * 3 * 131
1572         359          67        1572 = 2^2 * 3 * 131
1592          19         711        1592 = 2^3 * 199
1592         341         255        1592 = 2^3 * 199
1608         251         527        1608 = 2^3 * 3 * 67
1608         349         233        1608 = 2^3 * 3 * 67
1628         179         639        1628 = 2^2 * 11 * 37
1628         271         501        1628 = 2^2 * 11 * 37
1641         262         527        1641 = 3 * 547
1648         361         219        1648 = 2^4 * 103
1651         122         699        1651 = 13 * 127
1668         379         103        1668 = 2^2 * 3 * 139
1668          71         733        1668 = 2^2 * 3 * 139
1669         382          51        1669 = 1669
1689         358         289        1689 = 3 * 563
1712         191         669        1712 = 2^4 * 107
1719         242         607        1719 = 3^2 * 191
1719         362         305        1719 = 3^2 * 191
1721         178         687        1721 = 1721
1728         109         743        1728 = 2^6 * 3^3
1732         229         633        1732 = 2^2 * 433
1749         178         701        1749 = 3 * 11 * 53
1749         302         515        1749 = 3 * 11 * 53
1759         202         681        1759 = 1759
1788         101         775        1788 = 2^2 * 3 * 149
1788         409          61        1788 = 2^2 * 3 * 149
1791         262         617        1791 = 3^2 * 199
1791         382         295        1791 = 3^2 * 199
1808         359         405        1808 = 2^4 * 113
1809           2         809        1809 = 3^3 * 67
1811         358         411        1811 = 1811
1821          38         811        1821 = 3 * 607
1831         418          81        1831 = 1831
1871         422         153        1871 = 1871
1872         179         761        1872 = 2^4 * 3^2 * 13
1872          31         835        1872 = 2^4 * 3^2 * 13
1908         341         535        1908 = 2^2 * 3^2 * 53
1908         431         149        1908 = 2^2 * 3^2 * 53
1912         311         603        1912 = 2^3 * 239
1912         409         309        1912 = 2^3 * 239
1948         419         303        1948 = 2^2 * 487
1949         382         453        1949 = 1949
1952         379         465        1952 = 2^5 * 61
1952         431         237        1952 = 2^5 * 61
1961         298         657        1961 = 37 * 53
1999         278         711        1999 = 1999
2008         269         729        2008 = 2^3 * 251
2008         451         183        2008 = 2^3 * 251
2019         418         389        2019 = 3 * 673
2028         191         827        2028 = 2^2 * 3 * 13^2
2028         341         617        2028 = 2^2 * 3 * 13^2
2031         458         167        2031 = 3 * 677
2032         461         135        2032 = 2^4 * 127
2048         121         885        2048 = 2^11
2049         118         887        2049 = 3 * 683
2069         458         243        2069 = 2069
2092         319         699        2092 = 2^2 * 523
2099         218         837        2099 = 2099
2101         122         909        2101 = 11 * 191
2101         482           3        2101 = 11 * 191
2112         449         355        2112 = 2^6 * 3 * 11
2112          61         937        2112 = 2^6 * 3 * 11
2151         218         863        2151 = 3^2 * 239
2151          22         961        2151 = 3^2 * 239
2171         358         675        2171 = 13 * 167
2188          89         963        2188 = 2^2 * 547
2189         142         939        2189 = 11 * 199
2189         502          27        2189 = 11 * 199
2211         202         907        2211 = 3 * 11 * 67
2211         398         613        2211 = 3 * 11 * 67
2221         362         699        2221 = 2221
2229         422         563        2229 = 3 * 743
2239         398         633        2239 = 2239
2249          82         993        2249 = 13 * 173
2251         478         381        2251 = 2251
2252         439         531        2252 = 2^2 * 563
2259         302         821        2259 = 3^2 * 251
2259          62        1003        2259 = 3^2 * 251
2288         241         909        2288 = 2^4 * 11 * 13
2288         389         687        2288 = 2^4 * 11 * 13
2292         149         983        2292 = 2^2 * 3 * 191
2292         451         527        2292 = 2^2 * 3 * 191
2319         482         439        2319 = 3 * 773
2328         319         835        2328 = 2^3 * 3 * 97
2328         521         229        2328 = 2^3 * 3 * 97
2332         251         921        2332 = 2^2 * 11 * 53
2332         521         237        2332 = 2^2 * 11 * 53
2361          22        1055        2361 = 3 * 787
2368           1        1059        2368 = 2^6 * 37
2379         538         179        2379 = 3 * 13 * 61
2379         542         125        2379 = 3 * 13 * 61
2381         482         501        2381 = 2381
2388         139        1033        2388 = 2^2 * 3 * 199
2388         461         577        2388 = 2^2 * 3 * 199
2391         502         431        2391 = 3 * 797
2412         241         971        2412 = 2^2 * 3^2 * 67
2412         451         625        2412 = 2^2 * 3^2 * 67
2428         421         711        2428 = 2^2 * 607
2441         538         303        2441 = 2441
2472         179        1049        2472 = 2^3 * 3 * 103
2472         419         745        2472 = 2^3 * 3 * 103
2479         158        1065        2479 = 37 * 67
2481         262         985        2481 = 3 * 827
2509         502         549        2509 = 13 * 193
2531         362         885        2531 = 2531
2568         251        1039        2568 = 2^3 * 3 * 107
2568         589          25        2568 = 2^3 * 3 * 107
2571         562         349        2571 = 3 * 857
2589         302         997        2589 = 3 * 863
2629         262        1059        2629 = 11 * 239
2629         458         765        2629 = 11 * 239
2631         382         911        2631 = 3 * 877
2672         341         993        2672 = 2^4 * 167
2708         449         837        2708 = 2^2 * 677
2712         541         599        2712 = 2^3 * 3 * 113
2721         622         103        2721 = 3 * 907
2732         401         939        2732 = 2^2 * 683
2748         311        1069        2748 = 2^2 * 3 * 229
2748         619         233        2748 = 2^2 * 3 * 229
2761         542         639        2761 = 11 * 251
2768         599         411        2768 = 2^4 * 173
2781         638           5        2781 = 3^3 * 103
2792         619         321        2792 = 2^3 * 349
2808         319        1091        2808 = 2^3 * 3^3 * 13
2808         641         125        2808 = 2^3 * 3^3 * 13
2809         638         177        2809 = 53^2
2868         551         701        2868 = 2^2 * 3 * 239
2868         649         211        2868 = 2^2 * 3 * 239
2889         478         895        2889 = 3^3 * 107
2899         622         459        2899 = 13 * 223
2948         661         279        2948 = 2^2 * 11 * 67
2949         418        1037        2949 = 3 * 983
2969         638         465        2969 = 2969
2972         641         453        2972 = 2^2 * 743
2999         682         177        2999 = 2999
3012         509         911        3012 = 2^2 * 3 * 251
3012         691           1        3012 = 2^2 * 3 * 251
3048         439        1061        3048 = 2^3 * 3 * 127
3049         682         303        3049 = 3049
3051         682         307        3051 = 3^3 * 113
3072         659         487        3072 = 2^10 * 3
3079         638         591        3079 = 3079
3088         451        1065        3088 = 2^4 * 193
3112         551         885        3112 = 2^3 * 389
3121         538         921        3121 = 3121
3141         638         653        3141 = 3^2 * 349
3148         569         867        3148 = 2^2 * 787
3159         482        1055        3159 = 3^5 * 13
3172         491        1047        3172 = 2^2 * 13 * 61
3201         622         761        3201 = 3 * 11 * 97
3209         562         927        3209 = 3209
3232         649         699        3232 = 2^5 * 101
3232         701         471        3232 = 2^5 * 101
3291         638         787        3291 = 3 * 1097
3308         751         213        3308 = 2^2 * 827
3328         691         633        3328 = 2^8 * 13
3352         769           3        3352 = 2^3 * 419
3392         649         837        3392 = 2^6 * 53
3399         718         593        3399 = 3 * 11 * 103
3428         631         915        3428 = 2^2 * 857
3429         778         227        3429 = 3^3 * 127
3432         751         461        3432 = 2^3 * 3 * 11 * 13
3432         779         223        3432 = 2^3 * 3 * 11 * 13
3459         662         853        3459 = 3 * 1153
3492         599        1037        3492 = 2^2 * 3^2 * 97
3501         682         827        3501 = 3^2 * 389
3501         802          85        3501 = 3^2 * 389
3531         758         557        3531 = 3 * 11 * 107
3548         781         447        3548 = 2^2 * 887
3551         778         471        3551 = 53 * 67
3552         661         929        3552 = 2^5 * 3 * 37
3632         671         963        3632 = 2^4 * 227
3659         698         909        3659 = 3659
3688         839         213        3688 = 2^3 * 461
3691         838         237        3691 = 3691
3708         769         709        3708 = 2^2 * 3^2 * 103
3729         842         295        3729 = 3 * 11 * 113
3732         811         535        3732 = 2^2 * 3 * 311
3809         682        1065        3809 = 13 * 293
3811         842         459        3811 = 37 * 103
3839         878         135        3839 = 11 * 349
3848         869         303        3848 = 2^3 * 13 * 37
3849         722         991        3849 = 3 * 1283
3852         839         541        3852 = 2^2 * 3^2 * 107
3852         869         313        3852 = 2^2 * 3^2 * 107
3861         802         733        3861 = 3^3 * 11 * 13
3888         761         907        3888 = 2^4 * 3^5
3928         869         465        3928 = 2^3 * 491
3939         898         197        3939 = 3 * 13 * 101
3939         902         107        3939 = 3 * 13 * 101
3959         802         831        3959 = 37 * 107
4008         919          59        4008 = 2^3 * 3 * 167
4068         911         395        4068 = 2^2 * 3^2 * 113
4101         878         659        4101 = 3 * 1367
4111         902         537        4111 = 4111
4149         778        1069        4149 = 3^2 * 461
4152         781        1063        4152 = 2^3 * 3 * 173
4181         958          93        4181 = 37 * 113
4188         859         839        4188 = 2^2 * 3 * 349
4191         818         985        4191 = 3 * 11 * 127
4212         961         197        4212 = 2^2 * 3^4 * 13
4241         902         711        4241 = 4241
4268         929         603        4268 = 2^2 * 11 * 97
4279         922         657        4279 = 11 * 389
4281         982          31        4281 = 3 * 1427
4329         838        1039        4329 = 3^2 * 13 * 37
4392         899         887        4392 = 2^3 * 3^2 * 61
4392         991         355        4392 = 2^3 * 3^2 * 61
4409         998         321        4409 = 4409
4448         961         669        4448 = 2^5 * 139
4468        1021         177        4468 = 2^2 * 1117
4481        1018         279        4481 = 4481
4492         919         909        4492 = 2^2 * 1123
4532        1039          75        4532 = 2^2 * 11 * 103
4561         898        1047        4561 = 4561
4609         998         681        4609 = 11 * 419
4621         958         885        4621 = 4621
4632        1049         331        4632 = 2^3 * 3 * 193
4659        1018         635        4659 = 3 * 1553
4699         982         867        4699 = 37 * 127
4719        1082          71        4719 = 3 * 11^2 * 13
4719         958         983        4719 = 3 * 11^2 * 13
4752        1021         745        4752 = 2^4 * 3^3 * 11
4768        1051         591        4768 = 2^5 * 149
4772        1091         177        4772 = 2^2 * 1193
4881         982        1049        4881 = 3 * 1627
5088        1039        1037        5088 = 2^5 * 3 * 53
5088        1091         809        5088 = 2^5 * 3 * 53
5141        1082         915        5141 = 53 * 97
c           a           b           c =  Factored


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

• How did you obtain: $$c = 9u^2 + 4uv + 11v^2$$? This list is done by computer. But is there any algorithm that from one fundamental solution will generate a new one? Sep 4, 2013 at 1:25
• The ternary form $19 a^2 + 5 b^2 - c^2$ has an infinite automorphism group, just as the Pythagorean one $a^2 + b^2 - c^2$ does en.wikipedia.org/wiki/Tree_of_Pythagorean_triples Sep 4, 2013 at 1:32
• But how do you obtainted for given ternary form? The link you gave me doesn't provide a infinite automorphism group for pythagorean triples with additional parametars. Sep 4, 2013 at 2:01
• But any way how to obtain the "formula" for generating a,b,c? I've tried the method you posted in the comment of the question and I come up with: $$a = 38m^2 + 30mn - 10n^2$$ $$b = 57m^2 - 76mn - 15n^2$$ $$c = 209m^2 + 55n^2$$ This one wokrs, but it misses a lot of solution that can be obtained using your formula. Sep 4, 2013 at 10:19
• Once you've obtained the from of $c$, how do you obtain the form for $a$ and $b$. Is there any simplier way to obtain those form, like here: math.stackexchange.com/questions/249735/… Sep 4, 2013 at 19:13