Ivan Shishkin, The Forest Clearing

Determinant of a gcd matrix

Reviewed

What is the determinant of the matrix AnA_{n} of size n×nn\times n with coefficients (gcd(i,j))1i,jn(\operatorname{gcd}(i, j))_{1 \leq i, j \leq n} ?

Solutions

1

Hint 1

Open this only if you want a small nudge before looking at the solutions.

Hint 2

Open this only if you want a small nudge before looking at the solutions.

Reveal solutionsAre you sure? Give it a try first.

Solution by Ancient Tree

0 useful votes

After testing the first cases, one is led to conjecture the formula :
det(An)=i=1nφ(i)\operatorname{det}\left(A_n\right)=\prod_{i=1}^n \varphi(i)
where φ\varphi is Euler's totient function.
One first trick to make this function appear in the coefficients of the matrix is to remember that, for any integer m1m\geq 1, we have that :
m=dmφ(d)m=\sum_{d | m} \varphi(d)
Applying this to the gcd, we obtain :
gcd(i,j)=dgcd(i,j)φ(d)=di and djφ(d)\operatorname{gcd}(i, j)=\sum_{d \mid \operatorname{gcd}(i, j)} \varphi(d)=\sum_{d \mid i \text { and }d|j} \varphi(d)
This can be rewritten as a sum over all 1dn1\leq d\leq n by introducing the symbols δdi\delta_{d|i}, which are 1 if did|i and 0 if not :
gcd(i,j)=d=1nδdiφ(d)δdj\operatorname{gcd}(i, j)=\sum_{d=1}^{n} \delta_{d \mid i} \varphi(d) \delta_{d \mid j}
But this is reminiscent of the formula for the coefficient of a matrix of the form LDUL D U where DD is diagonal. More precisely here, we have :
gcd(i,j)=(Ldiag(φ(1),,φ(n))L)ij\operatorname{gcd}(i, j)=\left(L \operatorname{diag}(\varphi(1), \ldots, \varphi(n)) L^{\top}\right)_{ij}
where
LL is the upper triangular matrix with coefficients Lij=δjiL_{ij}=\delta_{j|i}. So the determinant of our matrix is given by :
det(An)=i=1nφ(i)det(L)2\operatorname{det}\left(A_n\right)=\prod_{i=1}^n \varphi(i) \cdot \operatorname{det}(L)^2
But it is straightforward to see that LL is a triangular matrix with 1s on the diagonal, so its determinant is 1. We have arrived at the wanted result.

NB: The decomposition of our matrix AnA_{n} written above is called the LULU decomposition, where LL stands for "lower triangular" and UU for "upper triangular". It is really useful to compute some determinants and its unicity can lead to some beautiful formulas.