What is the maximum number of silver coins that we can obtain from $q$ gold coins? This seems to be trivial but I failed to find a clear mathematical proof for it.
You have initially $q$ gold coins, you can exchange $1$ gold coins for $a\geq1$ silver coins and you can exchange $b\geq1$ silver coin for $1$ gold coin. Starting with $q$ gold coins and no silver coins, and with no limits on the number of exchanges, what is the maximum number of silver coins you can get? ($a,b$ and $q$ are all natural numbers)
In case $a>b$ it is easy to show that you can get as many silver coins as you want, so basically the answer is infinite. And it is intuitively obvious that if $a\leq b$ the maximum number of silver coins will be $aq$, however I cannot come up with a clear way to prove it. How can I do it?
 A: The case $a > b$ is trivial as you say. For $a \le b$, it's clear that we can achieve $aq$ silver coins; here's a proof that we can't do any better than that.
Let $x$ denote the number of gold coins you have at any point in time, and $y$ denote the number of silver coins. Define a "score function" $f(x, y) = ax + y$.
If we make any legal move, the score of our position stays the same or decreases. We can prove this by manually checking both possible moves. $f(x-1, y+a) = a(x-1) + y + a = ax+y = f(x, y)$. For the other direction, $f(x+1, y-b) = a(x+1) + y - b = ax+y + a-b \le ax+y = f(x,y).$ Therefore, our score at the end of the game will be $\le$ our score at the start of the game, which is $f(q, 0) = aq$.
If we could somehow reach a position $(x,y)$ with $y > aq$, then the score of that position would be $f(x,y) = ax+y > ax+aq \ge aq$, where the last step holds because $a, x \ge 0$. That would contradict the conclusion from the previous paragraph. Therefore we can't get more than $aq$ silver coins.

The key idea in the above proof is: invent a score function that can never increase during the game, which lets us conclude that no sequence of moves can ever reach an end state with higher score than the starting position. This method is in my bag of problem-solving tricks because I've seen it a few times in the past. Off the top of my head I remember Conway's Soldiers but that's admittedly a pretty tricky (but cool!) application of this method.
