Find a determinant of a large matrix Evaluate $$\det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a \\
1 & 1& \dots &\ldots&a&1 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
1 & a& \dots &\ldots&1&1\\
a & 1& \dots &\ldots&1&1 \\
\end{vmatrix}$$
I tried cofactor expansion and it leads to
$$\det \begin{vmatrix}
 1& \dots &\ldots&a&1 \\
 \vdots& \ddots &&\vdots&\vdots \\
 \vdots&&\ddots&\vdots&\vdots \\
 a& \dots &\ldots&1&1\\
 1& \dots &\ldots&1&1 \\
\end{vmatrix} -
\det \begin{vmatrix}
1 &  \dots &\ldots&a&1 \\
\vdots &  \ddots &&\vdots&\vdots \\
\vdots & &\ddots&\vdots&\vdots \\
1 &  \dots &\ldots&1&1\\
a &  \dots &\ldots&1&1 \\
\end{vmatrix} + \ldots +(-1)^{n+1}
\det \begin{vmatrix}
1 & 1& \dots &\ldots&a \\
\vdots & \vdots& \ddots &&\vdots \\
\vdots & \vdots&&\ddots&\vdots \\
1 & a& \dots &\ldots&1\\
a & 1& \dots &\ldots&1 \\
\end{vmatrix}$$
I think, except for last term, all the terms will be cancel each other somehow although it may depend on parity of $n$. If it does depend on parity, the possibility of cancelation is going to be opposite for the cofactor expansion of the last term, and so it does for the last term of the next expansion...
I could not find out how to deal with this  branch.

Add all the columns to the last one : you get
$$\det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a \\
1 & 1& \dots &\ldots&a&1 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
1 & a& \dots &\ldots&1&1\\
a & 1& \dots &\ldots&1&1 \\
\end{vmatrix} = \det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a+n-1 \\
1 & 1& \dots &\ldots&a&a+n-1 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
1 & a& \dots &\ldots&1&a+n-1\\
a & 1& \dots &\ldots&1&a+n-1 \\
\end{vmatrix}$$
Now substract the first line from all the other lines :
$$\det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a+n-1 \\
1 & 1& \dots &\ldots&a&a+n-1 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
1 & a& \dots &\ldots&1&a+n-1\\
a & 1& \dots &\ldots&1&a+n-1 \\
\end{vmatrix} = \det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a+n-1 \\
0 & 0& \dots &\ldots&a-1&0 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
0 & a-1& \dots &\ldots&0&0\\
a-1 & 0& \dots &\ldots&0&0 \\
\end{vmatrix}$$
Finally develop w.r.t. the last column. You get that
$$\det \begin{vmatrix}
1 & 1& \dots &\ldots&1&a \\
1 & 1& \dots &\ldots&a&1 \\
\vdots & \vdots& \ddots &&\vdots&\vdots \\
\vdots & \vdots&&\ddots&\vdots&\vdots \\
1 & a& \dots &\ldots&1&1\\
a & 1& \dots &\ldots&1&1 \\
\end{vmatrix} =(-1)^{\frac{n(n-1)}{2}}(a+n-1)(a-1)^{n-1}$$
