# Generate integer solutions from a hyperbolic equation

I want to generate any integer solution from the equation $\sqrt{8r^2+1} = n$. I know there are integer solutions to this, but I have no idea how to approach this. (When working with whole numbers) Since division and square roots are the only operations that can turn a whole number to a fraction, I thought I would be able to manipulate it to get rid of those operations, but any manipulating of the equation gets me nowhere closer and it seems I simply lack the mathematical understanding to solve this. Is there any way to solve this problem?

Another way to express this is to write $s=2r$ and look for integer solutions to $$n^2-2s^2=1,$$ with $s$ even and $n$ positive. This is known as a Pell equation, and its solutions are well understood. It is known that the solutions $(n,s)$ with $n$ positive and $s$ even are precisely the pairs of the form $$n+s\sqrt{2}=(3+2\sqrt{2})^k,$$ for some integer $k$.

To show that every such pair $(n,s)$ is a solution to $n^2-2s^2=1$ is not too difficult, but to show that every solution is of this form requires some more advanced number theory (i.e. some ring theory and perhaps Dirichlet's unit theorem).

EDIT: If you are only interested in finding a single integer solution to this equation, then by simple trial and error with small values of $r$ and $n$ you will find one very quickly.

• Care to explain the downvote? Jan 11, 2017 at 21:52
• Insightful, thank you I will look into it
– Ryan
Jan 11, 2017 at 21:55

The solutions to $$x^2 - 8 y^2$$ begin $$(1,0), \;\; (3,1), \;\; (17,6), \; \; (99,35), \cdots$$ and continue forever with $$x_{n+2} = 6 x_{n+1} - x_n,$$ $$y_{n+2} = 6 y_{n+1} - y_n.$$

In turn, these come from a matrix that gives an automorphism of the quadratic form, $$A = \left( \begin{array}{cc} 3 & 8 \\ 1 & 3 \end{array} \right)$$ The automorphism property is $$\left( \begin{array}{cc} 3 & 1 \\ 8 & 3 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & -8 \end{array} \right) \left( \begin{array}{cc} 3 & 8 \\ 1 & 3 \end{array} \right) = \left( \begin{array}{cc} 1 & 0 \\ 0 & -8 \end{array} \right),$$ where $A$ is the "smallest" matrix that works.

This allows us to write each $x,y$ ordered pair as a column vector, with $$\left( \begin{array}{c} x_{n+1} \\ y_{n+1} \end{array} \right) = \left( \begin{array}{cc} 3 & 8 \\ 1 & 3 \end{array} \right) \left( \begin{array}{c} x_n \\ y_n \end{array} \right).$$ The two separate linear recurrences above are the result of applying the Cayley-Hamilton Theorem using $A,$ which satisfies $A^2 - 6 A + I = 0.$

x:  3  y:  1 ratio: 3  SEED   BACK ONE STEP  1 ,  0
x:  17  y:  6 ratio: 2.83333
x:  99  y:  35 ratio: 2.82857
x:  577  y:  204 ratio: 2.82843
x:  3363  y:  1189 ratio: 2.82843
x:  19601  y:  6930 ratio: 2.82843
x:  114243  y:  40391 ratio: 2.82843
x:  665857  y:  235416 ratio: 2.82843
x:  3880899  y:  1372105 ratio: 2.82843
x:  22619537  y:  7997214 ratio: 2.82843


=====================================================

If we switch the right hand side, things immediately get a little different. Here we do $x^2 - 8 y^2 = 17.$ The recurrence deals with every second solution:

x:  5  y: -1
x:  5  y:  1 ratio: 5  SEED   KEEP +-
x:  7  y:  2 ratio: 3.5  SEED   BACK ONE STEP  5 ,  -1
x:  23  y:  8 ratio: 2.875
x:  37  y:  13 ratio: 2.84615
x:  133  y:  47 ratio: 2.82979
x:  215  y:  76 ratio: 2.82895
x:  775  y:  274 ratio: 2.82847
x:  1253  y:  443 ratio: 2.82844
x:  4517  y:  1597 ratio: 2.82843
x:  7303  y:  2582 ratio: 2.82843
x:  26327  y:  9308 ratio: 2.82843
x:  42565  y:  15049 ratio: 2.82843
x:  153445  y:  54251 ratio: 2.82843
x:  248087  y:  87712 ratio: 2.82843
x:  894343  y:  316198 ratio: 2.82843
x:  1445957  y:  511223 ratio: 2.82843
x:  5212613  y:  1842937 ratio: 2.82843
x:  8427655  y:  2979626 ratio: 2.82843

Wed Jan 11 17:28:11 PST 2017

x^2 - 8 y^2 = 17


==========================================

• this alone doesn't make sense, but after reading up on pell equations I see this is the generating sequence for it, thank you!
– Ryan
Jan 11, 2017 at 21:53
• Just wondering, how did you come up with the two equations you provide in your answer?
– Ryan
Jan 11, 2017 at 22:44