# Find $x$ so that rational function is an integer

Find all rational values of $$x$$ such that $$\frac{x^2-4x+4}{x^2+x-6}$$ is an integer.

How I attempt to solve this: rewrite as $$x^2-4x+4=q(x)(x^2+x-6)+r(x)$$. If we require that $$r(x)$$ be an integer then we can get some values of $$r(x)$$ by solving $$x^2+x-6=0$$, so that $$x=-3$$ or $$x=2$$. In the former case, $$r=25$$, and in the latter case $$r=0$$.

[I should note, however, that I'm not really convinced that this step is actually correct, because when $$x$$ is a root of $$x^2+x-6$$, the rational function above can have no remainder due to division by $$0$$. But I read about it as a possible step here and I can't explain it. Q1 How can this be justified?]

Now we want $$(x^2+x-6)$$ to divide $$0$$ (trivial) or $$x^2+x-6$$ to divide $$25$$. So we set $$x^2+x-6=25k$$ for some integer $$k$$ and solve. So $$x=\frac12 (\pm5\sqrt{4k+1}-1)$$

One of the trial-and-error substitutions for $$k$$ and then for $$x$$ gives $$x=-8$$, but that is just one number. Q2: So I'm wondering, how can we find all such $$x$$? The condition here is that $$4k+1$$ must be a perfect square, $$k\ge 0$$. Aren't there infinitely many perfect squares of this form?

I'd appreciate some clarifications about these two questions, Q1 and Q2.

• Why not cancelling $x-2$ ?? – IrbidMath Oct 24 '19 at 1:10
• If you cancel then $\frac{x-2}{x+3}=1+\frac{-5}{x+3}$ – IrbidMath Oct 24 '19 at 1:25
• @AmerYR I understand. Or you could say $\frac{x-2}{x+3}=k$ for some integer $k$ and then solve and get $x=\frac{2+3k}{1-k}$. So, again, we will get a formula for $x$, but actually this formula is better than what I got in my question. So maybe this is the solution itself. – sequence Oct 24 '19 at 1:26
• We get just $x=-8$ the other choice is impossible zero of the denominator – IrbidMath Oct 24 '19 at 1:28
• @AmerYR While your observation does help for this problem, I'm wondering if there is a more general approach to this sort of problems. Suppose we couldn't factor and cancel any factors, then how would we proceed? – sequence Oct 24 '19 at 1:30

$$\frac{x^2-4x+4}{x^2+x-6}=\frac{x-2}{x+3}=1-\frac{5}{x+3}$$, for this to be an integer, $$\frac{5}{x+3}$$ has to be an integer.

Say, $$\frac{5}{x+3}=K$$, where $$K \in \Bbb Z$$. This implies for each $$K \in \Bbb Z$$, $$x=\frac{5}{K}-3$$ would make the given expression an integer.

For $$x \neq 2$$ is $$\frac{x^2-4x+4}{x^2+x-6}=\frac{x-2}{x+3}=1-\frac{5}{x+3}.$$

To obtain an integer with an integer $$x,\;$$ $$x+3$$ must be a divisor of $$5,$$ or equivalently $$x+3 \in \{-1,1,-5,5\}.$$
This gives the solutions $$-4,-2$$ and $$8,$$ because $$x=2$$ is excluded.

• This gives integer solutions, but not all $x$, because there are also rational solutions (for example, $x=-\frac12, x=-\frac{11}{2}$, etc). – sequence Oct 24 '19 at 23:25
• You're right, I've overlooked the "rational". – user376343 Oct 25 '19 at 7:55

If we want $$x$$ rational such that $$\frac{x^2-x+3}{x^2+5x-7}$$ is integer I will simplify $$1+\frac{-6x+10}{x^2+5x-7}$$ Then I will go let $$a/b$$ with gcd 1 then I will search for solutions to $$a^2+5ab-7b^2\mid -6ab+10b^2$$

Number theory .

The set of all solutions can be described as $$5n=k(m+3n)$$, where $$m \neq -3n$$ and $$m \neq 2n$$ and $$m,n,k \in \mathbb Z$$. When solutions of the above are plugged into $$x= \dfrac {m}{n}$$ then those x´s are the required ones.

• In the comments I also wrote that the solution can be expressed as $x=\frac{2+3k}{1-k}$, which seems to be more straightforward. – sequence Oct 24 '19 at 2:01
• Yes, that seems even better if that expression covers all the cases covered by expression in this answer. – user716491 Oct 24 '19 at 2:03