Solve single Linear Equation w/ Two Variables

111 Views Asked by At

Suppose you have a single linear equation like so:

ax + by + cxy = d

Where x and y are independent variables and a, b, c, and d are constants.

Is there an approach that can be taken to find x and y given just this single equation?

I am interested in integer solutions.

2

There are 2 best solutions below

1
On

If we let $x,y \in \Bbb{R}$, then there are infintely many solutions for this equation. Take any $x \in \Bbb{R}$ value, and calculate $y$ the following way: $$ax+by+cxy=d \\ y(b+cx)+ax=d \\ y(b+cx)=d-ax \\ y=\frac{d-ax}{b+cx}$$ For example, let $x=1$, then $y=\frac{d-a}{b+c}$.

However, if we need $x,y \in \Bbb{N}^+$, then for an $x \in \Bbb{N}^+$ it's necessary to have $y=\frac{d-ax}{b+cx} \in \Bbb{N}^+$. Assuming that $a,b,c,d \in \Bbb{N}^+$ we need $b+cx\ \vert\ d-ax$, which leads to the following congruency:

$$b+cx \equiv 0 \mod d-ax \\ cx \equiv -b \mod d-ax \\ cx \equiv d-ax-b \mod d-ax \\ (c+a)x \equiv d-b \mod d-ax$$ For an $x \in \Bbb{N}^+$ that solves this congruency, you can use the above formula for $y$ to obtain a solution.

2
On

If $ax + by + cxy = d $ then

$\begin{array}\\ \frac{d}{c} &=xy+\frac{a}{c}x+\frac{b}{c}y\\ &=xy+\frac{a}{c}x+\frac{b}{c}y+\frac{ab}{c^2}-\frac{ab}{c^2}\\ &=(x+\frac{b}{c})(y+\frac{a}{c})-\frac{ab}{c^2}\\ \text{so}\\ dc &=(cx+b)(cy+a)-ab\\ \end{array} $

so that $(cx+b)(cy+a) =cd+ab $.

Let $N = cd+ab$.

For each factorization $N = uv$, we want to solve $cx+b = u, cy+a = v$ or $x = (u-b)/c, y = (v-a)/c$.

If you want integer solutions with integer $a, b, c, d$, this gives enough restrictions to make finding solutions reasonable. In particu we must have $c | (u-b)$ and $c | (v-a)$ for each factorization.

If you want real solutions, we can construct a one-parameter set of solutions by setting $v = N/u$.

Then $x = (u-b)/c, y = (v-a)/c = (N/u-a)/c $ are all the solutions.