# Brahmagupta

Brahmagupta (c. 598 – c. 668 CE) was an Indian mathematician and astronomer. He is the author of two early works on mathematics and astronomy: the Brāhmasphuṭasiddhānta (BSS, "correctly established doctrine of Brahma", dated 628), a theoretical treatise, and the Khandakhadyaka ("edible bite", dated 665), a more practical text.
In 628 CE, Brahmagupta first described gravity as an attractive force, and used the term "gurutvākarṣaṇam (गुरुत्वाकर्षणम्)" in Sanskrit to describe it. He is also credited with the first clear description of the quadratic formula (the solution of the quadratic equation) in his main work, the Brāhma-sphuṭa-siddhānta.

## Life and career

Brahmagupta, according to his own statement, was born in 598 CE. Born in Bhillamāla in Gurjaradesa (modern Bhinmal in Rajasthan, India) during the reign of the Chavda dynasty ruler Vyagrahamukha. He was the son of Jishnugupta and was a Hindu by religion, in particular, a Shaivite. He lived and worked there for a good part of his life. Prithudaka Svamin, a later commentator, called him Bhillamalacharya, the teacher from Bhillamala.
Bhillamala was the capital of the Gurjaradesa, the second-largest kingdom of Western India, comprising southern Rajasthan and northern Gujarat in modern-day India. It was also a centre of learning for mathematics and astronomy. He became an astronomer of the Brahmapaksha school, one of the four major schools of Indian astronomy during this period. He studied the five traditional Siddhantas on Indian astronomy as well as the work of other astronomers including Aryabhata I, Latadeva, Pradyumna, Varahamihira, Simha, Srisena, Vijayanandin and Vishnuchandra.
In the year 628, at the age of 30, he composed the Brāhmasphuṭasiddhānta ("improved treatise of Brahma") which is believed to be a revised version of the received Siddhanta of the Brahmapaksha school of astronomy. Scholars state that he incorporated a great deal of originality into his revision, adding a considerable amount of new material. The book consists of 24 chapters with 1008 verses in the ārya metre. A good deal of it is astronomy, but it also contains key chapters on mathematics, including algebra, geometry, trigonometry and algorithmics, which are believed to contain new insights due to Brahmagupta himself.
Later, Brahmagupta moved to Ujjaini, Avanti, a major centre for astronomy in central India. At the age of 67, he composed his next well-known work Khanda-khādyaka, a practical manual of Indian astronomy in the karana category meant to be used by students.
Brahmagupta died in 668 CE, and he is presumed to have died in Ujjain.

## Works

Brahmagupta composed the following treatises:
* Brāhmasphuṭasiddhānta, composed in 628 CE.
* Khaṇḍakhādyaka, composed in 665 CE.
* Grahaṇārkajñāna, (ascribed in one manuscript)

## Reception

Brahmagupta's mathematical advances were carried on further by Bhāskara II, a lineal descendant in Ujjain, who described Brahmagupta as the ganaka-chakra-chudamani (the gem of the circle of mathematicians). Prithudaka Svamin wrote commentaries on both of his works, rendering difficult verses into simpler language and adding illustrations. Lalla and Bhattotpala in the 8th and 9th centuries wrote commentaries on the Khanda-khadyaka. Further commentaries continued to be written into the 12th century.
A few decades after the death of Brahmagupta, Sindh came under the Arab Caliphate in 712 CE. Expeditions were sent into Gurjaradesa ("Al-Baylaman in Jurz", as per Arab historians). The kingdom of Bhillamala seems to have been annihilated but Ujjain repulsed the attacks. The court of Caliph Al-Mansur (754–775) received an embassy from Sindh, including an astrologer called Kanaka, who brought (possibly memorised) astronomical texts, including those of Brahmagupta. Brahmagupta's texts were translated into Arabic by Muḥammad ibn Ibrāhīm al-Fazārī, an astronomer in Al-Mansur's court, under the names Sindhind and Arakhand. An immediate outcome was the spread of the decimal number system used in the texts. The mathematician Al-Khwarizmi (800–850 CE) wrote a text called al-Jam wal-tafriq bi hisal-al-Hind (Addition and Subtraction in Indian Arithmetic), which was translated into Latin in the 13th century as Algorithmi de numero indorum. Through these texts, the decimal number system and Brahmagupta's algorithms for arithmetic have spread throughout the world. Al-Khwarizmi also wrote his own version of Sindhind, drawing on Al-Fazari's version and incorporating Ptolemaic elements. Indian astronomic material circulated widely for centuries, even making its way into medieval Latin texts.
The historian of science George Sarton called Brahmagupta "one of the greatest scientists of his race and the greatest of his time."

## Mathematics
### Algebra

Brahmagupta gave the solution of the general linear equation in chapter eighteen of Brahmasphuṭasiddhānta,
   The difference between rupas, when inverted and divided by the difference of the [coefficients] of the [unknowns], is the unknown in the equation. The rupas are [subtracted on the side] below that from which the square and the unknown are to be subtracted.
which is a solution for the equation bx + c = dx + e where rupas refers to the constants c and e. The solution given is equivalent to x = ⁠e − c/b − d⁠.
He further gave two equivalent solutions to the general quadratic equation
   18.44. Diminish by the middle [number] the square-root of the rupas multiplied by four times the square and increased by the square of the middle [number]; divide the remainder by twice the square. [The result is] the middle [number]. 18.45. Whatever is the square-root of the rupas multiplied by the square [and] increased by the square of half the unknown, diminished that by half the unknown [and] divide [the remainder] by its square. [The result is] the unknown.
which are, respectively, solutions for the equation ax$^2$ + bx = c equivalent to,
    $x={\frac {\pm {\sqrt {4ac+b^{2}}}-b}{2a}}$
and
    $x={\frac {\pm {\sqrt {ac+{\tfrac {b^{2}}{4}}}}-{\tfrac {b}{2}}}{a}}$
He went on to solve systems of simultaneous indeterminate equations stating that the desired variable must first be isolated, and then the equation must be divided by the desired variable's coefficient. In particular, he recommended using "the pulverizer" to solve equations with multiple unknowns.
   18.51. Subtract the colors different from the first color. [The remainder] divided by the first [color's coefficient] is the measure of the first. [Terms] two by two [are] considered [when reduced to] similar divisors, [and so on] repeatedly. If there are many [colors], the pulverizer [is to be used].
Like the algebra of Diophantus, the algebra of Brahmagupta was syncopated. Addition was indicated by placing the numbers side by side, subtraction by placing a dot over the subtrahend, and division by placing the divisor below the dividend, similar to our notation but without the bar. Multiplication, evolution, and unknown quantities were represented by abbreviations of appropriate terms. The extent of Greek influence on this syncopation, if any, is not known and it is possible that both Greek and Indian syncopation may be derived from a common Babylonian source.

### Arithmetic

The four fundamental operations (addition, subtraction, multiplication, and division) were known to many cultures before Brahmagupta. This current system is based on the Hindu–Arabic numeral system and first appeared in the Brāhmasphuṭasiddhānta. Brahmagupta describes multiplication in the following way:
   The multiplicand is repeated like a string for cattle, as often as there are integrant portions in the multiplier and is repeatedly multiplied by them and the products are added together. It is multiplication. Or the multiplicand is repeated as many times as there are component parts in the multiplier.
Indian arithmetic was known in medieval Europe as modus Indorum meaning "method of the Indians". In the Brāhmasphuṭasiddhānta, four methods for multiplication were described, including gomūtrikā, which is said to be close to the present-day methods. In the beginning of chapter twelve of his Brāhmasphuṭasiddhānta, entitled "Calculation", he also details operations on fractions. The reader is expected to know the basic arithmetic operations as far as taking the square root, although he explains how to find the cube and cube-root of an integer and later gives rules facilitating the computation of squares and square roots. He then gives rules for dealing with five types of combinations of fractions: ⁠a/c⁠ + ⁠b/c⁠; ⁠a/c⁠ × ⁠b/d⁠; ⁠a/1⁠ + ⁠b/d⁠; ⁠a/c⁠ + ⁠b/d⁠ × ⁠a/c⁠ = ⁠a(d + b)/cd⁠; and ⁠a/c⁠ − ⁠b/d⁠ × ⁠a/c⁠ = ⁠a(d − b)/cd⁠.

#### Squares and Cubes

Brahmagupta then goes on to give the sum of the squares and cubes of the first n integers.
   12.20. The sum of the squares is that [sum] multiplied by twice the [number of] step[s] increased by one [and] divided by three. The sum of the cubes is the square of that [sum] Piles of these with identical balls [can also be computed].
Here Brahmagupta found the result in terms of the sum of the first n integers, rather than in terms of n as is the modern practice.
He gives the sum of the squares of the first n natural numbers as ⁠n(n + 1)(2n + 1)/6⁠ and the sum of the cubes of the first n natural numbers as (⁠n(n + 1)/2⁠)$^2$ .

#### Zero

Brahmagupta's Brahmasphuṭasiddhānta is the first book that provides rules for arithmetic manipulations that apply to zero and to negative numbers. The Brāhmasphuṭasiddhānta is the earliest known text to treat zero as a number in its own right, rather than as simply a placeholder digit in representing another number as was done by the Babylonians or as a symbol for lack of quantity as was done by Ptolemy and the Romans. In chapter eighteen of his Brāhmasphuṭasiddhānta, Brahmagupta describes operations on negative numbers. He first describes addition and subtraction,
   18.30. [The sum] of two positives is positives, of two negatives negative; of a positive and a negative [the sum] is their difference; if they are equal it is zero. The sum of a negative and zero is negative, [that] of a positive and zero positives, [and that] of two zeros zero.
   18.32. A negative minus zero is negative, a positive [minus zero] is positive; zero [minus zero] is zero. When a positive is to be subtracted from a negative or a negative from a positive, then it is to be added.
He goes on to describe multiplication,
   18.33. The product of a negative and a positive is negative, of two negatives positive, and of positives positive; the product of zero and a negative, of zero and a positive, or of two zeros is zero.
But his description of division by zero differs from our modern understanding:
   18.34. A positive divided by a positive or a negative divided by a negative is positive; a zero divided by zero is zero; a positive divided by a negative is negative; a negative divided by a positive is [also] negative. 18.35. A negative or a positive divided by zero has that [zero] as its divisor, or zero divided by a negative or a positive [has that negative or positive as its divisor]. The square of a negative or positive is positive; [the square] of zero is zero. That of which [the square] is the square is [its] square root.
Here Brahmagupta states that ⁠0/0⁠ = 0 and as for the question of ⁠a/0⁠ where a ≠ 0 he did not commit himself. His rules for arithmetic on negative numbers and zero are quite close to the modern understanding, except that in modern mathematics division by zero is left undefined.

### Diophantine analysis
#### Pythagorean triplets

In chapter twelve of his Brāhmasphuṭasiddhānta, Brahmagupta provides a formula useful for generating Pythagorean triples:
   12.39. The height of a mountain multiplied by a given multiplier is the distance to a city; it is not erased. When it is divided by the multiplier increased by two it is the leap of one of the two who make the same journey.
Or, in other words, if d = ⁠mx/x + 2⁠, then a traveller who "leaps" vertically upwards a distance d from the top of a mountain of height m, and then travels in a straight line to a city at a horizontal distance mx from the base of the mountain, travels the same distance as one who descends vertically down the mountain and then travels along the horizontal to the city. Stated geometrically, this says that if a right-angled triangle has a base of length a = mx and altitude of length b = m + d, then the length, c, of its hypotenuse is given by c = m(1 + x) − d. And, indeed, elementary algebraic manipulation shows that a$^2$ + b$^2$ = c$^2$ whenever d has the value stated. Also, if m and x are rational, so are d, a, b and c. A Pythagorean triple can therefore be obtained from a, b and c by multiplying each of them by the least common multiple of their denominators.

#### Pell's equation

Brahmagupta went on to give a recurrence relation for generating solutions to certain instances of Diophantine equations of the second degree such as Nx$^2$ + 1 = y$^2$ (called Pell's equation) by using the Euclidean algorithm. The Euclidean algorithm was known to him as the "pulverizer" since it breaks numbers down into ever smaller pieces.
   The nature of squares: 18.64. [Put down] twice the square-root of a given square by a multiplier and increased or diminished by an arbitrary [number]. The product of the first [pair], multiplied by the multiplier, with the product of the last [pair], is the last computed. 18.65. The sum of the thunderbolt products is the first. The additive is equal to the product of the additives. The two square-roots, divided by the additive or the subtractive, are the additive rupas.
The key to his solution was the identity,
    $(x_{1}^{2}-Ny_{1}^{2})(x_{2}^{2}-Ny_{2}^{2})=(x_{1}x_{2}+Ny_{1}y_{2})^{2}-N(x_{1}y_{2}+x_{2}y_{1})^{2}$
which is a generalisation of an identity that was discovered by Diophantus,
    $(x_{1}^{2}-y_{1}^{2})(x_{2}^{2}-y_{2}^{2})=(x_{1}x_{2}+y_{1}y_{2})^{2}-(x_{1}y_{2}+x_{2}y_{1})^{2}.$
Using his identity and the fact that if (x$_1$, y$_1$) and (x$_2$, y$_2$) are solutions to the equations x$^2$ − Ny$^2$ = k$_1$ and x$^2$ − Ny$^2$ = k$_2$, respectively, then (x$_1$x$_2$ + Ny$_1$y$_2$, x$_1$y$_2$ + x$_2$y$_1$) is a solution to x$^2$ − Ny$^2$ = k$_1$k$_2$, he was able to find integral solutions to Pell's equation through a series of equations of the form x$^2$ − Ny$^2$ = k$_i$. Brahmagupta was not able to apply his solution uniformly for all possible values of N, rather he was only able to show that if x$^2$ − Ny$^2$ = k has an integer solution for k = ±1, ±2, or ±4, then x$^2$ − Ny$^2$ = 1 has a solution. The solution of the general Pell's equation would have to wait for Bhāskara II in c. 1150 CE.

### Geometry
#### Brahmagupta's formula

Brahmagupta's most famous result in geometry is his formula for cyclic quadrilaterals. Given the lengths of the sides of any cyclic quadrilateral, Brahmagupta gave an approximate and an exact formula for the figure's area,
   12.21. The approximate area is the product of the halves of the sums of the sides and opposite sides of a triangle and a quadrilateral. The accurate [area] is the square root from the product of the halves of the sums of the sides diminished by [each] side of the quadrilateral.
So given the lengths p, q, r and s of a cyclic quadrilateral, the approximate area is ⁠p + r/2⁠ · ⁠q + s/2⁠ while, letting t = ⁠p + q + r + s/2⁠, the exact area is
    √(t − p)(t − q)(t − r)(t − s).
Although Brahmagupta does not explicitly state that these quadrilaterals are cyclic, it is apparent from his rules that this is the case. Heron's formula is a special case of this formula and it can be derived by setting one of the sides equal to zero.

### Triangles

Brahmagupta dedicated a substantial portion of his work to geometry. One theorem gives the lengths of the two segments a triangle's base is divided into by its altitude:
   12.22. The base decreased and increased by the difference between the squares of the sides divided by the base; when divided by two they are the true segments. The perpendicular [altitude] is the square-root from the square of a side diminished by the square of its segment.
Thus the lengths of the two segments are ⁠1/2⁠(b ± ⁠c$^2$ − a$^2$/b⁠).
He further gives a theorem on rational triangles. A triangle with rational sides a, b, c and rational area is of the form:
    $a={\frac {1}{2}}\left({\frac {u^{2}}{v}}+v\right),\ \ b={\frac {1}{2}}\left({\frac {u^{2}}{w}}+w\right),\ \ c={\frac {1}{2}}\left({\frac {u^{2}}{v}}-v+{\frac {u^{2}}{w}}-w\right)$
for some rational numbers u, v, and w.

#### Brahmagupta's theorem

Brahmagupta continues,
   12.23. The square-root of the sum of the two products of the sides and opposite sides of a non-unequal quadrilateral is the diagonal. The square of the diagonal is diminished by the square of half the sum of the base and the top; the square-root is the perpendicular [altitudes].
So, in a "non-unequal" cyclic quadrilateral (that is, an isosceles trapezoid), the length of each diagonal is √pr + qs.
He continues to give formulas for the lengths and areas of geometric figures, such as the circumradius of an isosceles trapezoid and a scalene quadrilateral, and the lengths of diagonals in a scalene cyclic quadrilateral. This leads up to Brahmagupta's famous theorem,
   12.30–31. Imaging two triangles within [a cyclic quadrilateral] with unequal sides, the two diagonals are the two bases. Their two segments are separately the upper and lower segments [formed] at the intersection of the diagonals. The two [lower segments] of the two diagonals are two sides in a triangle; the base [of the quadrilateral is the base of the triangle]. Its perpendicular is the lower portion of the [central] perpendicular; the upper portion of the [central] perpendicular is half of the sum of the [sides] perpendiculars diminished by the lower [portion of the central perpendicular].

#### Pi

In verse 40, he gives values of π,
   12.40. The diameter and the square of the radius [each] multiplied by 3 are [respectively] the practical circumference and the area [of a circle]. The accurate [values] are the square-roots from the squares of those two multiplied by ten.
So Brahmagupta uses 3 as a "practical" value of π, and ${\sqrt {10}}\approx 3.1622\ldots$ as an "accurate" value of π, with an error less than 1%.

#### Measurements and constructions

Brahmagupta gives constructions of various figures with arbitrary sides. He essentially manipulated right triangles to produce isosceles triangles, scalene triangles, rectangles, isosceles trapezoids, isosceles trapezoids with three equal sides, and a scalene cyclic quadrilateral.
After giving the value of pi, he deals with the geometry of plane figures and solids, such as finding volumes and surface areas (or empty spaces dug out of solids). He finds the volume of rectangular prisms, pyramids, and the frustum of a square pyramid. He further finds the average depth of a series of pits. For the volume of a frustum of a pyramid, he gives the "pragmatic" value as the depth times the square of the mean of the edges of the top and bottom faces, and he gives the "superficial" volume as the depth times their mean area.

### Trigonometry
#### Sine table

In Chapter 2 of his Brāhmasphuṭasiddhānta, entitled Planetary True Longitudes, Brahmagupta presents a sine table:
   2.2–5. The sines: The Progenitors, twins; Ursa Major, twins, the Vedas; the gods, fires, six; flavors, dice, the gods; the moon, five, the sky, the moon; the moon, arrows, suns [...]
Here Brahmagupta uses names of objects to represent the digits of place-value numerals, as was common with numerical data in Sanskrit treatises. Progenitors represents the 14 Progenitors ("Manu") in Indian cosmology or 14, "twins" means 2, "Ursa Major" represents the seven stars of Ursa Major or 7, "Vedas" refers to the 4 Vedas or 4, dice represents the number of sides of the traditional die or 6, and so on. This information can be translated into the list of sines, 214, 427, 638, 846, 1051, 1251, 1446, 1635, 1817, 1991, 2156, 2312, 2459, 2594, 2719, 2832, 2933, 3021, 3096, 3159, 3207, 3242, 3263, and 3270, with the radius being 3270 (this numbers represent $3270\sin {\frac {\pi n}{48}}$ for $n=1,\dots ,24$).

#### Interpolation formula

In 665 Brahmagupta devised and used a special case of the Newton–Stirling interpolation formula of the second-order to interpolate new values of the sine function from other values already tabulated. The formula gives an estimate for the value of a function f at a value a + xh of its argument (with h > 0 and −1 ≤ x ≤ 1) when its value is already known at a − h, a and a + h.
The formula for the estimate is:
    $f(a+xh)\approx f(a)+x{\frac {\Delta f(a)+\Delta f(a-h)}{2}}+x^{2}{\frac {\Delta ^{2}f(a-h)}{2}}.$
where Δ is the first-order forward-difference operator, i.e.
    $\Delta f(a)\ {\stackrel {\mathrm {def} }{=}}\ f(a+h)-f(a).$

## Early concept of gravity

Brahmagupta in 628 first described gravity as an attractive force, using the term "gurutvākarṣaṇam (गुरुत्वाकर्षणम्)" to describe it:
   The earth on all its sides is the same; all people on the earth stand upright, and all heavy things fall down to the earth by a law of nature, for it is the nature of the earth to attract and to keep things, as it is the nature of water to flow ... If a thing wants to go deeper down than the earth, let it try. The earth is the only low thing, and seeds always return to it, in whatever direction you may throw them away, and never rise upwards from the earth.

## Astronomy

Brahmagupta directed a great deal of criticism towards the work of rival astronomers, and his Brāhmasphuṭasiddhānta displays one of the earliest schisms among Indian mathematicians. The division was primarily about the application of mathematics to the physical world, rather than about the mathematics itself. In Brahmagupta's case, the disagreements stemmed largely from the choice of astronomical parameters and theories. Critiques of rival theories appear throughout the first ten astronomical chapters and the eleventh chapter is entirely devoted to criticism of these theories, although no criticisms appear in the twelfth and eighteenth chapters.
In chapter seven of his Brāhmasphuṭasiddhānta, entitled Lunar Crescent, Brahmagupta rebuts the idea that the Moon is farther from the Earth than the Sun. He does this by explaining the illumination of the Moon by the Sun.
   1. If the moon were above the sun, how would the power of waxing and waning, etc., be produced from calculation of the longitude of the moon? The near half would always be bright.
   2. In the same way that the half seen by the sun of a pot standing in sunlight is bright, and the unseen half dark, so is [the illumination] of the moon [if it is] beneath the sun.
   3. The brightness is increased in the direction of the sun. At the end of a bright [i.e. waxing] half-month, the near half is bright and the far half dark. Hence, the elevation of the horns [of the crescent can be derived] from calculation. [...]
He explains that since the Moon is closer to the Earth than the Sun, the degree of the illuminated part of the Moon depends on the relative positions of the Sun and the Moon, and this can be computed from the size of the angle between the two bodies.
Further work exploring the longitudes of the planets, diurnal rotation, lunar and solar eclipses, risings and settings, the moon's crescent and conjunctions of the planets, are discussed in his treatise Khandakhadyaka.