Prove that if b is coprime to 6 then $b^2 \equiv 1 $ (mod 24)

Let $\gcd(b,6) = 1$. Prove that $b^2 \equiv 1 $ (mod 24).

Now I have that as $\gcd(b,6) = 1$, we know that $3\nmid b $ and $2\nmid b$ (else the GCD would be 3 or 2 resp.)

So as $2\nmid b$, $b$ must be odd. Hence $b^2$ is also odd.

Then I'm not sure where to take it from here? Maybe I've gone down the wrong path to start with, and should be looking more along the lines of the Chinese Remainder Theorem? I'm not sure.


Hint $\rm\ 3\nmid b,\,$ so $\rm\, mod\ 3\!:\ b\,\equiv\, \pm1\ \ \Rightarrow\ \ b^2\equiv 1$

$\rm\ \ and \ \ 2\nmid b,\,$ so $\ \rm mod\ 8\!:\, b\equiv \pm1,\pm3\,\Rightarrow b^2\equiv1,\ $ so $\rm\,\ 3,8\mid b^2\!-\!1 \Rightarrow\, 3\cdot 8\mid b^2\!-\!1$

Remark $\ $ More generally see the Carmichael function.


Starting with $b$ is odd, so $b = 2k + 1$, and $b^2 - 1 = 4k^2 + 4k = 4k(k+1)$ clearly divisible by $8$. So we need to show that $b^2 - 1$ is divisible by$3$. Since $b$ is not divisible by $3$, $b = 3k + 1$ or $b = 3k +2$. If $b = 3k + 1$, then $b - 1 = 3k$ and $3 | b - 1$, so $3 | b^2 - 1$. And if $b = 3k + 2$, then $b + 1 = 3k + 3$ which is divisible by $3$. So $3 | (b +1 )(b - 1) = b^2 - 1$. So $3 | b^2 - 1$ and since $gcd(3,8) = 1$, $24 | b^2 - 1$.