# When does this system of congruences hold?

Let $$\alpha,\beta,\gamma$$ be quadratic irrationalities of the form $$(n\pm\sqrt{n^2-4})/2$$ for some integer $$n$$ (the $$n$$ is different for each of the three numbers). What are the solutions to the system of congruences $$\begin{cases}\alpha+\alpha^{-1}+\beta+\beta^{-1}\equiv\gamma+\gamma^{-1}\\\alpha^p+\alpha^{-p}+\beta^p+\beta^{-p}\equiv\gamma^p+\gamma^{-p}\end{cases}\pmod{p}?$$

First, note that the question is well-defined, and $$\alpha+\alpha^{-1}$$ and $$\alpha^p+\alpha^{-p}$$ are both integers. This is because

$$\alpha=\frac{n+\sqrt{n^2-4}}{2}\implies\alpha^{-1}=2\cdot\frac{n-\sqrt{n^2-4}}{n^2-(n^2-4)}=\frac{n-\sqrt{n^2-4}}2,$$ so $$\alpha,\alpha^{-1}$$ are conjugate. Further, $$\alpha^n+\alpha^{-n}=(\alpha+\alpha^{-1})(\alpha^{n-1}+\alpha^{-(n-1)})-(\alpha^{n-2}+\alpha^{-(n-2)})$$, and it is easily verified that $$\alpha^2+\alpha^{-2}\in\mathbb Z$$. These two facts together imply the sequence $$(\alpha^n+\alpha^{-n})_{n\in\mathbb N}\in\mathbb Z$$, and in particular, $$\alpha^p+\alpha^{-p}\in\mathbb Z$$. The identical argument of course shows the same thing for $$\beta$$ and $$\gamma$$, so even though we seem to have weird irrationalities in the congruences, all of the quantities involved are actually integers. So the congruences are just the normal relations defined on $$\mathbb Z$$.

Naturally, I tried to set $$\alpha+\alpha^{-1}=n_1$$, $$\beta+\beta^{-1}=n_2$$, $$\gamma+\gamma^{-1}=n_3$$. Then the first congruence becomes a nice $$n_1+n_2\equiv n_3$$ mod $$p$$, but unfortunately the second congruence has no nice representation in $$n_1,n_2,n_3$$. So unless I'm missing something, this approach cannot work. Any thoughts or partial solutions would be greatly appreciated!

Galois theory of finite fields sheds some light on this question. In fact, it follows that the latter congruence will always be a consequence of the former! Basically because they are each others Galois conjugates!

As you observed $$\alpha^{\pm1}=(n\pm\sqrt{n^2-4})/2$$ are the solutions of the quadratic equation $$m(x)=x^2-nx+1=0.$$ Everything takes place in the ring $$R$$ of algebraic integers of $$\Bbb{Q}(\sqrt{n^2-4})$$. From basic algebraic number theory we infer that $$R$$ has a prime ideal $$\mathfrak{p}$$ such that $$\mathfrak{p}\cap\Bbb{Z}=p\Bbb{Z}$$. The quotient ring $$R/\mathfrak{p}$$ is then a finite field $$K$$. If $$n^2-4$$ is a quadratic residue modulo $$p$$ then $$|K|=p$$. But if $$m(x)$$ is irreducible modulo $$p$$ then $$|K|=p^2$$.

The idea is that for integers a congruence modulo $$p$$ is equivalent to congruence modulo $$\mathfrak{p}$$, and the latter can be decided by projecting everything to the quotient field $$K$$.

If $$m(x)$$ factors modulo $$p$$, then the images of $$\alpha^{\pm1}$$ in $$K$$ are residue classes of integers modulo $$p$$. So Little Fermat says that $$\alpha^p\equiv\alpha\pmod{\mathfrak{p}}$$ and also $$\alpha^{-p}\equiv\alpha^{-1}\pmod{\mathfrak{p}}.$$ Consequently $$\alpha^p+\alpha^{-p}\equiv\alpha+\alpha^{-1}\pmod{\mathfrak{p}}$$ and this implies the same congruence of integers modulo $$p$$.

If $$m(x)$$ is irreducible modulo $$p$$ then its zeros in $$K$$ are Frobenius conjugates of each other. As those zeros are the projections of $$\alpha^{\pm1}$$, it follows that $$\alpha^p\equiv\alpha^{-1}\pmod{\mathfrak{p}}.$$ Applying the Frobenius again then gives the congruence $$\alpha^p+\alpha^{-p}\equiv\alpha^{-1}+\alpha\pmod{\mathfrak{p}}$$ and we are done by repeating the earlier argument.

The conclusion is that the condition $$n_1+n_2\equiv n_3\pmod p$$ is all you need for both of the congruences to hold.

Jyrki Lahtonen already provided a great solution to the problem, reaching the conclusion that $$\alpha+\alpha^{-1}=\alpha^p+\alpha^{-p}$$ mod $$p$$ for each $$\alpha$$. I believe I found an even easier way to get this conclusion, starting from Fermat's Little Theorem.

Fermat's Little Theorem asserts that $$x^p=x$$ mod $$p$$ for all $$x\in\mathbb Z$$. Then set $$\alpha+\alpha^{-1}=n$$, and apply the theorem to $$n$$. Since the binomial coefficients $$\binom{p}{k}$$ are divisible by $$p$$ for $$k=1,2,\dots,p-1$$, and the terms of the form $$\alpha^n+\alpha^{-n}$$ are integral, we have

$$\alpha+\alpha^{-1}=(\alpha+\alpha^{-1})^p=\alpha^p+\alpha^{-p}+p(...)=\alpha^p+\alpha^{-p}\pmod{p}.$$