# Non-linear diophantine equation

Let $k$ and $n$ be positive integers and $y(n-x)=(k+nx)$.

What is the condition of $k$ and $n$ such that there exist positive integers $x, y$ as the solution of $y(n-x)=(k+nx)$?

Since $$y(n-x)=k+nx\iff y=\frac{k+nx}{n-x}=-n-\frac{n^2+k}{x-n}\ \text{and}\ x-n\not=0,$$ $x-n$ has to be a divisor $d$ of $n^2+k$.

Then, $$x=n+d,\ \ y=-n-\frac{n^2+k}{d}$$ are integers.

Hence, the answer is the following :

Condition of $k,n$ : There exists a divisor $d$ of $n^2+k$ such that $$n+d\gt 0\ \ \text{and}\ \ -n-\frac{n^2+k}{d}\gt 0.$$

By the way, if $d\gt 0$, then $-n-\frac{n^2+k}{d}\lt 0$, which is a contradiction. So, we have $d\lt 0$.

Hence, the above condition can be written as the following.

Condition of $k,n$ : There exists a negative divisor $d$ of $n^2+k$ such that $$d\gt -n.$$

• there is a mistake in my question and I have edited it. sorry about that. – Local L Sep 26 '14 at 13:20
• @LocalL: I edited my answer. – mathlove Sep 26 '14 at 14:33
• If k and n satisfy the condition, what is the general answer for x and y for positive integers x and y – Local L Sep 26 '14 at 14:47
• @LocalL: If there is such $d$, then $(x,y)=(n+d,-n+\frac{n^2+k}{d})$, which I wrote in my answer. – mathlove Sep 26 '14 at 14:49
• Since $n$ and $k$ are positive, your second condition certainly requires $d \gt 0$, in which case also $n+d \gt 0.$ So your condition becomes "There is a divisor $d$ of $n^2+k$ such that $0 \lt d \lt n+\frac{k}{n}.$ – Aaron Meyerowitz Sep 26 '14 at 17:00

I think you can make it easier. Equation:

$$y(q-x)=k+qx$$

Can be rewritten in this form. And lay on the multipliers.

$$(x-q)(y+q)=-k-q^2=ab$$

Then the solutions are.

$$x=q+a$$

$$y=b-q$$

• This is true, but to do it this way you see that exactly one of $a,b$ must be negative, it had better be $a$, and then the positive one, $b$ had better be bigger than $q=n.$ The question is when can you do this? – Aaron Meyerowitz Sep 28 '14 at 4:13
• @AaronMeyerowitz not necessarily once. You may be able to factor in different way. – individ Sep 28 '14 at 4:21
• I never said "once". Indeed there might be many solutions, in fact there is always the boring one $a=-1.$ – Aaron Meyerowitz Sep 28 '14 at 4:27

Given $n \gt 1$ and $k \gt 0,$ the equation $$y(n-x)=k+nx\tag{*}$$ always has the boring positive solution $x=n-1$ and $y=k+n(n-1).$

This is the case $e=1$ of the condition for a solution:

$$n^2+k \text{ has a divisor } 0 \lt e \lt n.$$

The solutions to (*) are the pairs $(x,y)=(n-e,\frac{n^2+k}{e}-n)$ as $e$ ranges over these divisors.

To prove this claim, follow the analysis of @mathlove:

A positive solution $x,y \gt 0$ to $y(n-x)=k+nx$ requires $n \gt x \gt 0.$ Any such $x$ will give a positive $y$, although it may not be an integer. To find the condition for $y$ to be an integer, let $e=n-x$ so that $$y=\frac{nx+k}{n-x}=\frac{n^2+k}{n-x}-n=\frac{n^2+k}{e}-n.$$

Note that $y \gt 0$ as long as $0 \lt e \lt n+\frac{k}{n},$ but $x=n-e \gt 0$ gives the stronger restriction $0 \lt e \lt n.$