What is maximum value of $a b\mod c$ , where $a$ and $c$ are known. I need to find maximum value of $a b \mod c$ where values of $a$ and $c$ are given.
Eg: $a = 7 , c= 10 $
    By putting $b = 7$ we get maximum value as $9$.
 A: Hint $ $ By Bezout, $\,d :=\gcd(a,c)\,$ is the least value of $\,ax\bmod c = ax+cy,\,$ for integers $\,x,y$.
Thus $\, c - d\,$ is the greatest value since these values are closed under negation $\, n\mapsto c-n \pmod{\! c}$
Remark $\ \gcd(a,b)=1\!\iff\! {\rm lcm}(a,b) = ab\,$ is  analogously provable by exploiting an involution (reflection) symmetry, namely cofactor reflection (vs. negation reflection above).
A: Let
$$d = \gcd(a,c) \tag{1}\label{eq1}$$
By Bézout's identity, there exist integers $x$ and $y$ such that
$$ax + cy = d \tag{2}\label{eq2}$$
Since $d \mid c$, then $k = \frac{c-d}{d}$ is an integer. Multiplying both sides of \eqref{eq2} by $k$ gives
$$akx + cky = c - d \tag{3}\label{eq3}$$
This shows that if $b = kx$ gives $ab \equiv c - d \mod c$. Since $d$ divides $a$ and $c$, it must also divide $ab - mc$ for any integers $b$ and $m$. Since the next larger value than $c - d$ which is a multiple of $d$ is $c$, this shows that $c - d$ is the largest value you are looking for between $0$ and $c-1$, inclusive.
With your particular example, since $\gcd(7,10) = 1$, the largest values is $10 - 1 = 9$, as you've noticed.
