Write for the th square triangular number, and write and for the sides of the corresponding square and triangle, so that
Define the triangular root of a triangular number to be . From this definition and the quadratic formula,
Therefore, is triangular ( is an integer) if and only if is square. Consequently, a square number is also triangular if and only if is square, that is, there are numbers and such that . This is an instance of the Pell equation with . All Pell equations have the trivial solution for any ; this is called the zeroth solution, and indexed as . If denotes the th nontrivial solution to any Pell equation for a particular , it can be shown by the method of descent that the next solution is
Hence there are infinitely many solutions to any Pell equation for which there is one non-trivial one, which is true whenever is not a square. The first non-trivial solution when is easy to find: it is . A solution to the Pell equation for yields a square triangular number and its square and triangular roots as follows:
Hence, the first square triangular number, derived from , is , and the next, derived from , is .
The solution to the Pell equation can be expressed as a recurrence relation for the equation's solutions. This can be translated into recurrence equations that directly express the square triangular numbers, as well as the sides of the square and triangle involved. We have[3]: (12)
A. V. Sylwester gave a short proof that there are infinitely many square triangular numbers: If the th triangular number is square, then so is the larger th triangular number, since:
The left hand side of this equation is in the form of a triangular number, and as the product of three squares, the right hand side is square.[5]
^
Pietenpol, J. L.; Sylwester, A. V.; Just, Erwin; Warten, R. M. (February 1962). "Elementary Problems and Solutions: E 1473, Square Triangular Numbers". American Mathematical Monthly. 69 (2). Mathematical Association of America: 168–169. doi:10.2307/2312558. ISSN0002-9890. JSTOR2312558.
^Plouffe, Simon (August 1992). "1031 Generating Functions"(PDF). University of Quebec, Laboratoire de combinatoire et d'informatique mathématique. p. A.129. Archived from the original(PDF) on 2012-08-20. Retrieved 2009-05-11.