[Math] How to get only positive solution of a system of 4 variables and equations

algebraic-geometrydiophantine equationslinear algebrasystems of equations

I have a system of $4$ equations in $4$ variables:

\begin{align} x_1 + y_1 &= m\\
x_2 – y_1 &= n\\
x_1 – y_2& = o\\
x_2 + y_2 &= p\end{align}

$x_1, y_1, x_2, y_2$ are integer points on co-ordinate system (we need only positive points in the solution).

I want to have only the positive integer value for all the variables $(x_1, x_2, y_1, y_2)$.

Let's suppose \begin{align}m &= 3\\ n &= 10^9 – 1\\ o &= 10^9 – 3\\ p &= 2 \times 10^9 – 7\end{align}

So, the above equation get satisfied for the values:

\begin{align}x_1 &= -3\tag{here $x_1$ is negative}\\ x_2 &= 7\\ y_1 &= 6 \\ y_2 &= 0\end{align}

Whereas the following set of values also satisfies the equation:

\begin{align}x_1 &= 1\\ x_2 &= 3\\ y_1 &= 2\\ y_2 &= 4\tag{here none is negative}\end{align}

I just want to find out the solution which has non-negative integer values for all 4 variables (having $0$ in the solution set is fine, just avoid negative values) when $m, n, o$ and $p$ can be any given constant.

Conditions:
\begin{align}0 \leq x_1 \leq x_2 \leq 10^9\\
0 \leq y_1 \leq y_2 \leq 10^9\end{align}

Best Answer

If you subtract eq. $3$ from eq. $1$, you get $$ y_1 + y_2 = m -o $$ If you subtract eq. $2$ from eq. $4$, you get $$ y_1 + y_2 = p-n $$ and therefore $m-o = p-n$. Similarly, of you add eq. 1 and 2, you get $$ x_1 + x_2 = m+n $$ and if you add eq. 3 and 4, you get $$ x_1 + x_2 = p+o $$ And therefore $m+n=p+o$. Your condition was that all the $x$'s and $y$'s have to be non-negative, so $$ m+n=o+p \geq 0 \qquad \text{and} \qquad m-o = p-n \geq 0 $$ Subtracting these from each other leads us to $m - p \geq 0$. The second equation then tells us $$ m-p = o-n \geq 0 \qquad \Rightarrow \qquad o\geq n $$ So now we have the conditions $$ m \geq p \qquad \text{and} \qquad o \geq n $$ in order for the $x$'s and $y$'s to be positive. Therefore, if these conditions are fulfulled, it's possible to choose values for the $x$'s and $y$'s so that they are positive.

Related Question