### Part II. Chapter 6. “Of the Cases in Integer Numbers, in which the Formula 𝑎𝑥𝑥+𝑏 becomes a Square.”

79 We have already shown, Art. 63, how such formulae as $$a+bx+cx^2$$ are to be transformed, in order that the second term may be destroyed we shall therefore confine our present inquiries to the formula $$ax^2 + b$$, in which it is required to find for $$x$$ only integer numbers, which may transform that formula into a square. Now, first of all, such a formula must be possible; for, if it be not, we shall not even obtain fractional values of $$x$$, far less integer ones.

80 Let us suppose then $$ax^2+b=y^2$$; $$a$$ and $$b$$ being integer numbers, as well as $$x$$ and $$y$$.

Now, here it is absolutely necessary for us to know, or to have already found a case in integer numbers; otherwise it would be lost labor to seek for other similar cases, as the formula might happen to be impossible.

We shall, therefore, suppose that this formula becomes a square, by making $$x-f$$, and we shall represent that square by $$g^2$$, so that $$af^2+b=g^2$$, where $$f$$ and $$g$$ are known numbers. Then we have only to deduce from this case other similar cases; and this inquiry is so much the more important, as it is subject to considerable difficulties; which, however, we shall be able to surmount by particular artifices.

81 Since we have already found $$af^2+b=g^2$$, and likewise, by hypothesis, $$ax^2+b=y^2$$, let us subtract the first equation from the second, and we shall obtain a new one, $$ax^2-af^2=y^2-g^2$$, which may be represented by factors in the following manner;

$a(x+f)\cdot(x-f) = (y+g)\cdot (y-g),$

and which, by multiplying both sides by $$pq$$, becomes

$apq(x+f)\cdot(x-f)=pq(y+g)\cdot(y-g).$

If we now decompound this equation, by making $$ap(x+f)=q(y+g)$$, and $$q(x-f) = p(y-g)$$, we may derive, from these two equations, values of the two letters $$x$$ and $$y$$. The first, divided by $$q$$, gives $$y+g = \dfrac{apx+apf}{q}$$; and the second, divided by $$p$$, gives $$y-g = \dfrac{qx-qf}{p}$$. Subtracting this latter equation from the former, we have

$2g = \dfrac{(ap^2-q^2)x+(ap^2+q^2)f}{pq},$

or

$2gpq = (ap^2-q^2)x+(ap^2+q^2)f;$

therefore

$x=\dfrac{2gpq}{ap^2-q^2} - \dfrac{(ap^2+q^2)f}{ap^2-q^2},$

from which we obtain

$y=g+\dfrac{2gq^2}{ap^2-q^2} - \dfrac{(ap^2+q^2)fq}{(ap^2-q^2)p} - \dfrac{qf}{p}.$

And as, in this latter value, the first two terms, both containing the letter $$g$$, may be put into the form $$\dfrac{g(ap^2+q^2)}{ap^2-q^2}$$, and as the other two, containing the letter $$f$$, may be expressed by $$\dfrac{2afpq}{ap^2-q^2}$$, all the terms will be reduced to the same denomination, and we shall have

$y=\dfrac{g(ap^2+q^2)-2afpq}{ap^2-q^2}.$

82 This operation seems not, at first, to answer our purpose; since having to find integer values of $$x$$ and $$y$$, we are brought to fractional results; and it would be required to solve this new question, - What numbers are we to substitute for $$p$$ and $$q$$, in order that the fraction may disappear? A question apparently still more difficult than our original one: but here we may employ a particular artifice, that will readily bring us to our object, which is as follows:

As every thing must be expressed in integer numbers, let us make $$\dfrac{ap^2+q^2}{ap^2-q^2}=m$$, and $$\dfrac{2pq}{ap^2-q^2}=n$$, in order that we may have $$x=ng-mf$$, and $$y=mg-naf$$.

Now, we cannot here assume $$m$$ and $$n$$ at pleasure, since these letters must be such as will answer to what has been already determined: therefore, for this purpose, let us consider their squares, and we shall find

$m^2=\dfrac{a^2p^4+2ap^2q^2+q^4}{a^2p^4-2ap^2q^2+q^4},$

and

$n^2=\dfrac{4p^2q^2}{a^2p^4-2ap^2q^2+q^4};$

and hence

\begin{align} m^2-an^2&=\dfrac{a^2p^4+2ap^2q^2+q^4-4ap^2q^2}{a^2p^4-2ap^2q^2+q^4}\\ &=\dfrac{a^2p^4-2ap^2q^2+q^4}{a^2p^4-2ap^2q^2+q^4}\\ &=1. \end{align}

83 We see, therefore, that tlie two numbers $$m$$ and $$n$$ must be such, that $$m^2=an^2+1$$. So that, as $$a$$ is a known number, we must begin by considering the means of determining such an integer number for $$n$$, as will make $$an^2+1$$ a square; for then $$m$$ will be the root of that square; and when we have likewise determined the number $$f$$ so, that $$af^2+b$$ may become a square, namely $$g^2$$ we shall obtain for $$x$$ and $$y$$ the following values in integer numbers;

$x=ng-mf,\qquad y =mg-naf;$

and thence, lastly, $$ax^2+b=y^2$$.

84 It is evident, that having once determined $$m$$ and $$n$$, we may write instead of them $$-m$$ and $$-n$$, because the square $$n^2$$ still remains the same.

But we have already shewn that, in order to find $$x$$ and $$y$$ in integer numbers, so that $$ax^2+b=y^2$$, we must first know a case, such that $$af^2+b$$ may be equal to $$g^2$$; when we have therefore found such a case, we must also endeavour to know, beside the number $$a$$, the values of $$m$$ and $$n$$, which will give $$an^2+1=m^2$$: the method for which shall be described in the sequel, and when this is done, we shall have a new case, namely, $$x=ng+mf$$, and $$y=mg+naf$$, also $$ax^2+b=y^2$$.

Putting this new case instead of the preceding one, which was considered as known; that is to say, writing $$ng + mf$$ for $$f$$, and $$mg + naf$$ for $$g$$, we shall have new values of $$x$$ and $$y$$, from which, if they be again substituted for $$x$$ and $$y$$, we may find as many other new values as we please: so that, by means of a single case known at first, we mav afterwards determine an infinite number of others.

85 The manner in which we have arrived at this solution has been very embarrassed, and seemed at first to lead us from our object, since it brought us to complicated fractions, which an accidental circumstance only enabled us to reduce: it will be proper, therefore, to explain a shorter method, which leads to the same solution.

86 Since we must have $$ax^2+b=y^2$$, and have already found $$af^2+b=g^2$$, the first equation gives us $$b=y^2-ax^2$$, and the second gives $$b=g^2-af^2$$; consequently, also, $$y^2-ax^2=g^2-af^2$$, and the whole is reduced to determining the unknown quantities $$x$$ and $$y$$, by means of the known quantities $$f$$ and $$g$$. It is evident, that for this purpose, we need only make $$x=f$$ and $$y=g$$; but it is also evident, that this supposition would not furnish a new case in addition to that already known. We shall, therefore, suppose that we have already found such a number for $$n$$, that $$an^2+1$$ is a square, or that $$an^2+1=m^2$$; which being laid down, we have $$m^2-an^2=1$$; and multiplying by this equation the one we had last, we find also

$y^2-ax^2=(g^2-af^2)\cdot(m^2-an^2) = g^2m^2-af^2m^2-ag^2n^2+a^2f^2n^2.$

Let us now suppose $$y=gm+afn$$, and we shall have

$g^2m^2+2afgmn+a^2f^2n^2-ax^2=g^2m^2-af^2m^2-ag^2n^2+a^2f^2n^2,$

in which the terms $$g^2m^2$$ and $$a^2f^2m^2$$ are destroyed; so that there remains

$ax^2=af^2m^2+ag^2n^2+2afgmn,$

or $$x^2=f^2m^2+2fgmn+g^2n^2$$. Now, this formula is evidently a square, and gives $$x=fm+gn$$. Hence we have obtained the same formulae for $$x$$ and $$y$$ as before.

87 It will be necessary to render this solution more evident, by applying it to some examples.

Question 1. To find all the integer values of $$x$$, that will make $$2x^2-1$$, a square, or give $$2x^2-1=y^2$$.

Here, we have $$a=2$$ and $$b=-1$$; and a satisfactory

case immediately presents itself, namely, that in which $$x=1$$ and $$y=1$$: which gives $$f=1$$ and $$g=1$$. Now, it is farther required to determine such a value of $$n$$, as will give $$2n^2+1=m^2$$; and we see immediately, that this obtains when $$n=2$$, and consequently $$m=3$$; so that every case, which is known for $$f$$ and $$g$$, giving us these new cases $$x=3f+2g$$, and $$y=3g+4f$$, we derive from the first solution, $$f=1$$ and $$g=1$$, the following new solutions:

$\begin{array}{r|l|l|l} x=f=1&5&29&169\\ y=g=1&7&41&239, \; \textrm{etc.} \end{array}$

88 Question 2. To find all the triangular numbers, that are at the same time squares.

Let $$z$$ be the triangular root; then $$\dfrac{z^2+z}{2}$$ is the triangle, which is to be also a square; and if we call $$x$$ the root of this square, we have $$\dfrac{z^2+z}{2}=x^2$$: multiplying by 8, we have $$4z^2+4z=8x^2$$; and also adding 1 to each side, we have

$4z^2+4z+1=(2z+1)^2=8x^2-1.$

Hence the question is to make $$8x^2+1$$ become a square; for, if we find $$8x^2+1=y^2$$, we shall have $$y=2z+1$$, and, consequently, the triangular root will be

$z=\dfrac{y-1}{2}.$

Now, we have $$a=8$$, and $$b=1$$, and a satisfactory case immediately occurs, namely, $$f=0$$ and $$g=1$$. It is farther evident, that $$8n^2+1=m^2$$, and if we make $$n=1$$, and $$m=3$$; therefore $$x=3f+g$$, and $$y=3g+8f$$; and since $$z=\dfrac{y-1}{2}$$, we shall have the following solutions:

$\begin{array}{r|l|l|l|l|l} x=f=0&1&6&35&204&1189\\ y=g=1&3&17&99&577&3363\\ z=\frac{y-1}{2}=0&1&8&49&288&1681,\;\textrm{etc.} \end{array}$

89 Question 3. To find all the pentagonal numbers, which are at the same time squares.

If the root be $$z$$, the pentagon will be $$=\dfrac{3z^2-z}{2}$$, which we shall make equal to $$x^2$$, so that $$3z^2-z=2x^2$$; then multiplying by 12, and adding unity, we have

$36z^2-12z+1 = (6z-1)^2 = 24x^2+1;$

also, making $$24x^2+1=y^2$$, we have $$y=6z-1$$, and $$z=\dfrac{y+1}{6}$$.

Since $$a=24$$, and $$b=1$$, we know the case $$f=0$$, and $$g=1$$; and as we must have $$24n^2+1=m^2$$, we shall make $$n=1$$, which gives $$m=5$$; so that we shall have $$x=5f+g$$ and $$y=5g+24f$$; and not only $$z=\dfrac{y+1}{y}$$, but also $$z=\dfrac{1-y}{6}$$, because we may write $$y=1-6z$$: whence we find the following results:

$\begin{array}{r|l|l|l|l} x=f=0&1&10&99&980\\ y=g=1&5&49&485&4801\\ z=\dfrac{y+1}{6}=\frac{1}{3}&1&\frac{25}{3}&81&\frac{2401}{3}\\ \textrm{or} \quad z=\dfrac{1-y}{6}=0&-\frac{2}{3}&-8&-\frac{242}{8}&-800, \; \textrm{etc.} \end{array}$

90 Question 4. To find all the integer square numbers, which, if multiplied by 7 and increased by 2, become squares.

It is here required to have $$7x^2+2=y^2$$, or $$a = 7$$, and $$b = 2$$; and the known case innnediately occurs, that is to say, $$x=1$$; so that $$x =f= 1$$, and $$y = g = 3$$. If we next consider the equation $$7n^2+1=m^2$$, we easily find also that $$n = 3$$ and $$m = 8$$; whence $$x = 8f + 3g$$, and $$y = 8g + 21f$$. We shall therefore have the following results:

$\begin{array}{r|l|l} x=f=1&17&271\\ y=g=3&45&717, \; \textrm{etc.} \end{array}$

91 Question 5. To find all the triangular numbers, that are at the same time pentagons.

Let the root of the triangle be $$p$$, and that of the pentagon $$q$$: then we must have $$\dfrac{p^2+p}{2}=\dfrac{3q^2-q}{2}$$, or $$3q^2-q=p^2+p$$; and, in endeavouring to find $$q$$, we shall first have

$q^2=\frac{1}{3}q+\dfrac{p^2+p}{3},$

and

$q=\frac{1}{6} \pm \surd\left(\frac{1}{36}+\dfrac{p^2+p}{3}\right),$

or

$q=\dfrac{1 \pm \surd(12p^2+12p+1)}{6}.$

Consequently, it is required to make $$12p^2+12p+1$$ become a square, and that in integer numbers. Now, as there is here a middle term $$12p$$, we shall begin with making $$p=\dfrac{x-1}{2}$$, by which means we shall have $$12p^2=3x^2-6x+3$$, and $$12p=6x-6$$; consequently, $$12p^2+12p+1=3x^2-2$$; and it is this last quantity, which at present we are required to transform into a square.

If, therefore, we make $$3x^2-2=y^2$$, we shall have $$p=\dfrac{x-1}{2}$$, and $$q=\dfrac{1+y}{6}$$; so that all depends on the formula $$3x^2-2=y^2$$; and here we have $$a=3$$, and $$b=-2$$. Farther, we have a known case, $$x=f=1$$, and $$y=g=1$$; lastly, in the equation $$m^2=3n^2+1$$, we have $$n=1$$, and $$m=2$$; therefore we find the following values both for $$x$$ and $$y$$, and for $$p$$ and $$q$$.

First, $$x=2f+g$$, and $$y=2g+3f$$; then,

$\begin{array}{r|l|l|l} x=f=1&3&11&41\\ y=g=1&5&19&71\\ p=0&1&5&20\\ q=\frac{1}{3}&1&\frac{10}{3}&12\\ \textrm{or} \quad q=0&-\frac{2}{3}&-3&-\frac{35}{3} \end{array}$

because we have also $$q=\dfrac{1-y}{6}$$.

92 Hitherto, when the given formula contained a second term, we were obliged to expunge it, but the method we have now given may be applied, without taking away that second term, in the following manner.

Let $$ax^2+bx+c$$ be the given formula, which must be a square, $$y^2$$, and let us suppose that we already know the case $$af^2+bf+c=g^2$$.

Now, if we subtract this equation from the first, we shall have $$a(x^2-f^2)+b(x-f)=y^2-g^2$$, which may be expressed by factors in this manner:

$(x-f)\cdot(ax+af+b)=(y-g)\cdot(y+g);$

and if we multiply both sides by $$pq$$, we shall have

$pq(x-f)(ax+af+b)=pq(y-g)\cdot(y+g),$

which equation may be resolved into these two,

1. $$p(x-f)=q(y-g)$$,
2. $$q(ax+af+b)=p(y+g)$$.

Now, multiplying the first by $$p$$, and the second by $$q$$, and subtracting the first product from the second, we obtain

$(aq^2-p^2)x+(aq^2+p^2)f+bq^2=2gpq,$

which gives

$x=\dfrac{2gpq}{aq^2-p^2} - \dfrac{(aq^2+p^2)f}{aq^2-p^2} - \dfrac{bq^2}{aq^2-p^2}.$

But the first equation is

$q(y-g) = p(x-f) = p\left(\dfrac{2gpq}{aq^2-p^2}-\dfrac{2afq^2}{aq^2-p^2}-\dfrac{bq^2}{aq^2-p^2}\right);$

so that

$y-g = \dfrac{2gp^2}{aq^2-p^2}-\dfrac{2afpq}{aq^2-p^2}-\dfrac{bpq}{aq^2-p^2};$

and, consequently,

$y=g\left(\dfrac{aq^2+p^2}{aq^2-p^2}-\dfrac{2afpq}{aq^2-p^2}-\dfrac{bpq}{aq^2-p^2}\right).$

Now, in order to remove the fractions, let us make, as before, $$\dfrac{aq^2+p^2}{aq^2-p^2}=m$$, and $$\dfrac{2pq}{aq^2-p^2}=n$$; and we shall have $$m+1=\dfrac{2aq^2}{aq^2-p^2}$$, and $$\dfrac{q^2}{aq^2-p^2}=\dfrac{m+1}{2a}$$; therefore

$x=ng-mf-\dfrac{b(m+1)}{2a},\quad \textrm{and} \quad y=mg-naf-\frac{1}{2}bn;$

in which the letters $$m$$ and $$n$$ must be such, that, as before, $$m^2=an^2+1$$.

93 The formulae which we have obtained for $$x$$ and $$y$$, are still mixed with fractions, since some of their terms contain the letter $$b$$; for which reason they do not answer our purpose. Buut if from those values we pass to the succceeding ones, we constantly obtain integer numbers; which, indeed, we should have obtained much more easily by means of the numbers $$p$$ and $$q$$ that were introduced at the beginning. In fact, if we take $$p$$ and $$q$$, so that $$p^2=aq^2+1$$, we shall have $$aq^2-p^2=-1$$, and the fractions will disappear. For then $$x=-2gpq+f(aq^2+p^2)+bq^2$$, and $$y=-g(aq^2+p^2)+2afpq+bpq$$; but as in the known case,$$af^2+bf+c=g^2$$,

we find only the second power of $$g$$, it is of no consequence what sign we give that letter; if, therefore, we write $$-g$$ instead of $$+g$$, we shall have the formulae

$$x=2gpq+f(aq^2+p^2)+bq^2$$, and
$$y=g(aq^2+p^2)+2afpq+bpq$$,

and we shall thus be certain, at the same time, that $$ax^2+bx+c=y^2$$.

Let it be required, as an example, to find the hexagonal numbers that are also squares.

We must have $$2x^2-x=y^2$$, or $$a=2$$, $$b=-1$$, and $$c=0$$, and the known case will evidently be $$x=f=1$$, and $$y=g=1$$.

Farther, in order that we may have $$p^2=2q^2+1$$, we must have $$q=2$$, and $$p=3$$; so that we shall have $$x=12g+17g-4$$, and $$y=17g+24f-6$$; whence result the following values:

$\begin{array}{r|l|l} x=f=1&25&841\\ y=g=1&35&1189,\; \textrm{etc.} \end{array}$

94 Let us also consider our first formula, in which the second term was wanting, and examine the cases which make the formula $$ax^2+b$$ a square in integer numbers.

Let $$ax^2+b=y^2$$, and it will be required to fulfil two conditions:

1. We must know a case in which this equation exists; and we shall suppose that case to be expressed by the equation $$af^2+b=g^2$$.
2. We must know such values of $$m$$ and $$n$$, that $$m^2=an^2+1$$; the method of finding which will be taught in the next chapter.

From that results a new case, namely, $$x=ng+mf$$, and $$y=mg+anf$$; this, also, will lead us to other similar cases, which we shall represent in the following manner:

$\begin{array}{r|l|l|l|l|l} x=f&A&B&C&D&E\\ y=g&P&Q&R&S&T, \; \textrm{etc.} \end{array}$
 in which $$A=ng+mf$$ $$B=nP+mA$$ $$C=nQ+mB$$ $$D=nR+mC$$ and $$P=mg+anf$$ $$Q=mP+anA$$ $$R=mQ+anB$$ $$S=mR+anC$$, etc.

and these two series of numbers may be easily continued to any length.

95 It will be observed, however, that here we cannot continue the upper series for $$x$$, without having the under one in view; but it is easy to remove this inconvenience, and to give a rule, not only for finding the upper series, without knowing the other, but also for determining the latter without the former.

The numbers which may be substituted for $$x$$ succeed each other in a certain progression, such that each term (as, for example, $$E$$), may be determined by the two preceding terms $$C$$ and $$D$$, without having recourse to the terms of the second series $$R$$ and $$S$$. In fact, since

\begin{align} E&=nS+mD\\ &=n(mR+anC)+m(nR+mC)\\ &=2mnR+an^2C+m^2C \end{align}

and $$nR=D-mC$$, we therefore find

$$E=2mD-m^2C+an^2C$$, or
$$E=2mD-(m^2-an^2)C$$; or lastly,
$$E=2mD-C$$, because $$m^2=an^2+1$$,

and $$m^2-an^2=1$$; from which it is evident, how each term is determined by the two which precede it.

It is the same with respect to the second series; for, since $$T=mS+anD$$, and $$D=nR+mC$$, we have $$T=mS+an^2R+amnC$$. Farther, $$S=mR+anC$$, so that $$anC=s-mR$$; and if we substitute this value of $$anC$$, we have $$T=2mS-R$$, which proves that the second progression follows the same law, or the same rule, as the first.

Let it be required, as an example, to find all the integer numbers, $$x$$, such, that $$2x^2-1=y^2$$.

We shall first have $$f=1$$, and $$g=1$$. Then $$m^2=2n^2+1$$, if $$n=2$$, and $$m=3$$; therefore, since $$A=ng+mf=5$$, the first two terms will be 1 and 5; and all the succeeding ones will be found by the formula $$E=6D-C$$: that is to say, each term taken six times and diminished by the preceding term, gives the next. So that the numbers $$x$$ which we require, will form the following series:

1, 5, 29, 169, 985, 5751, etc.

This progression we may continue to any length; and if we choose to admit fractional terms also, we might find an infinite number of them by the method which has been already explained.

#### Editions

1. Leonhard Euler. Elements of Algebra. Translated by Rev. John Hewlett. Third Edition. Longmans, Hurst, Rees, Orme, and Co. London. 1822.
2. Leonhard Euler. Vollständige Anleitung zur Algebra. Mit den Zusätzen von Joseph Louis Lagrange. Herausgegeben von Heinrich Weber. B. G. Teubner. Leipzig and Berlin. 1911. Leonhardi Euleri Opera omnia. Series prima. Opera mathematica. Volumen primum.