methods, this approximation may be obtained in the same way, as a solution to Pell's equation. Likewise, Archimedes's cattle problem — an ancient word problem about finding the number of cattle belonging to the sun god Helios — can be solved by reformulating it as a Pell's equation. The manuscript containing the problem states that it was devised by Archimedes and recorded in a letter to Eratosthenes, and the attribution to Archimedes is generally accepted today. Around AD 250, Diophantus considered the equation where a and c are fixed numbers, and x and y are the variables to be solved for. This equation is different in form from Pell's equation but equivalent to it. Diophantus solved the equation for (a, c) equal to (1, 1), (1, −1), (1, 12), and (3, 9). Al-Karaji, a 10th-century Persian mathematician, worked on similar problems to Diophantus. In Indian mathematics, Brahmagupta discovered that a form of what is now known as Brahmagupta's identity. Using this, he was able to "compose" triples and that were solutions of , to generate the new triples and Not only did this give a way to generate infinitely many solutions to starting with one solution, but also, by dividing such a composition by , integer or "nearly integer" solutions could often be obtained. For instance, for , Brahmagupta composed the triple (10, 1, 8) (since ) with itself to get the new triple (192, 20, 64). Dividing throughout by 64 ("8" for and ) gave the triple (24, 5/2, 1), which when composed with itself gave the desired integer solution (1151, 120, 1). Brahmagupta solved many Pell's equations with this method, proving that it gives solutions starting from an integer solution of for k = ±1, ±2, or ±4. The first general method for solving the Pell's equation (for all N) was given by Bhāskara II in 1150, extending the methods of Brahmagupta. Called the chakravala (cyclic) method, it starts by choosing two relatively prime integers and , then composing the triple (that is, one which satisfies ) with the trivial triple to get the triple , which can be scaled down to When is chosen so that is an integer, so are the other two numbers in the triple. Among such , the method chooses one that minimizes and repeats the process. This method always terminates with a solution (proved by Joseph-Louis Lagrange in 1768). Bhaskara used it