Finding a determinant of a large matrix I stumbled upon this question online:
$$A=\begin{bmatrix}5&6&&\cdots&6
\\6&5&6&\cdots&6
\\&&\ddots&&
\\6&\cdots&6&5&6
\\6&\cdots&&6&5
\end{bmatrix}\in \mathbb R^{82\times 82}$$
I also found a way to solve this in Chegg:

Is there a better way to solve this problem maybe by reducing it to upper triangular form?
 A: Render the product of the eigenvalues.
Let $M$ be the matrix and $I$ be the identity matrix.  Then $M+I$ which consists of all $6$'s has rank $1$, meaning the eigenvalue $-1$ has multiplicity $82-1=81$.  There is one more eigenvalue with multiplicity $1$, obtained by observing that all eigenvalue including multiplicity must sum to the trace of $M$.  The trace is $410$, the other $81$ eigenvalues (all $-1$) add up to $-81$, therefore the last eigenvalue is $410-(81×(-1))=491$.
Then the determinant is $(-1)^{81}×491=\color{blue}{-491}$.
A: One can generalise: there is a general formula for the $n{\times}n$ determinant
$$D_n(a,b)=\begin{vmatrix}b & a & a &\dots &a\\
a & b& a&\dots&a \\\vdots&\vdots&\vdots&\dots&\vdots\\a&a&a&\dots &b \end{vmatrix}.$$
Consider the  $n{\times}n$ matrix $A$ with all coefficients equal to $a$. Its rank is $1$, so $\dim(\ker A)=n-1$, and its trace is $na$, so its characteristic polynomial is
$$\chi_A(X)=\det(XI_n-A)=X^{n-1}(X-na).$$
On en déduit que
\begin{align}
D_n(a,b)&=\det\bigl((b-a)I_n+A\bigr)=(-1)^n\det\bigl((a-b)I_n-A\bigr)\\
&= (-1)^n(a-b)^{n-1}\bigl((a-b)-na\bigr)=\color{red}{(b-a)^{n-1}\bigl(b+(n-1)a\bigr)}.
\end{align}
In the last example given, $a=6$, $b=5$, $n=82$, so that we indeed obtain $\;(-1)^{81}(5+81\cdot 6)=-491$.
