How to calculate the determinant of a fully/negative symmetric matrix? I have two similar questions.

  
*
  
*How to calculate the determinant of the following $n \times n$ matrix?
  
  
  $$\begin{vmatrix}
a & b & \dots & b & b\\
-b & a & \dots & b & b\\
\vdots & \vdots & \ddots & \vdots & \vdots\\
-b & -b & ... & a & b\\
-b & -b & ... & -b & a
\end{vmatrix}$$

  
*How to calculate the determinant of the following $n \times n$ matrix?
  
  
  $$\begin{vmatrix}
a+b & a & \dots & a\\
a & a + b & \dots & a\\
\vdots & \vdots & \ddots & \vdots \\
a & a & \dots & a + b
\end{vmatrix}$$

For the second one, I have seen this, but I don't understand the part where $$\det M_n = \det M_{n - 1} - r(n-1) N_{n - 1}$$ Why minus shouldn't it be something like $(-1)^{i+j}$?
 A: You can use Gaussian elimination to simplify the determinants so that it becomes upper triangular. Once you do that, the determinant will simply be the product of the entries on the diagonal. This is a straightforward process which can be applied to both of your questions. 
Gaussian elimination consists of three things:


*

*Multiply any row or column by any scalar. This has the effect of multiplying the value of the determinant by that number. 

*Interchange any row or column of the determinant. This has the effect of multiplying the value of the determinant by -1. 

*Add to a row the corresponding entries of any other row all multiplied by any scalar. This second row is unchanged--this process only alters the first. (This also works for columns.) The value of the determinant is unchanged when this is done. 
Using these three actions, it's possible to make the determinant in question upper triangular, which means that all entries below the diagonal are zero. Example: in your first determinant, add to each row the corresponding entries of the first row multiplied by b/a. This will make all the entries in the first column below the main diagonal zero. Just repeat the same sort of thing until it's upper triangular, multiply the entries on the main diagonal, look back over the steps you took to reach that point so that you know how the value of the determinant has changed, and adjust accordingly. This process may sound tedious, but it's much quicker than an expansion by minors approach and I think will lead you to a general equation.  
A: Your first matrix is $a I + b B$ where $B$ is the $n \times n$ matrix with $1$ above the diagonal, $-1$ below, and $0$ on the diagonal.  Its determinant is thus $(-b)^n C_n(-a/b)$ where $C_n(\lambda) = \det(\lambda I-B)$ is the characteristic polynomial of $B$.  By looking at the first few $n$'s, it looks to me like
$$ C_n(\lambda) = \frac{(\lambda-1)^n + (\lambda+1)^n}{2}\tag{1}$$
To prove this, you can use row and column operations (subtract the second row of $\lambda I - B$ from the first row and then the second column from the first column), then expand on the first row and the first column to get
the recurrence 
$$ C_n(\lambda) = 2 \lambda C_{n-1}(\lambda) + (1-\lambda^2) C_{n-2}(\lambda) $$
Note that (1) does satisfy this recurrence, and $C_1(\lambda)$ and (1) is true for $n=1$ and $n=2$.  By induction, it is true for all $n$.
BTW, (1) implies (via the Cayley-Hamilton theorem)  the identity
$$ (B-I)^n + (B+I)^n = 0$$
A: Matrix 1
Consider the determinant polynomials
$$
\begin{align}
p_n(x)
&=
\det\begin{bmatrix}
1&x&x&\cdots&x\\
-x&1&x&\cdots&x\\
-x&-x&1&\cdots&x\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
-x&-x&-x&\cdots&1
\end{bmatrix}\tag{1a}\\[6pt]
&=
\det\begin{bmatrix}
1-x&0&0&\cdots&1+x\\
-x&1&x&\cdots&x\\
-x&-x&1&\cdots&x\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
-x&-x&-x&\cdots&1
\end{bmatrix}\tag{1b}\\[6pt]
&=
\det\begin{bmatrix}
\color{#C00}{2}&0&0&\cdots&\color{#090}{1+x}\\
0&1&x&\cdots&x\\
0&-x&1&\cdots&x\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
\color{#090}{1-x}&-x&-x&\cdots&1
\end{bmatrix}\tag{1c}\\[30pt]
&=\color{#C00}{2p_{n-1}(x)}+\color{#090}{\left(x^2-1\right)p_{n-2}(x)}\tag{1d}
\end{align}
$$
Explanation:
$\text{(1a)}$: definition
$\text{(1b)}$: add column $n$ to column $1$
$\text{(1c)}$: add row $n$ to row $1$
$\text{(1d)}$: expand the determinant on column $1$:
$\phantom{\text{(1d):}}\quad$ the $(1,1)$ term is $2$ and the $(1,1)$ minor is $p_{n-1}(x)$
$\phantom{\text{(1d):}}$ the $(n,1)$ term is $1-x$; expand the $(n,1)$ minor on row $1$:
$\phantom{\text{(1d):}}\quad$ the $(1,n-1)$ term is $1+x$ and the $(1,n-1)$ minor is $p_{n-2}(x)$
Start with $p_0(x)=p_1(x)=1$ and compute the first several polynomials:
$$
\begin{align}
p_0(x)&=1\\
p_1(x)&=1\\
p_2(x)&=1+x^2\\
p_3(x)&=1+3x^2\\
p_4(x)&=1+6x^2+x^4\\
p_5(x)&=1+10x^2+5x^4\\
p_6(x)&=1+15x^2+15x^4+x^6
\end{align}\tag2
$$
From the binomial coefficients in $(2)$, we can start to see a pattern:
$$
p_n(x)=\frac{(1+x)^n+(1-x)^n}2\tag3
$$
Equation $(3)$ can be verified using $\text{(1d)}$ and induction. Setting $x=\frac ab$ and multiplying the whole matrix by $b$ gives
$$
\det\begin{bmatrix}
b&a&a&\cdots&a\\
-a&b&a&\cdots&a\\
-a&-a&b&\cdots&a\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
-a&-a&-a&\cdots&b
\end{bmatrix}
=\frac{(b+a)^n+(b-a)^n}2\tag4
$$

Matrix 2
Note that any vector orthogonal to $\begin{bmatrix}1&1&1&\cdots&1\end{bmatrix}$ is multiplied by $b$ (on any subspace orthogonal to a given vector, that vector can be subtracted from each column of the matrix without changing the action on that subspace). $\begin{bmatrix}1&1&1&\cdots&1\end{bmatrix}$ is multiplied by $an+b$. Thus,
$$
\det\begin{bmatrix}
a+b&a&a&\cdots&a\\
a&a+b&a&\cdots&a\\
a&a&a+b&\cdots&a\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
a&a&a&\cdots&a+b
\end{bmatrix}
=b^{n-1}(an+b)\tag5
$$
