In algebra, the Brahmagupta–Fibonacci identityexpresses the product of two sums of two squares as a sum of two squares in two different ways. Hence the set of all sums of two squares is closed under multiplication. Specifically, the identity says For example, The identity is also known as the Diophantus identity, as it was first proved by Diophantus of Alexandria. It is a special case of Euler's four-square identity, and also of Lagrange's identity. Brahmagupta proved and used a more general identity, equivalent to This shows that, for any fixed A, the set of all numbers of the form x2 + Ay2 is closed under multiplication. These identities hold for all integers, as well as all rational numbers; more generally, they are true in any commutative ring. All four forms of the identity can be verified by expanding each side of the equation. Also, can be obtained from, or from, by changing b to −b, and likewise with and.
If a, b, c, and d are real numbers, the Brahmagupta–Fibonacci identity is equivalent to the multiplicativity property for absolute values of complex numbers: This can be seen as follows: expanding the right side and squaring both sides, the multiplication property is equivalent to and by the definition of absolute value this is in turn equivalent to An equivalent calculation in the case that the variables a, b, c, and d are rational numbers shows the identity may be interpreted as the statement that the norm in the fieldQ is multiplicative: the norm is given by and the multiplicativity calculation is the same as the preceding one.
Application to Pell's equation
In its original context, Brahmagupta applied his discovery of this identity to the solution of Pell's equation x2 − Ay2 = 1. Using the identity in the more general form he was able to "compose" triples and that were solutions of x2 − Ay2 = k, to generate the new triple Not only did this give a way to generate infinitely many solutions to x2 − Ay2 = 1 starting with one solution, but also, by dividing such a composition by k1k2, integer or "nearly integer" solutions could often be obtained. The general method for solving the Pell equation given by Bhaskara II in 1150, namely the chakravala method, was also based on this identity.
When used in conjunction with one of Fermat's theorems, the Brahmagupta–Fibonacci identity proves that the product of a square and any number of primes of the form 4n + 1 is a sum of two squares.