Binary quadratic form
In mathematics, a binary quadratic form is a quadratic homogeneous polynomial in two variables where "a", "b", "c" are the coefficients. When the coefficients can be arbitrary complex numbers, most results are not specific to the case of two variables, so they are described in quadratic form. A quadratic form with integer coefficients is called an integral binary quadratic form, often abbreviated to "binary quadratic form". This article is entirely devoted to integral binary quadratic forms. This choice is motivated by their status as the driving force behind the development of algebraic number theory. Since the late  nineteenth century, binary quadratic forms have given up their preeminence in algebraic number theory to quadratic and more general number fields, but advances specific to binary quadratic forms still occur on occasion. Pierre Fermat stated that if p is an odd prime then the equation formula_2 has a solution iff formula_3, and he made similar statement about the equations formula_4, formula_5, formula_6 and formula_7. formula_8 and so on are quadratic forms, and the theory of quadratic forms gives a unified way of looking at and proving these theorems. Another instance of quadratic forms is Pell's equation formula_9. Binary quadratic  forms are closely related to ideals in quadratic fields, this allows the class number of a quadratic field to be calculated by counting the number of reduced binary quadratic forms of a given discriminant. The classical theta function of 2 variables is formula_10, if formula_11 is a positive definite quadratic form then formula_12 is a theta function. Equivalence. Two forms "f" and "g" are called equivalent if there exist integers formula_13 such that the following conditions hold: For example, with formula_15 and formula_16, formula_17, formula_18, and formula_19, we find that "f" is equivalent to formula_20, which simplifies to formula_21. The  above equivalence conditions define an equivalence relation on the set of integral quadratic forms. It follows that the quadratic forms are partitioned into equivalence classes, called classes of quadratic forms. A class invariant can mean either a function defined on equivalence classes of forms or a property shared by all forms in the same class. Lagrange used a different notion of equivalence, in which the second condition is replaced by formula_22. Since Gauss it has been recognized that this definition is inferior to that given above. If there is a need to distinguish, sometimes forms are called properly equivalent using  the definition above and improperly equivalent if they are equivalent in Lagrange's sense. In matrix terminology, which is used occasionally below, when has integer entries and determinant 1, the map formula_24 is a (right) group action of formula_25 on the set of binary quadratic forms. The equivalence relation above then arises from the general theory of group actions. If formula_26, then important invariants include Terminology has arisen for classifying classes and their forms in terms of their invariants. A form of discriminant formula_28 is definite if formula_29, degenerate if formula_28 is a perfect square, and indefinite otherwise. A form  is primitive if its content is 1, that is, if its coefficients are coprime. If a form's discriminant is a fundamental discriminant, then the form is primitive. Discriminants satisfy formula_31 Automorphisms. If "f" is a quadratic form, a matrix in formula_25 is an automorphism of "f" if formula_34. For example, the matrix is an automorphism of the form formula_36. The automorphisms of a form form a subgroup of formula_25. When "f" is definite, the group is finite, and when "f" is indefinite, it is infinite and cyclic. Representation. A binary quadratic form formula_38 "represents" an integer formula_39 if it  is possible to find integers formula_40 and formula_41 satisfying the equation formula_42 Such an equation is a "representation" of by . Examples. Diophantus considered whether, for an odd integer formula_39, it is possible to find integers formula_40 and formula_41 for which formula_46. When formula_47, we have so we find pairs formula_49 that do the trick. We obtain more pairs that work by switching the values of formula_40 and formula_41 and/or by changing the sign of one or both of formula_40 and formula_41. In all, there are sixteen different solution pairs. On the other hand, when formula_54, the equation does not have  integer solutions. To see why, we note that formula_56 unless formula_57 or formula_58. Thus, formula_59 will exceed 3 unless formula_60 is one of the nine pairs with formula_40 and formula_41 each equal to formula_63 or 1. We can check these nine pairs directly to see that none of them satisfies formula_64, so the equation does not have integer solutions. A similar argument shows that for each formula_39, the equation formula_66 can have only a finite number of solutions since formula_59 will exceed formula_39 unless the absolute values formula_69 and formula_70 are both less than formula_71. There are only a finite  number of pairs satisfying this constraint. Another ancient problem involving quadratic forms asks us to solve Pell's equation. For instance, we may seek integers "x" and "y" so that formula_72. Changing signs of "x" and "y" in a solution gives another solution, so it is enough to seek just solutions in positive integers. One solution is formula_73, that is, there is an equality formula_74. If formula_60 is any solution to formula_76, then formula_77 is another such pair. For instance, from the pair formula_78, we compute and we can check that this satisfies formula_80. Iterating this process, we find further  pairs formula_60 with formula_72: These values will keep growing in size, so we see there are infinitely many ways to represent 1 by the form formula_84. This recursive description was discussed in Theon of Smyrna's commentary on Euclid's Elements. The representation problem. The oldest problem in the theory of binary quadratic forms is the representation problem: describe the representations of a given number formula_39 by a given quadratic form "f". "Describe" can mean various things: give an algorithm to generate all representations, a closed formula for the number of representations, or even just determine whether any representations exist . The examples above discuss the representation problem for the numbers 3 and 65 by the form formula_86 and for the number 1 by the form formula_84. We see that 65 is represented by formula_86 in sixteen different ways, while 1 is represented by formula_84 in infinitely many ways and 3 is not represented by formula_59 at all. In the first case, the sixteen representations were explicitly described. It was also shown that the number of representations of an integer by formula_59 is always finite. The sum of squares function formula_92 gives the number of representations of "n" by formula_59 as  a function of "n". There is a closed formula where formula_95 is the number of divisors of "n" that are congruent to 1 modulo 4 and formula_96 is the number of divisors of "n" that are congruent to 3 modulo 4. There are several class invariants relevant to the representation problem: The minimum absolute value represented by a class is zero for degenerate classes and positive for definite and indefinite classes. All numbers represented by a definite form formula_97 have the same sign: positive if formula_98 and negative if formula_99. For this reason, the former are called positive definite forms  and the latter are negative definite. The number of representations of an integer "n" by a form "f" is finite if "f" is definite and infinite if "f" is indefinite. We saw instances of this in the examples above: formula_59 is positive definite and formula_84 is indefinite. Equivalent representations. The notion of equivalence of forms can be extended to equivalent representations. Representations formula_102 and formula_103 are equivalent if there exists a matrix with integer entries and determinant 1 so that formula_105 and The above conditions give a (right) action of the group formula_25 on the set of representations of integers  by binary quadratic forms. It follows that equivalence defined this way is an equivalence relation and in particular that the forms in equivalent representations are equivalent forms. As an example, let formula_36 and consider a representation formula_109. Such a representation is a solution to the Pell equation described in the examples above. The matrix has determinant 1 and is an automorphism of "f". Acting on the representation formula_109 by this matrix yields the equivalent representation formula_112. This is the recursion step in the process described above for generating infinitely many solutions to formula_72. Iterating this matrix action, we find that  the infinite set of representations of 1 by "f" that were determined above are all equivalent. There are generally finitely many equivalence classes of representations of an integer "n" by forms of given nonzero discriminant formula_28. A complete set of representatives for these classes can be given in terms of "reduced forms" defined in the section below. When formula_29, every representation is equivalent to a unique representation by a reduced form, so a complete set of representatives is given by the finitely many representations of "n" by reduced forms of discriminant formula_28. When formula_117, Zagier proved that every representation of  a positive integer "n" by a form of discriminant formula_28 is equivalent to a unique representation formula_119 in which "f" is reduced in Zagier's sense and formula_120, formula_121. The set of all such representations constitutes a complete set of representatives for equivalence classes of representations. Reduction and class numbers. Lagrange proved that for every value "D", there are only finitely many classes of binary quadratic forms with discriminant "D". Their number is the of discriminant "D". He described an algorithm, called reduction, for constructing a canonical representative in each class, the reduced form, whose coefficients are the smallest in  a suitable sense. Gauss gave a superior reduction algorithm in "Disquisitiones Arithmeticae", which ever since has been the reduction algorithm most commonly given in textbooks. In 1981, Zagier published an alternative reduction algorithm which has found several uses as an alternative to Gauss's. Composition. Composition most commonly refers to a binary operation on primitive equivalence classes of forms of the same discriminant, one of the deepest discoveries of Gauss, which makes this set into a finite abelian group called the form class group (or simply class group) of discriminant formula_28. Class groups have since become one of the central  ideas in algebraic number theory. From a modern perspective, the class group of a fundamental discriminant formula_28 is isomorphic to the narrow class group of the quadratic field formula_124 of discriminant formula_28. For negative formula_28, the narrow class group is the same as the ideal class group, but for positive formula_28 it may be twice as big. "Composition" also sometimes refers to, roughly, a binary operation on binary quadratic forms. The word "roughly" indicates two caveats: only certain pairs of binary quadratic forms can be composed, and the resulting form is not well-defined (although its equivalence class is). The  composition operation on equivalence classes is defined by first defining composition of forms and then showing that this induces a well-defined operation on classes. "Composition" can also refer to a binary operation on representations of integers by forms. This operation is substantially more complicated than composition of forms, but arose first historically. We will consider such operations in a separate section below. Composition means taking 2 quadratic forms of the same discriminant and combining them to create a quadratic form of the same discriminant, it is a generalization of the 2-square identity formula_128 Composing forms and classes. A  variety of definitions of composition of forms has been given, often in an attempt to simplify the extremely technical and general definition of Gauss. We present here Arndt's method, because it remains rather general while being simple enough to be amenable to computations by hand. An alternative definition is described at Bhargava cubes. Suppose we wish to compose forms formula_129 and formula_130, each primitive and of the same discriminant formula_28. We perform the following steps: The form formula_138 is "the" composition of formula_139 and formula_140. We see that its first coefficient is well-defined, but the other two depend  on the choice of "B" and "C". One way to make this a well-defined operation is to make an arbitrary convention for how to choose "B"—for instance, choose "B" to be the smallest positive solution to the system of congruences above. Alternatively, we may view the result of composition, not as a form, but as an equivalence class of forms modulo the action of the group of matrices of the form where "n" is an integer. If we consider the class of formula_138 under this action, the middle coefficients of the forms in the class form a congruence class  of integers modulo 2"A". Thus, composition gives a well-defined function from pairs of binary quadratic forms to such classes. It can be shown that if formula_139 and formula_140 are equivalent to formula_145 and formula_146 respectively, then the composition of formula_139 and formula_140 is equivalent to the composition of formula_145 and formula_146. It follows that composition induces a well-defined operation on primitive classes of discriminant formula_28, and as mentioned above, Gauss showed these classes form a finite abelian group. The identity class in the group is the unique class containing all forms formula_152, i.e., with first coefficient 1. (It  can be shown that all such forms lie in a single class, and the restriction formula_153 implies that there exists such a form of every discriminant.) To invert a class, we take a representative formula_138 and form the class of formula_155. Alternatively, we can form the class of formula_156 since this and formula_155 are equivalent. Genera of binary quadratic forms. Gauss also considered a coarser notion of equivalence, with each coarse class called a genus of forms. Each genus is the union of a finite number of equivalence classes of the same discriminant, with the number of classes depending only  on the discriminant. In the context of binary quadratic forms, genera can be defined either through congruence classes of numbers represented by forms or by genus characters defined on the set of forms. A third definition is a special case of the genus of a quadratic form in n variables. This states that forms are in the same genus if they are locally equivalent at all rational primes (including the Archimedean place). History. There is circumstantial evidence of protohistoric knowledge of algebraic identities involving binary quadratic forms. The first problem concerning binary quadratic forms asks for the existence or construction  of representations of integers by particular binary quadratic forms. The prime examples are the solution of Pell's equation and the representation of integers as sums of two squares. Pell's equation was already considered by the Indian mathematician Brahmagupta in the 7th century CE. Several centuries later, his ideas were extended to a complete solution of Pell's equation known as the chakravala method, attributed to either of the Indian mathematicians Jayadeva or Bhāskara II. The problem of representing integers by sums of two squares was considered in the 3rd century by Diophantus. In the 17th century, inspired while  reading Diophantus's Arithmetica, Fermat made several observations about representations by specific quadratic forms including that which is now known as Fermat's theorem on sums of two squares. Euler provided the first proofs of Fermat's observations and added some new conjectures about representations by specific forms, without proof. The general theory of quadratic forms was initiated by Lagrange in 1775 in his "Recherches d'Arithmétique". Lagrange was the first to realize that "a coherent general theory required the simulatenous consideration of all forms." He was the first to recognize the importance of the discriminant and to define the essential  notions of equivalence and reduction, which, according to Weil, have "dominated the whole subject of quadratic forms ever since". Lagrange showed that there are finitely many equivalence classes of given discriminant, thereby defining for the first time an arithmetic class number. His introduction of reduction allowed the quick enumeration of the classes of given discriminant and foreshadowed the eventual development of infrastructure. In 1798, Legendre published "Essai sur la théorie des nombres", which summarized the work of Euler and Lagrange and added some of his own contributions, including the first glimpse of a composition operation on forms. The theory was  vastly extended and refined by Gauss in Section V of "Disquisitiones Arithmeticae". Gauss introduced a very general version of a composition operator that allows composing even forms of different discriminants and imprimitive forms. He replaced Lagrange's equivalence with the more precise notion of proper equivalence, and this enabled him to show that the primitive classes of given discriminant form a group under the composition operation. He introduced genus theory, which gives a powerful way to understand the quotient of the class group by the subgroup of squares. (Gauss and many subsequent authors wrote 2"b" in place of "b"; the  modern convention allowing the coefficient of "xy" to be odd is due to Eisenstein). These investigations of Gauss strongly influenced both the arithmetical theory of quadratic forms in more than two variables and the subsequent development of algebraic number theory, where quadratic fields are replaced with more general number fields. But the impact was not immediate. Section V of "Disquisitiones" contains truly revolutionary ideas and involves very complicated computations, sometimes left to the reader. Combined, the novelty and complexity made Section V notoriously difficult. Dirichlet published simplifications of the theory that made it accessible to a broader audience. The culmination  of this work is his text "Vorlesungen über Zahlentheorie". The third edition of this work includes two supplements by Dedekind. Supplement XI introduces ring theory, and from then on, especially after the 1897 publication of Hilbert's "Zahlbericht", the theory of binary quadratic forms lost its preeminent position in algebraic number theory and became overshadowed by the more general theory of algebraic number fields. Even so, work on binary quadratic forms with integer coefficients continues to the present. This includes numerous results about quadratic number fields, which can often be translated into the language of binary quadratic forms, but also  includes developments about forms themselves or that originated by thinking about forms, including Shanks's infrastructure, Zagier's reduction algorithm, Conway's topographs, and Bhargava's reinterpretation of composition through Bhargava cubes.