1

Maybe this is a duplicate question (if so, can the moderators be kind enough to merge this appropriately?), but what is the condition on $a$ and $b$ for an expression $am+b$ to be divisible by $3$ ($a$ and $b$ are integers)? For example, I can say $16m+3$ is divisible by $3$ since $b=3$ is divisible by $3$ and for $m$ a multiple of $3$, $3|16m$. In the case of $176m+23$, I don't think it is divisible by $3$. Is this the case?

J. W. Tanner
  • 60,406
RTn
  • 299
  • $3m+3$ is divisible by $3$ for all integers $m$, while $2m+3$ and $2m+4$ are divisible by $3$ for some but not all integers $m$, and $3m+4$ is never divisible by $3$ for any integers $m$. Can you spot the pattern? – Henry May 26 '19 at 18:59
  • $b$ needs to be a multiple of 3 is the only condition then? – RTn May 26 '19 at 19:03
  • No: If $2m+3$ is an example in your terms then so is $2m+4$, and if not then not – Henry May 26 '19 at 19:04
  • So, either $3|b$ or $3|a+b$? That is all the pattern I can see unfortunately. But $2m+5$ is divisible by 3 for some $m$ too.. I can't locate anything useful! – RTn May 26 '19 at 19:06
  • 1
    Note: $176\times2+23$ is divisible by $3$ – J. W. Tanner May 26 '19 at 19:09
  • Use modular arithmetic to reduce $16m+3$ to $m$ and $176m+23$ to $2m+2$. In each case, which $m$s make the expressions equal to multiples of $3$? – John Douma May 26 '19 at 19:10
  • It's not clear what you are asking. Are you, say, asking: for which integers $m$ is $am+b$ divisible by $3$ for all integers $a,b$? The answer to that would be "there are no such $m$". Are you asking something else? – lulu May 26 '19 at 19:11
  • Since we can discard multiple of $3$, there are, effectively, only three possible values of $m$, namely ${0,1,2}$. For each of those you can easily determine which pairs $a,b$ yield numbers divisible by $3$. – lulu May 26 '19 at 19:13
  • 1
    I does look as though, as others are suggesting, that you are looking for modular arithmetic, which is a neat thing. Here divisibility by $3$ is in issue, but general modular arithmetic (which is not so difficult) deals with general issues of divisibility. You might like to look into it, as it solves this kind of problem very easily. In fact it is so powerful as an idea that it is a key issue in more abstract algebra too. – Mark Bennet May 26 '19 at 19:15
  • Thanks a lot all of you guys for the suggestions! Much love to all :-) – RTn May 26 '19 at 19:20
  • Recall that, in real (or rational) numbers, $y=mx+b$ has a unique zero ($x=-\frac bm$) when $m\ne0$; when $m=0$ and $b=0, y$ is zero for all $x$; and when $m=0$ and $b\ne0$, $y$ is zero for no $x$. An analogous result holds in modular arithmetic – J. W. Tanner May 26 '19 at 20:54
  • If 3|a and 3|b then 3|(am+b). If am+b=3q for some integer q then 3|(am+b) –  May 26 '19 at 21:57
  • Also ax $\equiv$ 3 (mod n) has a unique solution x iff gcd(a,n)|3. It is not true that if 3|(am+b) then 3|am or 3|b. Consider, 2(7)+4 =18 –  May 26 '19 at 22:01

4 Answers4

2

$am+b\equiv 0\mod 3\iff \bigl((a\mod 3)\cdot(m\mod 3)+(b\mod 3)\bigr)\equiv 0 \mod 3$.

So if you are given values for any two of $a,m,b$ you can deduce the requirement on the third unspecified variable by reducing the givens $\mod 3$.

2

If $\gcd(a,3)=1$, then there will always exist some $m$ so that $3\mid am+b$. This is because as $m$ ranges from $0$ to $n-1$, the value of $am$ will occupy all the congruence classes mod $3$. Conversely, if $\gcd(a,3)=3$ (which is the only other possibility since $3$ is prime), then if $3\mid b$ then $3\mid am+b$ for all integers $m$, whereas $3\nmid am+b$ for all integers $m$ if $3\nmid b$.

YiFan Tey
  • 17,431
  • 4
  • 28
  • 66
0

Note that $3|(176m+23)$ $\iff$ $176m \equiv 2 (mod 3)$ $\iff$ $gcd(176,3)|2$ And so there exists a solution m. You can verify that m=5 is a solution. Clearly not every integer is a solution. Take m=1 for example. Similarly, 16m+3 is not always divisible by 3. But 18m+3 is divisible by 3 for every integer m, can you see why?

  • May I know why this was downvoted? –  May 26 '19 at 23:48
  • it's wrong, 176m has to be 1 mod 3 because $1+2=3$ and 23 is 2 mod 3. Formatting could use consistency. –  May 27 '19 at 15:05
0

A basic principle is that if $3|v$, then $3|w \iff 3|v+w$. Furthermore, if $3|v$ then $3|nv$.

So $3|ma+b\iff3|ra+s,$ where $r$ is the remainder when $m$ is divided by $3,$

and $s$ is the remainder when $b$ is divided by $3$.

Now we have only $9$ possibilities to consider: $r=0, 1, $ or $2, $ and $s=0, 1, $ or $2$.

When $r=0$ and $s=0$, $ra+s=0$ is divisible by $3$.

When $r=0$ and $s=1$ or $2$, $ra+s=1$ or $2$ is not divisible by $3$.

When $s=0$ and $r=1$ or $2$, then $ra+s=ra$ is divisible by $3$ when $a$ is and not when $a$ is not.

When $r=1$ and $s=1,$ then $ra+s=a+1,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $2$ when divided by $3$.

When $r=1$ and $s=2,$ then $ra+s=a+2,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $1$ when divided by $3$.

When $r=2$ and $s=1,$ then $ra+s=2a+1,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $1$ when divided by $3$.

When $r=2$ and $s=2,$ then $ra+s=2a+2,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $2$ when divided by $3.$

J. W. Tanner
  • 60,406