Suppose A is an n-by-n matrix with its diagonal entries are n and other entries are one. Find determinant of A. For $n \geq 2$, find the determinant of
$A_{n}=\begin{bmatrix}
n &  1  & 1 &\ldots &1 \\
1 & n  & 1 &\ldots &1 \\
1 & 1  & n &\ldots &1 \\
\vdots & \vdots &\vdots & \ddots & \vdots\\
1 & 1 & 1 &\ldots  & n
\end{bmatrix}_{n \times n}
$
One can deduce the determinant of $A_{n}=(n-1)^{n-1}(2n-1)$ by taking $n=2,3,4...$. I solve it as follows but I found it is not elegant. Any better approach?
Here is my attempt:
Let's find the eigenvalues of $A_{n}$ by solving $det(\lambda I-A_{n})=0$ because $det(A_{n})=\lambda_{1}\lambda_{2}...\lambda_{n}$ where $\lambda_{i}$ are eigenvalues of $A_{n}$. Express $A_{n}=(n-1)I+J$ where $I$ is the n-by-n identity matrix while $J$ is an n-by-n matrix with all entries equal to 1.
Denote $B=(n-1)I$ so that $$\lambda I-A_{n}=\lambda I-(B+J)=(\lambda I - B)(I-(\lambda I - B)^{-1}J)$$
Since $det(XY)=det(X)det(Y)$ for square matrices $X$ and $Y$
$$det(\lambda I-A_{n})=det(\lambda I - B)det(I-(\lambda I - B)^{-1}J)$$
Since $det(kX)=k^{n}det(X)$ for a scalar k and $det(I)=1$
$$det(\lambda I-B)=\det(\lambda I - (n-1)I)=(\lambda-(n-1))^{n}det(I)=(\lambda-(n-1))^{n}$$
If $u$ be a column vector of one's in $\mathbb{R}^{n}$, then $uu^{T}=J$ so that:
$$det(I-(\lambda I - B)^{-1}J)=det(I-(\lambda I - B)^{-1}uu^{T}) $$
By Sylvester's Determinant Theorem: 
\begin{equation*}
\begin{split}
det(I-(\lambda I - B)^{-1}J)&=&det(I-(\lambda I - B)^{-1}uu^{T})=det(I-u^{T}(\lambda I - B)^{-1}u)\\
&=&1-u^{T}(\lambda I - B)^{-1}u=1-u^{T}(\lambda-(n-1))^{-1}Iu\\
&=&1-(\lambda-(n-1))^{-1}u^{T}Iu\\
&=&1-\frac{u^{T}u}{\lambda-(n-1)}=1-\frac{n}{\lambda-(n-1)}\\
&=&\frac{\lambda-(2n-1)}{\lambda-(n-1)}
\end{split}
\end{equation*}
This yields $$det(\lambda I-A_{n})=(\lambda-(n-1))^{n}\frac{\lambda-(2n-1)}{\lambda-(n-1)}=(\lambda-(n-1))^{n-1}(\lambda -(2n-1))=0$$
The eigenvalues of $A_{n}$ are $n-1$ (with algebraic multiplicity of $n-1$) and $2n-1$  (with algebraic multiplicity of 1). Thus, $det(A_{n}=(n-1)^{n-1}(2n-1)$
I wonder if it is possible to obtain the determinant without solving for the eigenvalues. Or at least without using the Sylvester's determinant theorem....
 A: 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.
A: 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)$.
A: Let $B$ be the matrix with all $-1's$. Since the $rank(B)=1$, it follows that $\lambda=0$ is an eigenvalue of $B$ of multiplicity $n-1$.
Also, it is trivial to see that $\lambda=-n$ is an eigenvalue of $B$, since in this case the rows add to $0$. This proved that the characteristic polynomial of $B$ is 
$$\det (xI-B)= x^{n-1}(x+n) \,.$$
Set $x=n-1$ and you are done....
Sigh, Arturo beat me to the answer :)
A: Write $A = (n-1)I+uu'$ instead, where $u'=[1 1 \dots1].$ Using the same Sylvester's Determinant Theorem you can write $\det(A)=\det((n-1)I)(1+u'u/(n-1) = (n-1)^n(1-\frac{n}{n-1})=(n-1)^{n-1}(2n-1)$
A: For this matrix you can quite easily see what all the eigenvalues and eigenvectors are. If $e_i$ is the vector with entry $1$ in position $i$ and $0$ elsewhere then $e_1 + \ldots + e_n$ is an eigenvector with eigenvalue $2n-1$ and the vectors of the form $e_i-e_j$ span an $n-1$ dimensional eigenspace with eigenvector $n-1$.
