A Constructive Proof of Jacobi's Identity for the Sum of Two Squares
Mario DeFranco

TL;DR
This paper provides a constructive, algorithmic proof of Jacobi's identity for sums of two squares, utilizing combinatorial methods, integer partitions, and matchings on infinite graphs.
Contribution
It introduces a novel constructive proof and an explicit algorithm for representing integers as sums of two squares based on factorization and combinatorial structures.
Findings
Develops an algorithm transforming factorizations with specific congruences into sums of two squares.
Uses combinatorial proofs of Jacobi Triple Product and Hirschhorn's proof.
Frames the problem in terms of integer partitions and matchings on infinite graphs.
Abstract
We present a constructive proof of Jacobi's identity for the sum of two squares. We present a combinatorial proof of the Jacobi Triple Product and combine with a proof of Hirschhorn to define an algorithm. The input is a factorization with plus two bits of data, and whose output is either another factorization and with two more bits of data, or a pair of integers whose squares sum to . We phrase this algorithm in terms of integer partitions and matchings on an infinite graph.
| 1 mod 4 Start vertex | End vertex | Edge Pair Path Sequence |
|---|---|---|
| (1,1;1,1,-) | (-1,0) | |
| (1,1;1,2,-) | (0,-1) | |
| (1,1;2,1,+) | (0,1) | |
| (1,1;2,2,+) | (1,0) |
| 1 mod 4 Start vertex | End vertex | Number of Edge Pairs in Path |
|---|---|---|
| (9,1;1,5,-) | (0,3) | 1,107 |
| (9,1;1,6,-) | (0,-3) | 6,614 |
| (9,1;2,5,+) | (-3,0) | 20,638 |
| (9,1;2,6,+) | (3,3;2,2,-) | 15,088 |
| (1,9;1,1,-) | (3,3;2,1,-) | 19,038 |
| (1,9;1,2,-) | (3,0) | 80,431 |
| (1,9;2,1,+) | (3,3;1,1,+) | 134,951 |
| (1,9;2,1,+) | (3,3;1,2,+) | 15,613 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Combinatorial Mathematics · Advanced Mathematical Identities · Molecular spectroscopy and chirality
A Constructive Proof of Jacobi’s Identity for the Sum of Two Squares
Mario DeFranco
Abstract
We present a constructive proof of Jacobi’s identity for the sum of two squares. We present a combinatorial proof of the Jacobi Triple Product and combine with a proof of Hirschhorn to define an algorithm. The input is a factorization with plus two bits of data, and whose output is either another factorization and with two more bits of data, or a pair of integers whose squares sum to . We phrase this algorithm in terms of integer partitions and matchings on an infinite graph.
1 Introduction
Jacobi’s identity for the sum of two squares [5] states that for positive integer
[TABLE]
where is the number of ordered pairs of integers such that
[TABLE]
and
[TABLE]
This identity is equivalent to the Lambert series
[TABLE]
where
[TABLE]
and where we expand the rational functions as power series
[TABLE]
There exist combinatorial proofs of (2) in the literature; see Borwein and Borwein [1] section 9.1 and M. D. Hirschhorn [7]. These proofs compare the coefficients of both sides of (2) and show they are equal; in other words, they show that the orders of two finite sets are the same. The proof we present here proves (2) by explicitly defining a bijection between those sets. Specifically, we denote for integer the sets
[TABLE]
We define a bijection
[TABLE]
To define , we first present a combinatorial proof of the Jacobi Triple Product using integer partitions. The proof of (2) by Hirschhorn [7] uses the Jacobi Triple Product as a starting point. We then define three graphs whose vertices are indexed by lists of partitions that arise from the proof of the Jacobi Triple Product. These graphs codifies the proof strategy of [7]. We show that the sets (3) correspond to subsets of the final graph , and construct paths such that each path that begins at a vertex in ends at a vertex in .
We now establish notation for partitions and graphs. An integer partition, or just partition, is a finite multi-set of positive integers. Each element of this multi-set is called a part. We denote a partition by the notation
[TABLE]
where is the number of parts of that are equal to and only finitely many of are non-zero. If each non-zero , then the multi-set is actually a set and we say that the partition has distinct parts. We let
[TABLE]
denote that monomial . We denote
[TABLE]
and
[TABLE]
For a partition with distinct parts, we will also denote the partition as an ordered finite sequence
[TABLE]
such that
[TABLE]
A graph is a pair , where is a (possibly infinite) set and is a set of distinct unordered pairs for . We call the vertex set or just vertices of and the edges of . For a graph , we say that a matching of is a subset of the edges of such that each vertex of is in at most one edge of . A perfect matching is a matching such that each vertex is in exactly one edge.
2 Proof of Jacobi Triple Product
Jacobi Triple Product:
[TABLE]
- Proof
Divide by
[TABLE]
and expand each factor as a power series to obtain
[TABLE]
Expanding the terms on the left, the coefficient of will be a sum of terms which are clearly indexed by an ordered pair , where and are each a finite (possibly empty) set of odd positive integers, though may be non-empty, and . To prove (4) we thus give a bijection
[TABLE]
where denotes a finite (possibly empty) set of positive even integers; that is is a partition with distinct even parts. We consider the case . For if , we set
[TABLE]
Let and , with and . Thus must be a partition such that
[TABLE]
where .
We define
[TABLE]
where each factor contributes parts of the number in the partition of , and .
To see that the map results in a partition of , we consider the pair with minimal entries, which is
[TABLE]
Then and maps to , the partition with parts of the integer . Incrementing each by 2 for each corresponds to adding one part of to the partition. Incrementing each by 2 for each corresponds to changing each part to .
To define the reverse map, we are given an integer and a partition consisting of all even parts and must construct . We let
[TABLE]
denote the number of parts of the partition that are greater than . Then the order is determined by , where is the unique integer that satisfies both of the inequalities
[TABLE]
This ensures that there are at least parts of that are at least equal to and at most parts that are greater than . First, the set is determined by the greatest parts of , and then the set is determined by the parts less than or equal to .
The two sets and in the map (5) correspond to two ways of building up partitions; incrementing entries in adds a certain part (which is ) to the partition, and incrementing entries in increases certain parts (which are ) that are already in the partition.
3 Graphs corresponding to Hirschhorn’s Equation
3.1 The vertices of
From [7], we have Hirschhorn’s equation:
[TABLE]
We express this equation as a perfect matching on an infinite graph . The vertices in correspond to terms in the expansion of the product at (6); the vertices in correspond to terms in the expansion of the product at (7); and the vertices in correspond to terms in the expansion of the product at (8).
- Definition
The vertex set of is the disjoint union of three sets . The vertices in each are indexed in the same manner by the ordered triple and :
[TABLE]
where and are finite (possible empty) sets of distinct odd positive integers as above and is a finite (possible empty) set of distinct even positive integers; and indicates that . We use the notation for the elements of and as above and let
[TABLE]
Define by for
[TABLE]
for by
[TABLE]
and for by
[TABLE]
- Definition
Define a minimal set for integer by
[TABLE]
Define a vertex to be terminal if either of the following hold for some integer :
[TABLE]
- Definition
For a set
[TABLE]
define
[TABLE]
and
[TABLE]
From proof above we have if and only if is of the form
[TABLE]
for some .
3.2 The matching
We define the perfect matching on .
- Definition
The perfect matching is defined to be an involution on . Let . Let . Assume . Let . For cases 1-4 below assume and are not both empty. If is not empty, let denote the smallest integer in . If is not empty, let denote the smallest integer in .
- If is empty or if , and if , then that means for some . Define
[TABLE]
- If is empty or if , and if , then define
[TABLE]
- If is empty or if , and if for some , then define
[TABLE]
- If is empty or if , and if is not minimal, then define
[TABLE]
- If and are both empty, then for integer define
[TABLE]
[TABLE]
[TABLE]
and
[TABLE]
If , then with
[TABLE]
define
[TABLE]
In cases 1 and 3, we say that is order-preserved since and are the same in and . In cases 2 and 4, we say that is not order-preserved.
Lemma 3.1
The set of edges for is a perfect matching and
[TABLE]
- Proof
It is straightforward to check using the proof of the Jacobi Triple Product that is an involution on and thus a perfect matching. It is also straightforward to check in each case that
[TABLE]
3.3 The vertices of
Now we differentiate Hirschhorn’s equation with respect to . This corresponds to creating a new graph whose vertex set is defined next. Differentiating by the product rule means each factor from the set and each from contributes a separate vertex. That is why, for example, each element of the set for vertices in contributes a vertex indexed by ; but for vertices in or , each element comes with a power of , which corresponds to two vertices indexed by and . The index arises from the factor of in the function for ; this does not come from or .
- Definition
We define the vertex set of as a disjoint union of three sets and . We say that a vertex contributes a finite number of vertices of the form or , where is an integer we specify below.
Let
[TABLE]
We denote
[TABLE]
for , and
[TABLE]
for . The vertex
[TABLE]
does not contribute any vertices to .
Let
[TABLE]
We denote
[TABLE]
for or , and
[TABLE]
for or . The vertex
[TABLE]
does not contribute any vertices to .
Let
[TABLE]
We denote
[TABLE]
for or , and
[TABLE]
for or , and also
[TABLE]
for any choice of and . Thus the vertex
[TABLE]
contributes to the vertex
[TABLE]
We extend the weight function to :
- Definition
For , define
[TABLE]
[TABLE]
and
[TABLE]
3.4 Extending to
We extend the perfect matching to .
- Definition
, not terminal. Suppose is not terminal and is order-preserved. Without loss of generality suppose or gets incremented. Then if is the set that gets incremented, or if is the set that gets incremented and the incremented elements are all greater than , then set
[TABLE]
Otherwise set
[TABLE]
For , apply the above definition with and switched.
Now suppose is not terminal and is not order-preserved. Without loss of generality suppose in , and becomes in . Let be the smallest element of . We set
[TABLE]
Switching and in the above definition and letting denote the smallest element of , we set
[TABLE]
For all other cases we set
[TABLE]
, not terminal. Suppose is not terminal and is order-preserved. Without loss of generality suppose or gets incremented. Then if is the set that gets incremented, or if is the set that gets incremented and the incremented elements are all greater than , then set
[TABLE]
Otherwise set
[TABLE]
For , apply the above definition with and switched.
Suppose is not terminal and not order-preserved. Without loss of generality suppose in and becomes in . Let be the smallest element of . We set
[TABLE]
Switching and in the above definition and letting denote the smallest element of , we set
[TABLE]
For all other cases we set
[TABLE]
For and with not terminal, we set
[TABLE]
is terminal.
1.If is terminal with , then recall is terminal with . Define
[TABLE]
for odd, .
2.If is terminal with , then recall is terminal with . Define
[TABLE]
for odd, .
3.If is terminal with , then recall is terminal with . Define
[TABLE]
for odd, , and define
[TABLE]
where both sides of the above equation are elements of .
- If is terminal with , then recall is terminal with . Define
[TABLE]
for odd, .
Equation (10) describes the cancellation from the differentiation
[TABLE]
Lemma 3.2
The set of edges for is a perfect matching and
[TABLE]
- Proof
This follows from the same properties for on .
We now define subsets of that correspond to each term in the differentiation of the infinite products.
- Definition
For each odd integer , define to be set of a vertices in of the form and to be set of a vertices in of the form .
For each odd integer , define to be set of a vertices in of the form or and define to be set of a vertices in of the form or .
For each odd integer , define to be set of a vertices in of the form or and define to be set of a vertices in of the form or . Define to be set of a vertices in of the form .
3.5 The matching
- Definition
We define the perfect matching restricted to the set . For a , let
[TABLE]
such that . Then define
[TABLE]
Lemma 3.3
The set of edges for is a perfect matching on that vertex set and
[TABLE]
- Proof
By definition is an involution on . Since the sets of and differ by exactly one element they have different signs but are the same power of because by construction the element of in contributes to the [math] power.
For vertices in , we apply the matching to get that
[TABLE]
3.6 The vertices of
Now, in the differentiated Hirschhorn’s equation, we set and multiply both sides by
[TABLE]
This corresponds to creating a new graph . In the above expression, consider the first factor of . Expanding each as a geometric series yields a sum of terms. Each term corresponds to a choice of a partition. Call this choice . Considering the second factor of yields a another choice, call it . Similarly the first factor of yields a partition with distinct parts, call it . In this way we index the terms in the expansion of the above expression by partitions.
- Definition
We say that each vertex contributes infinitely many vertices of the form
[TABLE]
where and are partitions; and are partitions with distinct parts; is a partition with parts congruent to , is a partition with parts congruent to , is a partition with even parts, and and are partitions; are partitions with distinct parts; and are partitions. Define
[TABLE]
We denote
[TABLE]
to be the set of vertices in that are contributed by vertices in .
Define
[TABLE]
3.7 Extending to G”
- Definition
For , let be a vertex that contributes to where denotes a particular choice of 17 partitions in the definition of . Then define
[TABLE]
It follows that is a perfect matching on and that
[TABLE]
from those same properties for .
3.8 Operation of pairs of partitions
- Definition
We define operations , , and on pairs of partitions .
The operation corresponds to the cancellation in the equation
[TABLE]
. For a partition with distinct parts and for any partition , suppose there exists a smallest index such that
[TABLE]
If , then let
[TABLE]
[TABLE]
If , then let
[TABLE]
and
[TABLE]
The define
[TABLE]
If no such exists, then we say that is not defined.
The operation , corresponds to the cancellation in the equation
[TABLE]
which comes from have a difference of squares in the denominator.
. For two partitions and , suppose there exists a smallest index such that either
-
and is even.
-
is odd.
If we have case 1, then let
[TABLE]
and
[TABLE]
If we have case 2, then let
[TABLE]
and
[TABLE]
Then define
[TABLE]
If no such exists, then we say that is not defined.
The operation , corresponds to the cancellation in the equation
[TABLE]
which comes from have a difference of squares in the numerator. . Let and be two partitions each having distinct parts. Suppose there exists a smallest index such that
[TABLE]
Let
[TABLE]
and
[TABLE]
Define
[TABLE]
If no such exists then we say is not defined.
The operation , corresponds to the cancellation in the equation
[TABLE]
which is related to Euler’s Identity of the number of partitions with distinct parts equaling the number of partitions with all odd parts.
. Let be a partition with distinct parts and let be a partition with all even parts. Suppose there exists a smallest index such that
[TABLE]
If , then let
[TABLE]
and
[TABLE]
If , then let
[TABLE]
and
[TABLE]
Then set
[TABLE]
If there is no such , then we say is not defined.
3.9 The matching
We describe a matching on the set that proves the equation
[TABLE]
- Definition
Let
[TABLE]
We take the union of and and call it a single partition , and we rename the partition as . Thus we have four partitions for . Now for each we sum over all partitions and which gives
[TABLE]
The above equation follows from Euler’s identity equating the number of partitions with distinct parts and the number of partitions with odd parts. We define the matching to correspond to equation (11).
We take the smallest , , such that is defined. Let
[TABLE]
denote the vertex obtained from by replacing with and with . Then we set
[TABLE]
If no such exists, then that means is empty and is a partition with even for all and for all . In this case, we think of each as encoding a partition of all even parts via
[TABLE]
We thus compare and . Let be the smallest index such that is defined and denote
[TABLE]
Then we set
[TABLE]
If no such exists, then that means and are both empty and is a partition with distinct odd parts for .
Next we take which is a partition of distinct even parts, and and construct the partition of distinct arbitrary parts via
[TABLE]
We compare with the partition . If is defined, then set
[TABLE]
If is undefined, then that means both and are empty.
Next we consider the partitions and . We transform into another partition via
[TABLE]
and transform into via
[TABLE]
Now let be the smaller index such that is defined and set
[TABLE]
If no such exists, then that means for and we think of each pair as encoding a single partition of distinct even parts
[TABLE]
Thus so far on the set we have defined the matching such that the only vertices not in the matching are indexed by
[TABLE]
such that the are partitions with distinct even parts and the are partitions with distinct odd parts. We rename these
[TABLE]
Each corresponds to a vertex in the original graph . Let be the smaller index such that is not terminal, if such a exists. Then set
[TABLE]
This completes the definition of on .
Lemma 3.4
The edges for are a matching on and the only vertices not in matching are terminal vertices of the form
[TABLE]
in the notation of the definition of . Also
[TABLE]
- Proof
This follows from the construction of and the the fact that the four operations on pairs of partitions are sign-changing involutions.
The only vertices not in the matching are of the form
[TABLE]
such that each is terminal. For of the form (12), we have
[TABLE]
Since , this proves
[TABLE]
3.10 The matching
We define a matching on the vertices . First we define the operation .
- Definition
Let be a partition with distinct parts and let be any partition. Let be a positive integer. Suppose there exists a smallest index such that
[TABLE]
If , then let
[TABLE]
[TABLE]
If , then let
[TABLE]
and
[TABLE]
The define
[TABLE]
If no such exists, then we say that is not defined.
Now any vertex in for or is indexed by
[TABLE]
where we recall that and are partitions of distinct odd parts; is a partition with distinct even parts; and are partitions; and are partitions with distinct parts; is a partition with parts congruent to , is a partition with parts congruent to , is a partition with even parts, and and are partitions; are partitions with distinct parts; are partitions; and or for and or for , or possibly if .
- Definition
We define the matching on . First take and
[TABLE]
If is not defined, then that means is empty and we may regard as a partition with all even parts. Then set
[TABLE]
If is not defined, then that means is empty and we may regard as a partition with all parts congruent to . We then set
[TABLE]
where is the first pair in the following list such that is defined:
[TABLE]
If is not defined for any pair in that list, then we take the partitions and and construct the partitions and depending on or :
[TABLE]
[TABLE]
Let . We then take to be the first pair in the following lists for which the indicated operation is defined:
[TABLE]
If none of the above operations are defined, then for that means either: and are empty, and and are given by
[TABLE]
for some and ; or and are empty, and and are given by
[TABLE]
for some . For that means
[TABLE]
for some ; or and are empty, and and are given by
[TABLE]
for some . And for that means all are empty.
Lemma 3.5
The edges for are a matching on those vertices and the only vertices not in matching are vertices indexed by
[TABLE]
where we have mod 4 with and , or and ; mod 4 with and , or and ; and or . These correspond to the two bits of information and in the sets and respectively. And
[TABLE]
- Proof
This also follows from the construction of and the the fact that the four operations on pairs of partitions are sign-changing involutions.
4 Paths in Graphs
Now we can specify the constructive proof. We have that he vertices that are not a part of the matching correspond to vertices in and and that vertices in that are not a part of the matching correspond to the set . We check that the sign of is the same for all and opposite to all those for . We have also shown that the matchings preserve the power of in the function but change its sign. There facts imply that any path in of the form
[TABLE]
where for some and the are non-negative integers is uniquely determined and has its final vertex in .
5 Examples
We present some information about paths for some values of . When , we have four paths which are given in the following table. Since every path has every other edge in the matching, we have omitted those in the table for brevity.
Below is the table for . There are ways to write as a sum of two squares.
6 Further Work
- •
The Jacobi Triple Product is an instance of the Macdonald identities. Extend the the proof strategy of Section 2 to the other Macdonald identities and also see if analogues of the Lambert series (2) can be obtained.
- •
Analyze the paths in more closely and see if they can be expressed using a smaller number of edges by modifying the algorithm .
- •
Use these graphs of partitions to get constructive proofs of the generalizations to the Jacobi sum of two square formula found in [8] and [9].
- •
Compare the algorithm to other constructive proofs of two square theorem for primes found in [2], [3], [4], and [6].
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Borwein, Jonathan M. and Borwein, Peter B. Pi and the AGM. John Wiley and Sons. New York, 1987.
- 2[2] Brillhart, John. “Note on Representing a Prime as a Sum of Two Squares”. Mathematics of Computation, Volume 26, Number 120 October 1972.
- 3[3] Delorme, Charles and Pineda-Villavicencio, Guillermo. “Continuants and Some Decompositions Into Squares.” Integers, Vol 15 (2015)
- 4[4] Elsholtz, Christian. “A combinatorial approach to sums of two squares and related problems.” http://www.math.tugraz.at/ elsholtz/WWW/papers/papers 30nathanson-new-address 3.pdf
- 5[5] Jacobi,C.G.J. “Fundamenta Nova Theoriae Functionum Ellipticarum,” Regiomonti. Sumptibus fratrum Borntr ger, 1829; reprinted in Jacobi’s Gesammelte Werke, Vol. 1, Reimer, Berlin, 1881-1891, pp. 49-239; reprinted by Chelsea, New York, 1969; Now distributed by The American Mathematical Society, Providence, RI
- 6[6] Jacobstahl, Ernst. “Uber die Darstellung der Primzahlen der Form 4n+1 als Summe zweier Quadrate.” Journal f r die reine und angewandte Mathematik / Zeitschriftenband, (1907) Artikel 238-245 http://www.digizeitschriften.de/dms/resolveppn/?PID=GDZPPN 002166402
- 7[7] Hirschhorn, Michael D. “A simple proof of Jacobi’s two-square theorem,” Amer. Math Monthly 92 (1985) 579-580.
- 8[8] Lass, Bodo. “Demonstration de la conjecture de Dumont,” C. R. Acad. Sci. Paris, Ser. I 341 (2005) 713-718.
