Chakravala method

From HandWiki
Revision as of 15:12, 6 February 2024 by MainAI6 (talk | contribs) (over-write)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Cyclic algorithm to solve indeterminate quadratic equations

The chakravala method (Sanskrit: चक्रवाल विधि) is a cyclic algorithm to solve indeterminate quadratic equations, including Pell's equation. It is commonly attributed to Bhāskara II, (c. 1114 – 1185 CE)[1][2] although some attribute it to Jayadeva (c. 950 ~ 1000 CE).[3] Jayadeva pointed out that Brahmagupta's approach to solving equations of this type could be generalized, and he then described this general method, which was later refined by Bhāskara II in his Bijaganita treatise. He called it the Chakravala method: chakra meaning "wheel" in Sanskrit, a reference to the cyclic nature of the algorithm.[4] C.-O. Selenius held that no European performances at the time of Bhāskara, nor much later, exceeded its marvellous height of mathematical complexity.[1][4]

This method is also known as the cyclic method and contains traces of mathematical induction.[5]

History

Chakra in Sanskrit means cycle. As per popular legend, Chakravala indicates a mythical range of mountains which orbits around the Earth like a wall and not limited by light and darkness.[6]

Brahmagupta in 628 CE studied indeterminate quadratic equations, including Pell's equation

[math]\displaystyle{ \,x^2 = Ny^2 + 1, }[/math]

for minimum integers x and y. Brahmagupta could solve it for several N, but not all.

Jayadeva (9th century) and Bhaskara (12th century) offered the first complete solution to the equation, using the chakravala method to find for [math]\displaystyle{ \,x^2 = 61y^2 + 1, }[/math] the solution

[math]\displaystyle{ \,x = 1 766 319 049, y = 226 153 980. }[/math]

This case was notorious for its difficulty, and was first solved in Europe by Brouncker in 1657–58 in response to a challenge by Fermat, using continued fractions. A method for the general problem was first completely described rigorously by Lagrange in 1766.[7] Lagrange's method, however, requires the calculation of 21 successive convergents of the continued fraction for the square root of 61, while the chakravala method is much simpler. Selenius, in his assessment of the chakravala method, states

"The method represents a best approximation algorithm of minimal length that, owing to several minimization properties, with minimal effort and avoiding large numbers automatically produces the best solutions to the equation. The chakravala method anticipated the European methods by more than a thousand years. But no European performances in the whole field of algebra at a time much later than Bhaskara's, nay nearly equal up to our times, equalled the marvellous complexity and ingenuity of chakravala."[1][4]

Hermann Hankel calls the chakravala method

"the finest thing achieved in the theory of numbers before Lagrange."[8]

The method

From Brahmagupta's identity, we observe that for given N,

[math]\displaystyle{ (x_1x_2 + Ny_1y_2)^2 - N(x_1y_2 + x_2y_1)^2 = (x_1^2 - Ny_1^2)(x_2^2 - Ny_2^2) }[/math]

For the equation [math]\displaystyle{ x^2 - Ny^2 = k }[/math], this allows the "composition" (samāsa) of two solution triples [math]\displaystyle{ (x_1, y_1, k_1) }[/math] and [math]\displaystyle{ (x_2, y_2, k_2) }[/math] into a new triple

[math]\displaystyle{ (x_1x_2 + Ny_1y_2 \,,\, x_1y_2 + x_2y_1 \,,\, k_1k_2). }[/math]

In the general method, the main idea is that any triple [math]\displaystyle{ (a,b,k) }[/math] (that is, one which satisfies [math]\displaystyle{ a^2 - Nb^2 = k }[/math]) can be composed with the trivial triple [math]\displaystyle{ (m, 1, m^2 - N) }[/math] to get the new triple [math]\displaystyle{ (am + Nb, a+bm, k(m^2-N)) }[/math] for any m. Assuming we started with a triple for which [math]\displaystyle{ \gcd(a,b)=1 }[/math], this can be scaled down by k (this is Bhaskara's lemma):

[math]\displaystyle{ a^2 - Nb^2 = k \Rightarrow \left(\frac{am+Nb}{k}\right)^2 - N\left(\frac{a+bm}{k}\right)^2 = \frac{m^2-N}{k} }[/math]

Since the signs inside the squares do not matter, the following substitutions are possible:

[math]\displaystyle{ a\leftarrow\frac{am+Nb}{|k|}, b\leftarrow\frac{a+bm}{|k|}, k\leftarrow\frac{m^2-N}{k} }[/math]

When a positive integer m is chosen so that (a + bm)/k is an integer, so are the other two numbers in the triple. Among such m, the method chooses one that minimizes the absolute value of m2 − N and hence that of (m2 − N)/k. Then the substitution relations are applied for m equal to the chosen value. This results in a new triple (a, b, k). The process is repeated until a triple with [math]\displaystyle{ k=1 }[/math] is found. This method always terminates with a solution (proved by Lagrange in 1768).[9] Optionally, we can stop when k is ±1, ±2, or ±4, as Brahmagupta's approach gives a solution for those cases.

Brahmagupta's composition method

In AD 628, Brahmagupta discovered a general way to find [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] of [math]\displaystyle{ x^2 = Ny^2 + 1, }[/math] when given [math]\displaystyle{ a^2 = Nb^2 + k }[/math], when k is ±1, ±2, or ±4.[10]

k = ±1

Using Brahmagupta's identity to compose the triple [math]\displaystyle{ (a,b,k) }[/math] with itself:

[math]\displaystyle{ (a^2+Nb^2)^2-N(2ab)^2=k^2 }[/math] [math]\displaystyle{ \Rightarrow }[/math] [math]\displaystyle{ (2a^2-k)^2-N(2ab)^2=k^2 }[/math]

The new triple can be expressed as [math]\displaystyle{ (2a^2-k,2ab,k^2) }[/math].

Substituting [math]\displaystyle{ k=-1 }[/math] gives a solution:

[math]\displaystyle{ x=2a^2+1, y=2ab }[/math]

For [math]\displaystyle{ k=1 }[/math], the original [math]\displaystyle{ (a,b) }[/math] was already a solution. Substituting [math]\displaystyle{ k=1 }[/math] yields a second:

[math]\displaystyle{ x=2a^2-1, y=2ab }[/math]

k = ±2

Again using the equation, [math]\displaystyle{ (2a^2-k)^2-N(2ab)^2=k^2 }[/math][math]\displaystyle{ \Rightarrow }[/math][math]\displaystyle{ \left( \frac{2a^2-k}{k} \right)^2-N \left (\frac{2ab}{k} \right)^2=1 }[/math]

Substituting [math]\displaystyle{ k=2 }[/math],

[math]\displaystyle{ x=a^2-1, y=ab }[/math]

Substituting [math]\displaystyle{ k=-2 }[/math],

[math]\displaystyle{ x=a^2+1, y=ab }[/math]

k = 4

Substituting [math]\displaystyle{ k=4 }[/math] into the equation [math]\displaystyle{ (\frac{2a^2-4}{4})^2-N(\frac{2ab}{4})^2=1 }[/math] creates the triple [math]\displaystyle{ (\frac{a^2-2}{2},\frac{ab}{2},1) }[/math].

Which is a solution if [math]\displaystyle{ a }[/math] is even:

[math]\displaystyle{ x=\frac{a^2-2}{2}, y=\frac{ab}{2} }[/math]

If a is odd, start with the equations [math]\displaystyle{ (\frac{a}{2})^2-N(\frac{b}{2})^2=1 }[/math] and [math]\displaystyle{ (\frac{2a^2-4}{4})^2-N(\frac{2ab}{4})^2=1 }[/math].

Leading to the triples [math]\displaystyle{ (\frac{a}{2},\frac{b}{2},1) }[/math] and [math]\displaystyle{ (\frac{a^2-2}{2},\frac{ab}{2},1) }[/math]. Composing the triples gives [math]\displaystyle{ (\frac{a}{2}(a^2-3))^2-N(\frac{b}{2}(a^2-1))^2=1 }[/math]

When [math]\displaystyle{ a }[/math] is odd,

[math]\displaystyle{ x=\frac{a}{2}(a^2-3)), y=(\frac{b}{2}(a^2-1)) }[/math]

k = -4

When [math]\displaystyle{ k=-4 }[/math], then [math]\displaystyle{ (\frac{a}{2})^2-N(\frac{b}{2})^2=-1 }[/math]. Composing with itself yields [math]\displaystyle{ (\frac{a^2+Nb^2}{4})^2-N(\frac{ab}{2})^2=1 }[/math][math]\displaystyle{ \Rightarrow }[/math][math]\displaystyle{ (\frac{a^2+2}{2})^2-N(\frac{ab}{2})^2=1 }[/math].

Again composing itself yields [math]\displaystyle{ (\frac{(a^2+2)^2+Na^2b^2)}{4})^2-N(\frac{ab(a^2+2)}{2})^2=1 }[/math][math]\displaystyle{ \Rightarrow }[/math] [math]\displaystyle{ (\frac{a^4+4a^2+2}{2})^2-N(\frac{ab(a^2+2)}{2})^2=1 }[/math]

Finally, from the earlier equations, compose the triples [math]\displaystyle{ (\frac{a^2+2}{2},\frac{ab}{2},1) }[/math] and [math]\displaystyle{ (\frac{a^4+4a^2+2}{2},\frac{ab(a^2+2)}{2},1) }[/math], to get

[math]\displaystyle{ (\frac{(a^2+2)(a^4+4a^2+2)+Na^2b^2 (a^2+2)}{4})^2-N(\frac{ab(a^4+4a^2+3)}{2})^2=1 }[/math][math]\displaystyle{ \Rightarrow }[/math][math]\displaystyle{ (\frac{(a^2+2)(a^4+4a^2+1)}{2})^2-N(\frac{ab(a^2+3)(a^2+1)}{2})^2=1 }[/math][math]\displaystyle{ \Rightarrow }[/math][math]\displaystyle{ (\frac{(a^2+2)[(a^2+1)(a^2+3)-2)]}{2})^2-N(\frac{ab(a^2+3)(a^2+1)}{2})^2=1 }[/math].

This give us the solutions

[math]\displaystyle{ x=\frac{(a^2+2)[(a^2+1)(a^2+3)-2)]}{2} y=\frac{ab(a^2+3)(a^2+1)}{2} }[/math][11]

(Note, [math]\displaystyle{ k=-4 }[/math] is useful to find a solution to Pell's Equation, but it is not always the smallest integer pair. e.g. [math]\displaystyle{ 36^2-52*5^2=-4 }[/math]. The equation will give you [math]\displaystyle{ x=1093436498,y=151632270 }[/math], which when put into Pell's Equation yields [math]\displaystyle{ 1195601955878350801-1195601955878350800 = 1 }[/math], which works, but so does [math]\displaystyle{ x = 649,y=90 }[/math] for [math]\displaystyle{ N=52 }[/math].

Examples

n = 61

The n = 61 case (determining an integer solution satisfying [math]\displaystyle{ a^2 - 61b^2 = 1 }[/math]), issued as a challenge by Fermat many centuries later, was given by Bhaskara as an example.[9]

We start with a solution [math]\displaystyle{ a^2 - 61b^2 = k }[/math] for any k found by any means. In this case we can let b be 1, thus, since [math]\displaystyle{ 8^2 - 61\cdot1^2 = 3 }[/math], we have the triple [math]\displaystyle{ (a,b,k) = (8, 1, 3) }[/math]. Composing it with [math]\displaystyle{ (m, 1, m^2-61) }[/math] gives the triple [math]\displaystyle{ (8m+61, 8+m, 3(m^2-61)) }[/math], which is scaled down (or Bhaskara's lemma is directly used) to get:

[math]\displaystyle{ \left( \frac{8m+61}{3}, \frac{8+m}{3}, \frac{m^2-61}{3} \right). }[/math]

For 3 to divide [math]\displaystyle{ 8+m }[/math] and [math]\displaystyle{ |m^2-61| }[/math] to be minimal, we choose [math]\displaystyle{ m=7 }[/math], so that we have the triple [math]\displaystyle{ (39, 5, -4) }[/math]. Now that k is −4, we can use Brahmagupta's idea: it can be scaled down to the rational solution [math]\displaystyle{ (39/2, 5/2, -1)\, }[/math], which composed with itself three times, with [math]\displaystyle{ m={7,11,9} }[/math] respectively, when k becomes square and scaling can be applied, this gives [math]\displaystyle{ (1523/2, 195/2, 1)\, }[/math]. Finally, such procedure can be repeated until the solution is found (requiring 9 additional self-compositions and 4 additional square-scalings): [math]\displaystyle{ (1766319049,\, 226153980,\, 1) }[/math]. This is the minimal integer solution.

n = 67

Suppose we are to solve [math]\displaystyle{ x^2 - 67y^2 = 1 }[/math] for x and y.[12]

We start with a solution [math]\displaystyle{ a^2 - 67b^2 = k }[/math] for any k found by any means; in this case we can let b be 1, thus producing [math]\displaystyle{ 8^2 - 67\cdot1^2 = -3 }[/math]. At each step, we find an m > 0 such that k divides a + bm, and |m2 − 67| is minimal. We then update a, b, and k to [math]\displaystyle{ \frac{am+Nb}{|k|}, \frac{a+bm}{|k|} }[/math] and [math]\displaystyle{ \frac{m^2-N}{k} }[/math] respectively.

First iteration

We have [math]\displaystyle{ (a,b,k) = (8,1,-3) }[/math]. We want a positive integer m such that k divides a + bm, i.e. 3 divides 8 + m, and |m2 − 67| is minimal. The first condition implies that m is of the form 3t + 1 (i.e. 1, 4, 7, 10,… etc.), and among such m, the minimal value is attained for m = 7. Replacing (abk) with [math]\displaystyle{ \left(\frac{am+Nb}{|k|}, \frac{a+bm}{|k|}, \frac{m^2-N}{k}\right) }[/math], we get the new values [math]\displaystyle{ a = (8\cdot7+67\cdot1)/3 = 41, b = (8 + 1\cdot7)/3 = 5, k = (7^2-67)/(-3) = 6 }[/math]. That is, we have the new solution:

[math]\displaystyle{ 41^2 - 67\cdot(5)^2 = 6. }[/math]

At this point, one round of the cyclic algorithm is complete.

Second iteration

We now repeat the process. We have [math]\displaystyle{ (a,b,k) = (41,5,6) }[/math]. We want an m > 0 such that k divides a + bm, i.e. 6 divides 41 + 5m, and |m2 − 67| is minimal. The first condition implies that m is of the form 6t + 5 (i.e. 5, 11, 17,… etc.), and among such m, |m2 − 67| is minimal for m = 5. This leads to the new solution a = (41⋅5 + 67⋅5)/6, etc.:

[math]\displaystyle{ 90^2 - 67 \cdot 11^2 = -7. }[/math]
Third iteration

For 7 to divide 90 + 11m, we must have m = 2 + 7t (i.e. 2, 9, 16,… etc.) and among such m, we pick m = 9.

[math]\displaystyle{ 221^2 - 67\cdot 27^2 = -2. }[/math]
Final solution

At this point, we could continue with the cyclic method (and it would end, after seven iterations), but since the right-hand side is among ±1, ±2, ±4, we can also use Brahmagupta's observation directly. Composing the triple (221, 27, −2) with itself, we get

[math]\displaystyle{ \left(\frac{221^2 + 67\cdot27^2}{2}\right)^2 - 67\cdot(221\cdot27)^2 = 1, }[/math]

that is, we have the integer solution:

[math]\displaystyle{ 48842^2 - 67 \cdot 5967^2 = 1. }[/math]

This equation approximates [math]\displaystyle{ \sqrt{67} }[/math] as [math]\displaystyle{ \frac{48842}{5967} }[/math] to within a margin of about [math]\displaystyle{ 2 \times 10^{-9} }[/math].

Notes

  1. 1.0 1.1 1.2 Hoiberg & Ramchandani – Students' Britannica India: Bhaskaracharya II, page 200
  2. Kumar, page 23
  3. Plofker, page 474
  4. 4.0 4.1 4.2 Goonatilake, page 127 – 128
  5. Cajori (1918), p. 197

    "The process of reasoning called "Mathematical Induction" has had several independent origins. It has been traced back to the Swiss Jakob (James) Bernoulli, the Frenchman B. Pascal and P. Fermat, and the Italian F. Maurolycus. [...] By reading a little between the lines one can find traces of mathematical induction still earlier, in the writings of the Hindus and the Greeks, as, for instance, in the "cyclic method" of Bhaskara, and in Euclid's proof that the number of primes is infinite."

  6. Gopal, Madan (1990). K.S. Gautam. ed. India through the ages. Publication Division, Ministry of Information and Broadcasting, Government of India. p. 79. https://archive.org/details/indiathroughages00mada. 
  7. O'Connor, John J.; Robertson, Edmund F., "Pell's equation", MacTutor History of Mathematics archive, University of St Andrews, http://www-history.mcs.st-andrews.ac.uk/HistTopics/Pell.html .
  8. Kaye (1919), p. 337.
  9. 9.0 9.1 John Stillwell (2002), Mathematics and its history (2 ed.), Springer, pp. 72–76, ISBN 978-0-387-95336-6, https://books.google.com/books?id=WNjRrqTm62QC&pg=PA72 
  10. "Pell's equation" (in en). https://mathshistory.st-andrews.ac.uk/HistTopics/Pell/. 
  11. Datta and Singh (1962). History of Hindu Mathematics : A Source Book Parts I and II. Asia Publishing House. pp. 157–160. ISBN 8180903907. 
  12. The example in this section is given (with notation [math]\displaystyle{ Q_n }[/math] for k, [math]\displaystyle{ P_n }[/math] for m, etc.) in: Michael J. Jacobson; Hugh C. Williams (2009), Solving the Pell equation, Springer, p. 31, ISBN 978-0-387-84922-5, https://books.google.com/books?id=2INzqrEUGzAC&pg=PA31 

References

  • Florian Cajori (1918), Origin of the Name "Mathematical Induction", The American Mathematical Monthly 25 (5), p. 197-201.
  • George Gheverghese Joseph, The Crest of the Peacock: Non-European Roots of Mathematics (1975).
  • G. R. Kaye, "Indian Mathematics", Isis 2:2 (1919), p. 326–356.
  • Clas-Olaf Selenius, "Rationale of the chakravala process of Jayadeva and Bhaskara II" , Historia Mathematica 2 (1975), pp. 167–184.
  • Clas-Olaf Selenius, "Kettenbruchtheoretische Erklärung der zyklischen Methode zur Lösung der Bhaskara-Pell-Gleichung", Acta Acad. Abo. Math. Phys. 23 (10) (1963), pp. 1–44.
  • Hoiberg, Dale & Ramchandani, Indu (2000). Students' Britannica India. Mumbai: Popular Prakashan. ISBN 0-85229-760-2
  • Goonatilake, Susantha (1998). Toward a Global Science: Mining Civilizational Knowledge. Indiana: Indiana University Press. ISBN 0-253-33388-1.
  • Kumar, Narendra (2004). Science in Ancient India. Delhi: Anmol Publications Pvt Ltd. ISBN 81-261-2056-8
  • Ploker, Kim (2007) "Mathematics in India". The Mathematics of Egypt, Mesopotamia, China, India, and Islam: A Sourcebook New Jersey: Princeton University Press. ISBN 0-691-11485-4
  • Edwards, Harold (1977). Fermat's Last Theorem. New York: Springer. ISBN 0-387-90230-9. 

External links