I am working on the following diophantine equation $7x - 5y = -4$ for which I am looking for positive values, specifically that $(x,y) = (3, 5)$. I think I am getting confused with changing signs from the original definition.
My approach:
Using euclidean algorithm we find that: $1 = -2(7) + 3(5)$. Multiplying both sides with $-4$ we get:
$-4 = 8(7) - 12(5)$
This means that we have a solution $(x_0, y_0) = (8, -12)$
The format for all solutions then is:
$x = 8 + n \cdot \frac{lcm(5,7)}{7} = 8 + n \cdot \frac{35}{7} = 8 + 5n$
$y = -12 - n \cdot \frac{lcm(5,7)}{-5} = -12 + n \cdot \frac{35}{-5} = -12 + 7n$
But from these, I can't get $(x,y) = (3,5)$ which is a valid solution to the equation by replacing values for $n$. E.g. for $n = -1$ I get $x = 3$ but $y = -19$
What am I doing wrong here?
From the fact that $-4=8\times7-12\times5$, what you get is that $(8,12)$ is a solution, not $(8,-12)$. And therefore $(8-5,12-7)$ is also a solution. That is, $(3,5)$ is also a solution.