If $n\mid a^2-1$, $n$ an odd integer, show $n = \gcd(a-1, n)\gcd(a+1, n)$

$(a\!-\!1,n)(a\!+\!1,n) = (a^2\!-\!1,\,n(\underbrace{a\!-\!1,a\!+\!1,n}_{\textstyle{(a-1,\underbrace{2,n)}_{\large 1}}})) = (a^2\!-\!1,n) \,\ [= n\ $ by hypothesis]

Remark $\ $ The above proves that $\ (b,n)(c,n) = (bc,n)\ $ if $\ (b,c,n) = 1,\ $ using only basic universal gcd laws (associative,distributive,etc), so it works very generally.


We will prove the result by showing that (i) $n$ divides $\gcd(a-1,n)\gcd(a+1,n)$ and (ii) $\gcd(a-1,n)\gcd(a+1,n)$ divides $n$.

Proof of (i): Let $b=\gcd(a-1,n)$. Then $b$ divides $n$. Let $n=bq$.

We know that $bq$ divides $(a-1)(a+1)$, so $q$ divides $(a-1)(a+1)$. But $q$ and $a-1$ are relatively prime. It follows that $q$ divides $a+1$. Thus $q$ divides $\gcd(a+1,n)$. It follows that $n$ divides $\gcd(a-1,n)\gcd(a+1,n)$.

Proof of (ii): Note that $\gcd(a-1,n)$ and $\gcd(a+1,n)$ are relatively prime. This is because any common divisor $k\gt 0$ of $\gcd(a-1,n)$ and $\gcd(a+1,n)$ must divide $n$, $a-1$, and $a+1$. So $k$ divides $(a+1)-(a-1)$. But $k$ divides $2$. Since $n$ is odd, that means $k=1$. Since $\gcd(a-1,n)$ and $\gcd(a+1,n)$ each divide $n$, and are relatively prime, their product divides $n$. This completes the proof.


You know $n$ is odd, so essentially this $2$ is not supposed to give you a problem. You know that $n \, | \, a^2 - 1$, hence $n \, | \, (a-1)(a+1)$. By the fundamental theorem of arithmetic, we can write $n$ as a product of distinct prime powers.

Suppose $p^{\alpha} \, || \, (a-1)(a+1)$ and $p \neq 2$ is a prime. Since $p \not\mid (a-1,a+1) \in \{1,2\}$, we know that $p$ cannot divide both $(a-1)$ and $(a+1)$. It follows that $p^{\alpha} | a-1$ or $p^{\alpha} | a+1$.

Since the formula you are trying to prove is multiplicative on both sides for integers $n$, you can restrict the proof to the prime power case. I let you fill in the blanks.

Hope that helps,