How can I check if a single equation with two variables can be solved with only integers?

107 Views Asked by At

How can I take a single equation, $k = \frac{132-n}{6n+1}$ and check if $k$ and $n$ can be solved as integers?

In this example, it's relatively easy to figure out by inspection that $k = 10$ and $n =2$, but for others, such as $\frac{100-n}{6n+1}$, there is no integer answers. Now I don't need to actually solve for $k$ and $n$, I just need to know if it's possible to get integer solutions for any given equation.

It also might be important to note that $k$ must be greater than or equal to $1$, so $n$ must be less than $132$ or $100$ depending on the example.

2

There are 2 best solutions below

0
On BEST ANSWER

Such equations are know as Diophantine Equations where we are interested only in the integer solutions.

One of the ways to solve such questions is by using the property that:

If $HCF(a,b)=c$ then $c$ can be expressed as a linear combination of a and b.

Now, let's convert you equation in a form where we can apply this property as follows: $$k=\frac{132-n}{6n+1}$$ $$\Rightarrow 6kn+k+n=132$$ $$\Rightarrow kn+k/6+n/6=22$$ $$\Rightarrow (k+1/6)(n+1/6)=22+1/36$$ $$\Rightarrow (6k+1)(6n+1)=793=1\times 793=13\times 61 $$ Thus, we get $$(k,n)=(0,132),(2,10),(132,0),(10,2)$$

Similarly using the same approach we can also find the solutions for the next equation. $$k=\frac{100-n}{6n+1}$$ $$\Rightarrow 6kn+k+n=100$$ $$\Rightarrow kn+k/6+n/6=100/6$$ $$\Rightarrow (k+1/6)(n+1/6)=100/6+1/36$$ $$\Rightarrow (6k+1)(6n+1)=601=1\times 601 $$ Thus, we get $$(k,n)=(0,100),(100,0)$$

To cross-check that we indeed have integer solutions for the above equation, see this.

But kindly see the below variant: $$(6k+1)(6n+1)=445=1\times 445 = 5\times 89$$ This will give you wrong results as in after this you will not have all the integer solutions. We need to consider the negative factors too. Luckily, in the above examples the negative factors didn't return any integer solution.

So, we proceed as follows: $$(6k+1)(6n+1)=445=1\times 445 = 5\times 89 = \boldsymbol{-1\times -445 = -5\times -89}$$ Thus, we get $$(k,n)=(0,74),(74,0), \boldsymbol{(-1,-15),(-15,-1)}$$

Hope this way you can solve other variants of these questions.

0
On

Noodle:

$k = \frac {132-n}{6n+1}$

$6k = \frac {6\cdot 132 - 6n}{6n+1} =\frac {6\cdot 132 + 1 - (6n+1)}{6n+1}= \frac {793}{6n+1} -1$.

So $6n+1|793=13\cdot 61$ so we have $6n+1 = \pm 1,\pm 13,\pm 61,\pm 793$

So $6n = (\pm 1 - 1), (\pm 13 - 1), (\pm 61 - 1), (\pm 793 - 1)$ but $6|6n$ so we must have those terms all be multiples of $6$.

So $6n = 0, 12, 60, 792$ and $n = 0,2, 10, 132$.

And $6k= \frac {793}{6n+1} -1= \frac {793}{1,13,61,793}-1=792, 60,12,0$ all of which are divisible by $6$ so

If $n=0,2,10,132$ then $k = 132,10,2,0$.