# Solution of Diophantine equation $1+rn=l^2$

How can I find all the solutions of equation in $$n$$ and $$l$$, $$1+rn=l^2$$ where $$n$$ is non-square-free integer and $$r,l$$ are rationals with $$r$$ fixed.

Th question basically asks for what values of non-square-free integer $$n$$, $$1+rn$$ is the perfect square for given rational $$r$$.

For example, for $$r=4,n=2,l=3$$ is one of the solutions. I also know that this equation has infinite number of solutions for given $$r$$.

Note: If the above problem is difficult, you can also consider $$r$$ as a variable so that we seek the solution $$(r,n,l)$$.

• Are we finding n and l given r, or vice versa? – William Grannis Dec 22 '18 at 20:12
• Why would considering a constant as a variable make anything easier? – YiFan Dec 23 '18 at 1:24
• @YiFan: If we are allowed to choose $r$ as well as $n$, then in effect we can choose $rn + 1$ to be any perfect square, i.e. the solutions for $rn$ are simply one less than each (positive) perfect square (and $n$ could be any divisor of $rn$). So, yes, it can be a simplification. – hardmath Dec 23 '18 at 4:01
• @hardmath that would be finding solutions in that particular case. It won't help in the case of your given $r$. – YiFan Dec 23 '18 at 6:08
• @YiFan: I'm responding to your asking what difference it makes whether we treat $r$ as a (given) constant or as a variable (to be solved for). The latter simplifies the problem of finding all solutions. – hardmath Dec 23 '18 at 6:12

The first version of the problem asks for integer solutions $$n,\ell$$ of the equation:

$$1 + rn = \ell^2$$

where $$r$$ is a fixed rational number. Dietrich Burde has done the biggest part of solving this version by showing it reduces to an identical form with an integer $$r_1$$ replacing the rational $$r$$. However before we revisit that, let's fill in some details regarding all integer solutions, including non-positive integers $$n,\ell$$.

First the cases where zeros allowed are fairly easy. To get $$\ell = 0$$ one needs $$rn = -1$$, so that $$r$$ would have to take the form $$-1/n$$ for some nonzero integer $$n$$. To get $$n=0$$ we need $$\ell = \pm 1$$, and $$r$$ can be any rational number.

The cases where negative integers are allowed are also easy. Obviously when $$\ell$$ occurs in a solution, we can replace it with $$-\ell$$. Henceforth we will consider only $$\ell \ge 0$$ for convenience. The other point to make is that when $$n$$ is replaced by $$-n$$, one also needs to replace $$r$$ with $$-r$$ (unless $$n$$ or $$r$$ is zero).

Having made those observations, we can dispose of the second (easier) version of the problem, in which $$r$$ is treated as an unknown (rather than fixed) value to be solved for. The solutions, for arbitrary integer $$\ell$$ and nonzero integer $$n$$, are:

$$r = \frac{\ell^2 - 1}{n}$$

taken together with the cases $$n=0$$ already described.

It remains to understand the original version of the problem in which $$r$$ is a fixed (given) rational number. Without loss of generality (by virtue of our discussion above) we focus on cases $$r \gt 0$$. The problem can then be rephrased as asking for all the perfect squares $$\ell^2$$ that occur in the arithmetic progression $$1 + rn, \text{ for all } n\in \mathbb Z$$.

As mentioned, Dietrich Burde shows that solving this can be reduced to cases where $$r$$ is an integer. Specifically, if positive rational $$r$$ is in lowest terms $$r_1/r_2$$ (coprime $$r_1,r_2$$), then $$1 + rn = \ell^2$$ implies $$1 + r_1 k = \ell^2$$ with integer $$k = n/r_2$$. One way to see this is that with $$r_1,r_2$$ coprime, the only way for $$rn$$ to be an integer is for $$k=n/r_2$$ to be an integer.

So the perfect squares $$\ell^2$$ that appear in rational arithmetic sequence $$1+rn$$ are identical to those that appear in integer arithmetic sequence $$1+r_1 k$$, where $$n = r_2 k$$. At this point it is easy to construct an infinite number of solutions, namely by satisfying:

$$r_1 k = (\ell - 1)(\ell + 1)$$

either with a choice of $$(\ell - 1)$$ to be a multiple of $$r_1$$ or $$(\ell + 1)$$ to be a multiple of $$r_1$$. There can be additional solutions if $$r_1\gt 4$$ has more than one prime factor.

Cataloging all of them can be somewhat tedious, so let's begin with an example, $$r_1 = 12$$. The prime factors of $$r_1$$ can be split between $$(\ell - 1)$$ and $$(\ell + 1)$$ in various ways. The factors of $$2^2$$ will be met when $$(\ell - 1)$$ is even (equiv. when $$(\ell + 1)$$ is even). So only the factor $$3$$ needs to be accounted for, and thus these solutions can be exhausted by requiring $$\ell \equiv \pm 1 \bmod 6$$.

The general situation where $$r_1$$ has more than one prime factor can be analyzed in a similar fashion. If positive powers of $$2$$ divide $$r_1$$, then we can allocate them in the obvious way: all but (at most) one of them must either divide $$(\ell - 1)$$ or $$(\ell + 1)$$. It remains to allocate the odd prime factors of $$r_1$$. Since odd primes are greater than two, any odd prime factor would either divide $$(\ell - 1)$$ or $$(\ell + 1)$$, but not both. Note that the Chinese Remainder Theorem allows us to make an arbitrary allocation of distinct odd prime factors between them, and to combine any such partition with an allocation of the powers of two.

A more precise description of solutions therefore hinges on knowing the prime factorization of $$r_1$$. When that is available, it is not so much difficult as tedious to identify the complete family of solutions.

Let $$r=\frac{r_1}{r_2}$$ with coprime $$r_1$$ and $$r_2$$. Then $$1+rn=l^2$$ is equivalent to $$r_2+r_1n=r_2l^2$$ in integers, or $$r_1n=r_2(l+1)(l-1).$$ We can solve this equation in integers. First, since $$r_2\mid r_1n$$ and $$gcd(r_1,r_2)=1$$ we obtain $$r_2\mid n$$. So we can write $$n=kr_2$$, and we obtain $$r_1k=(l+1)(l-1).$$

• Since the goal is to find $\ell$ in the equation, the problem is now restated but not fully solved by asking what integer $k$ gives such a factorization. You are working at the end with integers, so I don't see how one can choose $\ell$ "arbitrarily". – hardmath Dec 22 '18 at 19:46
• Yes, this seems to be true. Let me think ... – Dietrich Burde Dec 22 '18 at 19:59
• – hardmath Dec 22 '18 at 20:25

Above equation shown below has parametric solution:

$$1+rn=l^2$$

$$r=2w(2k-1)$$

$$n=2w(k-2)$$

$$l=3w(k-1)$$

Where, $$w=[1/(k+1)]$$

For $$k=7$$ we get,

$$(r,n,l)=[(13/4),(5/4),(9/4)]$$

• $n$ has to be a positive integer. Though, I appreciate the rational parametrization. – ersh Dec 23 '18 at 13:32

Above equation shown below:

$$1+rn=l^2$$ ---------(A)

We have the identity given below,

$$[1+p*(p+2)]=(p+1)^2$$

Hence taking $$(r,n,l)=[(p),(p+2),(p+1)]$$

we get the general solution & all solution's to equation (A)

For $$p=11$$, we get $$(r,n,l)=(11,13,12)$$

• Welcome to Math.SE. You've posted two relatively brief Answers to the Question above. Perhaps this is intended, though it is possible you did not realize that new information could be edited into your earlier Answer. – hardmath Dec 23 '18 at 18:13
• FYI editing is only allowed for grammatical errors & not for technical mathematical discussion – Sam Dec 24 '18 at 1:08
• @Hardmath"Briefly explain your changes(corrected spelling, fixed grammar, improved formatting)" – Sam Dec 24 '18 at 1:37
• @hardmath. The above comment is pasted from "Math stack exchange" guidelines. Click on "edit" and you will see the info. – Sam Dec 24 '18 at 1:41
• Thanks for explaining your thinking. That is just a description of the (optional) field for annotating the purpose of your edit (it will be displayed in the Edit History, but not in the edited Answer text). This Help Center page on editing is primarily focused on when others can edit your post. See also How do I write a good Answer?, which says in part, "Remember, you can always go back at any time and edit your answer to improve it." Such edits often include new technical content. – hardmath Dec 24 '18 at 3:11

$$r = \frac{4 b}{d c h^2}$$ $$n = dec (h + b e)$$ $$l =\frac{h + 2 b e}{h}$$ if $$r=\frac{3}{5}$$ then $$b=3; d=4; h=1; c=5$$ or $$b=9; d=5; h=2; c=3$$ or ...