Solving a system of equations with an absolute value term

925 Views Asked by At

$x$ and $y$ are two integer numbers and $x \geq y$. The values of $x$ and $y$ are positive or negative integers. When the sum of these two numbers are multiplied by $y$ we obtain $P$ and when the absolute value of the subtraction of these two numbers is multiplied by $x$ we obtain $Q$. Given $P$ and $Q$ we need to find the value of $x$ and $y$. An input example: $(160, 48)$ output: $(12, 8)$

I'm trying to solve this by systems, but I don't know how to solve it when there's this absolute value of $x-y$.

1

There are 1 best solutions below

2
On BEST ANSWER

We have the equation $$y(x+y) = p$$ and $$x|x-y| = x|y-x| = q.$$

But since $x \geq y$ then $x-y$ will always be positive so $$|x-y| = x-y.$$

Hence our system becomes $$x(x-y) = q \quad \text{and} \quad y(x+y) = p$$

Can you solve this quadratic system now?