Proving facts about largest and smallest numbers in set of linear combinations The problem is as follows: Let $a$, $b \in \mathbb{Z}^+$ be relatively prime. Suppose $r = am + bn$ for some integers $m$, $n$ s.t. $1 <= m <= b-1$ and $1 <= n <= a-1$. Define $P(a,b) = \{am + bn \mid m, n \in \mathbb{N}\}$.
Then there are 2 parts:
a) Prove that $r$ is the smallest integer in $P(a,b)$ that is congruent to $r$ mod $ab$.
b) Find and give proof for the smallest integer $s$ in $P(a,b)$ that is congruent to $-r$ mod $ab$.
I really don't know what to do, for part a I tried to use some facts about Linear Diophantine Equations- which is the section immediately preceding these problems in my textbook- to show that any integer $q$ in $P(a,b)$ which is smaller than $r$ cannot also be congruent to $r$. No luck with that approach, and I don't have any other ideas.
For part b I think the answer is that $s = (b-m)a + (a-n)b$, where $m$ and $n$ are from the definition of $r$. But again, I'm not sure how to prove it, or really where to begin even.
Any suggestions would be greatly appreciated, thank you! And I'd be happy to clarify the question if my statement of it is unclear.
 A: Let $(m_1, n_1)$ be another pair of positive integers where $am_1 + bn_1 \equiv r \pmod{ab}$. This then gives
$$\begin{equation}\begin{aligned}
am_1 + bn_1 & \equiv am + bn \pmod{ab} \\
a(m_1 - m) + b(n_1 - n) & \equiv 0 \pmod{ab}
\end{aligned}\end{equation}\tag{1}\label{eq1A}$$
This means both $a$ and $b$ must divide the left side of \eqref{eq1A}. Since $a \mid a(m_1 - m)$, then $a \mid b(n_1 - n)$. However, as $a$ and $b$ are relatively prime, then $a \mid n_1 - n \implies n_1 = n + ka, \; k \in \mathbb{Z}$. Since $1 \le n \le a - 1$, if $n_1$ were smaller than $n$, then $n_1 \lt 0$, which is not allowed. Thus, $n_1$ must be larger than $n$. Similarly, $m_1$ is also larger than $m$, showing $r$ is the smallest integer in $P(a, b)$ congruent to $r$ modulo $ab$.
As for part (b), let $(m_2, n_2)$ be a pair of positive integers where $s = am_2 + bn_2 \equiv -r \pmod{ab}$. This then gives
$$\begin{equation}\begin{aligned}
am_2 + bn_2 & \equiv -(am + bn) \pmod{ab} \\
a(m_2 + m) + b(n_2 + n) & \equiv 0 \pmod{ab}
\end{aligned}\end{equation}\tag{2}\label{eq2A}$$
As done before, we get $b \mid m_2 + m$. Since $1 \le m \le b - 1$, the smallest positive value for $m_2 + m$ is $b$, giving $m_2 = b - m$. Likewise, $n_2 = a - n$. Thus, your suggested answer is correct, i.e.,
$$s = (b - m)a + (a - n)b \tag{3}\label{eq3A}$$
is the smallest such value.
