TITLE: the largest eigenvalue of the matrix A with A_{ij}=(i \times j) mod p for p is a prime.
QUESTION [7 upvotes]: For a prime p, consider the $(p-1) \times (p-1)$ matrix A with entry to be $A_{ij}=(i \times j) mod$ $p$. every row (column) is permutation of 1 to p-1, such a permutation is useful in one version of proof of Fermat's little theorem. Here the question is if the largest eigenvalue is always p(p-1)/2. also anything happens for the rank of it. except for p=2,3, the rank might always be p-2.
the student taking a course (general intro to math) I am TAing asked me it. but it is embarrassing to say I don't know how to work it out. I know almost zero about primes and I believe this might be a standard result. I am grateful if anyone suggests a hint or any reference.

REPLY [9 votes]: Anthony Quas shows that your matrix has rank $(p+1)/2$ if and only if the sum
$$\sum_{j=0}^{p-2} (a^j \bmod p) \beta^{jk}$$
is nonzero for all odd $k$. Here $a$ is a primitive root of unity modulo $p$ and $\beta$ is a primitive $(p-1)$-th root of unity.
Take a look at Section 6.5 of Edward's book Fermat's Last Theorem. He establishes the formula (equation 8)
$$L(1, \chi) = \frac{ i \pi m_k}{p} \sum_{j=0}^{p-2} (a^j \bmod p) \beta^{jk}$$
where $k$ is odd, $\chi$ is the character $a^j \mapsto \beta^{jk}$ from $\mathbb{F}_p^{\times}$ to $\mathbb{C}^{\times}$ and  $m_k = \frac{1}{p} \sum_{j=0}^{p-2} \beta^{jk} \zeta^{a^j}$, for $\zeta$ a primitive $p$-th root of unity. (Warning: I have tried to change Edward's notation to match Quas's. In particular, Edwards uses $k$ and $j$ to mean the exact opposite of what Quas does! Hope I haven't introduced any errors.)
The key point is that $L(1,\chi)$ is known to be nonzero! So the result on the rank of your matrix is true, and for quite a nontrivial reason.