# Finding rational solutions to a function with integer inputs

I'm trying to find rational solutions to the equation $$f(x) = \frac{1-x+\sqrt{5x^2-2x+1}}{2x};\{ x \in \mathbb{N} \}$$

The only operation that could produce an irrational answer is the square root, so I figure all I need to do is find rational solutions to

$$y = \sqrt{5x^2-2x+1}$$

which I think can be further adjusted to say: $$y^2= 5x^2-2x+1; \left \{x \in \mathbb{N} \ \text{and} \ y \in \mathbb{Q} \right \}$$

(excuse my notation if it's wrong) Without the $-2x$, it looks like another similar problem I've done where I've used Pell's equation to solve it, but this is a little different. How do I find the integer solutions? Can it be solved with pells equation?

• You have $5x^2-2x+1=4x^2+x^2-2x+1=(2x)^2+(x-1)^2$, now apply Pythagoras if possible... – abiessu May 22 '17 at 19:27
• @abiessu when you say apply Pythagoras, do you mean use a generating function to find Pythagorean triples? – Ryan May 22 '17 at 19:52
• I mean that you have $y^2=a^2+b^2$, and you know the form that $a$ and $b$ take on. I would use the $p,q$ form to find a way to match up with $2x$ and $x-1$... – abiessu May 22 '17 at 19:56
• @abiessu P,q... are you are referring to euclids formula, letting $a = (2x)^2 = p^2 - q^2$ and $b= (x-1)^2 = 2pq$ then solving for x using a system of equations? It would only leave me with another expression that introduces two new variables under a square root... Im sorry I don't understand where you're going with that – Ryan May 22 '17 at 20:26

$5x^2 - 2x + 1 -y^2 = 0 \implies \triangle' = (-1)^2 - 5(1-y^2) = 5y^2 -4 = m^2\implies 5y^2 - m^2 = 4$. This Pell equation has initial solution $(m,y) = (\pm 1, \pm 1)$. You can google the full solution set on the internet. Check out Lenstra's Pell equation notes.

• How can you do that if Pell's equation takes the form $x^2 - ny^2 = 1$ and the equation has the additional $-2x$ term? – Ryan May 22 '17 at 20:34

If you let $y=\dfrac{p}{q}$, $p,\,q\in\mathbb{Z}$, and complete the square on the polynomial under the radical you get

$$\sqrt{\frac{(5x-1)^2+4}{5}}=\frac{p}{q}$$

then you have

$$\frac{(5x-1)^2+4}{5}=\frac{p^2}{q^2}$$

Letting $r=5x-1$ this transforms into the question solving for $p,\,q,\in\mathbb{Z}$, $r\in\mathbb{Q}$ satisfying

$$(r^2+4)q^2=5p^2$$