4

\begin{gather} \frac{N^2+N}{2} \equiv 0 \pmod 4 \\ N^2+N\equiv 0\\ (N+\frac{1}{2})^2-\frac{1}{4}\equiv 0\\ 4(N+\frac{1}{2})^2-1\equiv 0\\ 2^2(N+\frac{1}{2})^2\equiv 1\\ (2N+1)^2\equiv 1 \\ 2N+1 \equiv 1\\ 2N=0\\ N=2,4,6,8...\\ 2N+1 \equiv 3\\ 2N=2\\ N=1,3,5,7...\\ \end{gather} In other words I've shown $\forall N >0 \to \frac{N^2+N}{2} \equiv 0 \pmod 4$, which is false e.g. for $N=3$, $\frac{N^2+N}{2}$ has a remainder of 2

I'd like a correct solution as well. Thanks.

Bill Dubuque
  • 272,048
  • 4
    What is 1/2 in mod4 arithmetic? And what is 1/4? – Peter Feb 18 '21 at 06:34
  • @Peter I multiplied by four to get rid of them. –  Feb 18 '21 at 06:39
  • 4
    But 4 = 0, and anything multiplied by 0 is 0 – Peter Feb 18 '21 at 06:41
  • @Peter . So how do I solve this? –  Feb 18 '21 at 06:45
  • if division by zero is allowed, then all numbers are equal. If you can't, then you can't have 1/4 at any step. Similarly for 2 $(=\sqre{0})$ – Peter Feb 18 '21 at 06:47
  • 4
    You are assuming $\frac 12$ and $\frac 14$ are well defined. They are not. If $\frac 12\equiv m\pmod 4$ and $\frac 14\equiv n \pmod 4$ exists then $2m\equiv 1 \pmod 4$ and $4n \equiv 1 \pmod 4$. But there are no such equivalence classes in $\mathbb Z/4\mathbb Z $. – fleablood Feb 18 '21 at 07:13

4 Answers4

6

Your first error is that you you scaled by $\,2,\,$ which is not invertible $\!\bmod 4,\,$ so this will not yield an equivalent congruence. Rather, it yields necessary but not sufficient conditions on roots (so possibly extraneous roots). See here for more on the insufficiency of unidirectional inferences.

To get an equivalent congruence we need to scale the modulus too, since $\,4\mid a/2\iff 8\mid a,\,$ so

$$(n^2+n)/2\equiv 0\!\!\!\pmod{4}\iff n^2+n\equiv 0\!\!\!\pmod{8}\qquad$$

Now we can complete the square as you did, but since this too involves scaling the modulus, this will end up being fruitless, leading back to where we started, namely

$$\begin{align} n^2+n&\equiv 0\pmod{8}\\ \iff\ \ \ \ \ \ \ 4n^2+4n&\equiv 0\pmod{32}\\ \iff 4n^2+4n+1&\equiv 1\pmod{32}\\ \iff \ \ \ \ \ \, \color{#c00}{(2n+1)^2}&\:\color{#c00}{\equiv 1}\pmod{32}\\ \iff (2n)(2n+2)&\equiv 0\pmod{32}\\ \iff\ \ \ \ \ \ \ n(n+1)&\equiv 0\pmod{8} \end{align}\qquad$$

where we solved $\,\color{#c00}{a^2\equiv 1}\,$ by factoring the difference of squares $\,0\equiv a^2-1\equiv (a-1)(a+1).\,$ You can't simply take square roots as you did, e.g. $\,x^2\equiv 1\pmod{8}\,$ has $4$ roots $\,x\equiv 1,3,5,7$.

Instead, by $\,n,\,n\!+\!1\,$ coprime, $\,8\mid n(n\!+\!1)\iff 8\mid n\,$ or $\,8\mid n\!+\!1,\,$ thus we conclude that $\,n(n+1)/2\equiv 0\pmod{4}\iff n\equiv 0,7\pmod{8}$

Finally, beware that modular fractions are well-defined (uniquely exist) only when they are writable with denominator coprime to the modulus, when $\,a/b := ab^{-1}.\,$ For more on modular fractions see here and here.

Bill Dubuque
  • 272,048
3

What you did incorrectly is basically explained in Peter's answer, and several question comments. Note, though, the more general issue when manipulating congruences, since you are really dealing with integers, is that involving "fractions" of the form $\frac{p}{q}$ where $\gcd(p,q) = 1$, really means the division by $q$ is multiplying by its modulo multiplicative inverse, i.e., $q^{-1}$. However, only integers which are relatively prime to the modulus have inverses. Since $\gcd(4, 4) = 4 \neq 1$ and $\gcd(4, 2) = 2 \neq 1$, neither $2$ nor $4$ have an inverse in modulo $4$, so while working in that modulus you can't, in general, just "divide" by either value, e.g., $\frac{1}{2}$ and $\frac{1}{4}$ don't make sense.

As for how to correctly solve your congruence equation, note for any solution $N$, there's some integer $j$ where

$$\begin{equation}\begin{aligned} & \frac{N^2 + N}{2} \equiv 0 \pmod{4} \iff \frac{N^2 + N}{2} = 4j \iff \\ & N^2 + N = 8j \iff N^2 + N \equiv 0 \pmod{8} \end{aligned}\end{equation}\tag{1}\label{eq1A}$$

Due to $N$ and $N + 1$ being relatively prime to each other, with one being odd and one being even, then since $8 = 2^3$ has only prime factors of $2$, this then gives

$$\begin{equation}\begin{aligned} & N(N + 1) \equiv 0 \pmod{8} \implies \\ & (N \equiv 0 \pmod{8}) \lor (N + 1 \equiv 0 \pmod{8}) \implies \\ & N \equiv 0, 7 \pmod{8} \end{aligned}\end{equation}\tag{2}\label{eq2A}$$

This means the allowed values for $N$ are $N = 8k$ and $N = 8k + 7$ for any $k \in \mathbb{Z}$.

John Omielan
  • 47,976
  • If $N^2+N= 8j=4(2j)$ isn't $N^2+N\equiv 0 \pmod 4$ and $N\equiv 0,3 \pmod 4$ –  Feb 21 '21 at 15:42
  • @user716881 Yes, $N \equiv 3 \pmod{4}$ is necessary, but it's not sufficient. Consider if $N \equiv 3 \pmod{4}$ but $N \not\equiv 7 \pmod{8}$, i.e., $N = 8k + 3$. Then $N^2 + N \equiv 3^2 + 3 \equiv 12 \equiv 4 \not\equiv 0 \pmod{8}$. – John Omielan Feb 21 '21 at 15:52
  • $N\equiv 3 \pmod 4 \to N\equiv 6 \pmod 8 $ which is not true. $N\equiv 7 \pmod 8 \to 14 \pmod {16}$. For $N=14$ $\frac{N^2 + N}{2} = 105 \equiv 9 \pmod {16}$ which is not 14 –  Feb 21 '21 at 16:13
  • @user716881 Note $N \equiv 3 \pmod{4}$ means there's a $k$ where $N - 3 = 4k \implies 2N - 6 \equiv 8k \implies 2N \equiv 6 \pmod{8}$, not $N \equiv 6 \pmod{8}$. Likewise, for your statement about $N \equiv 7 \pmod{8}$ implying $N \equiv 14 \pmod{16}$. – John Omielan Feb 21 '21 at 19:50
0

In arithmetic mod $4$, you cannot divide by $4$ or $2$. It is like dividing by $0$ in normal arithmetic; you can write the expression but there is no number that is equal to it.

If you divide and multiply by zero you can prove that all numbers are equal. This is of course inconsistent with our normal arithmetic, and also with modular arithmetics. The reason is that you cannot divide by zero.

If you allow division by zero you get the uninteresting arithmetic where there is only a single number.

Note that the second line is a legal equation, and its solutions, by trial and error, are $3$ and $4$.

Your example is interesting in the way it disguises $0$ as $4$, and also as $2$, since $2=\sqrt{4}=\sqrt{0}=0$.

I hadn't seen an example like this using modular arithmetic.

Peter
  • 1,701
  • The question this working is from said $\frac{N^2+N}{2}$ is divisible by 4 so I wrote $\frac{N^2+N}{2} \equiv 0 \pmod 4$ . –  Feb 18 '21 at 07:59
  • For N=1 it isn't true. If you are solving $/frac{N^2+N}{2}=4k$ for some $k$, try $N^2+N=8k$ instead. – Peter Feb 18 '21 at 08:09
  • In fact we may be able to divide by integers not coprime to the modulus, but the key point is that the result may not be unique when it exists (though it can be made unique by decreasing the modulus). So your first sentence is a bit misleading as it stands. – Bill Dubuque Feb 18 '21 at 08:17
-1

$(2N+1)^{2} \equiv 1 $

$2N+1 \equiv 1$

This step is wrong, for example: $(2*3+1)^2 \equiv 1$.

Eugen
  • 240