Note: This is not a duplicate of Understanding a proof that $17\mid (2x+3y)$ iff $17\mid(9x +5y)$ or Understanding a proof that $2x + 3y$ is divisible by $17$ iff $9x + 5y$ is divisible by $17$.
I was reading through Naoki Sato's notes on number theory. I am somewhat unsatisfied with the given solution to this problem:
Example. Let $x$ and $y$ be integers. Prove that $2x + 3y$ is divisible by $17$ iff $9x + 5y$ is divisible by $17$.
Solution. $17 \mid 2x + 3y \Rightarrow 17 \mid 13(2x + 3y)$, or $17 \mid 26x + 39y \Rightarrow 17 \mid 9x + 5y$, and conversely, $17 \mid 9x + 5y \Rightarrow 17 \mid 4(9x + 5y)$, or $17 \mid 36x + 20y \Rightarrow 17 \mid 2x + 3y$.
I do understand the solution but it seems like an unmotivated approach. How would one get the numbers $13$ and $4$ except for clever guessing? Is there a general method for solving such problems? That is, some theorem that trivializes such problems. I don't know much about modular arithmetic but I've noticed that $13$ and $4$ are inverses modulo $17$, i.e. $17 \cdot 4 \equiv 1 \pmod{17}$. I believe it might have something to do with that.