Suppose A is an n-by-n matrix with its diagonal entries are n and other entries are one. Find determinant of A.
Solution 1:
Add all other rows to the bottom row, so that the bottom row has $2n-1$ in each spot. Now the determinant of our matrix is $2n-1$ times the determinant of the matrix obtained by replacing all $(2n-1)$s with $1$s. Subtracting this bottom row from all others gives the matrix
$$\begin{pmatrix} n-1 & 0 & \cdots & 0 \\ 0 & n-1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & \cdots & 1 \end{pmatrix}$$
This is lower triangular, so it has determinant equal to the product of the diagonal entries, or $(n-1)^{n-1}$, which we multiply by $(2n-1)$ to get the determinant of the original matrix is $(n-1)^{n-1}(2n-1)$.
Solution 2:
One can find the eigenvalues much more easily than this:
Note that $A = B + (n-1)I$, where $B$ is the matrix all of whose entries are $1$, and $I$ is the identity.
The rank of $B$ is $1$ so the nullspace is of dimension $n-1$, and since $B^2=nB$, then $B$ satisfies the polynomial $x(x-n)=0$.
Therefore, the characteristic polynomial must be $x^{n-1}(x-n)$; if the characteristic of the ground field divides $n$, then this is $x^n$.
If the characteristic of the ground field does not divide $n$, then eigenvalues of $B$ are $0$, with multiplicity $n-1$, and $n$, with multiplicity $1$. Hence, the eigenvalues of $A$ are $0+(n-1) = n-1$, with multiplicity $(n-1)$, and $n+(n-1) = 2n-1$, with multiplicity $1$. So the determinant is $(n-1)^{n-1}(2n-1)$, as you obtained.
If we are working over a field whose characteristic does divide $n$, then $A = B-I$. Thus, the minimal polynomial of $A$ is $(x-1)^2$, so the characteristic polynomial is $(x-1)^n$. Again we obtain that the determinant is just $(-1)^n$, same as we would get above.