The **eighth problem of the second book of Arithmetica** by Diophantus (c. 200/214 AD – c. 284/298 AD) is to divide a square into a sum of two squares.

Diophantus takes the square to be 16 and solves the problem as follows:^{[1]}

To divide a given square into a sum of two squares.

To divide 16 into a sum of two squares.

Let the first summand be , and thus the second . The latter is to be a square. I form the square of the difference of an arbitrary multiple of

xdiminished by the root [of] 16, that is, diminished by 4. I form, for example, the square of 2x− 4. It is . I put this expression equal to . I add to both sides and subtract 16. In this way I obtain , hence .Thus one number is 256/25 and the other 144/25. The sum of these numbers is 16 and each summand is a square.

Geometrically, we may illustrate this method by drawing the circle *x*^{2} + *y*^{2} = 4^{2} and the line *y* = 2*x* - 4. The pair of squares sought are then *x*_{0}^{2} and *y*_{0}^{2}, where (*x*_{0}, *y*_{0}) is the point not on the *y*-axis where the line and circle intersect. This is shown in the adjacent diagram.

We may generalize Diophantus's solution to solve the problem for any given square, which we will represent algebraically as *a*^{2}. Also, since Diophantus refers to an arbitrary multiple of *x*, we will take the arbitrary multiple to be *tx*. Then:

Therefore, we find that one of the summands is and the other is . The sum of these numbers is and each summand is a square. Geometrically, we have intersected the circle *x*^{2} + *y*^{2} = *a*^{2} with the line *y* = *tx* - *a*, as shown in the adjacent diagram.^{[2]} Writing the lengths, OB, OA, and AB, of the sides of triangle OAB as an ordered tuple, we obtain the triple

- .

The specific result obtained by Diophantus may be obtained by taking *a* = 4 and *t* = 2:

We see that Diophantus' particular solution is in fact a subtly disguised (3, 4, 5) triple. However, as the triple will always be rational as long as *a* and *t* are rational, we can obtain an infinity of rational triples by changing the value of *t*, and hence changing the value of the arbitrary multiple of *x*.

This algebraic solution needs only one additional step to arrive at the Platonic sequence and that is to multiply all sides of the above triple by a factor . Notice also that if *a* = 1, the sides [OB, OA, AB] reduce to

In modern notation this is just for θ shown in the above graph, written in terms of the cotangent *t* of θ/2. In the particular example given by Diophantus, *t* has a value of 2, the arbitrary multiplier of *x*. Upon clearing denominators, this expression will generate Pythagorean triples. Intriguingly, the arbitrary multiplier of *x* has become the cornerstone of the generator expression(s).

Diophantus II.IX reaches the same solution by an even quicker route which is very similar to the 'generalized solution' above. Once again the problem is to divide 16 into two squares.^{[3]}

Let the first number be

Nand the second an arbitrary multiple ofNdiminished by the root (of) 16. For example 2N− 4. Then:

Fermat's famous comment which later became Fermat's Last Theorem appears sandwiched between 'Quaestio VIII' and 'Quaestio IX' on page 61 of a 1670 edition of Arithmetica.