TITLE: A special case: determinant of a $n\times n$ matrix
QUESTION [7 upvotes]: I would like to solve for the determinant of a $n\times n$ matrix $V$ defined as:
$$
V_{i,j}=
\begin{cases}
v_{i}+v_{j} & \text{if} & i \neq j \\[2mm]
(2-\beta_{i}) v_{i} & \text{if} & i = j \\
\end{cases}
$$
Here, $v_i, v_j \in(0,1)$, and $\beta_i>0$.  Any suggestions or thoughts are highly appreciated.

REPLY [5 votes]: Let me consider $W:=-V$; we have 
$$
\det(V)=(-1)^n\det(W).
$$
As already noted in the comments, $W=D-(ve^T+ev^T)$, where $v:=[v_1,\ldots,v_n]^T$, $e:=[1,\ldots,1]^T$, and $D:=\mathrm{diag}(\beta_i v_i)_{i=1}^n$. 
Since $D>0$, we can take
$$
D^{-1/2}WD^{-1/2}=I-(\tilde{v}\tilde{e}^T+\tilde{e}\tilde{v}^T),
$$
where $\tilde{v}:=D^{-1/2}v$, $\tilde{e}:=D^{-1/2}e$.
Note that $\det(D^{-1/2}WD^{-1/2})=\det(D)^{-1}\det(W)$ and hence
$$
\det(W)=\det(D)\det(I-(\tilde{v}\tilde{e}^T+\tilde{e}\tilde{v}^T))
=\det(I-(\tilde{v}\tilde{e}^T+\tilde{e}\tilde{v}^T))\prod_{i=1}^n v_i\beta_i.
$$
Since $I-(\tilde{v}\tilde{e}^T+\tilde{e}\tilde{v}^T)$ is the identity plus a symmetric rank-at-most-two matrix, its determinant can be written as
$$
\det(I-(\tilde{v}\tilde{e}^T+\tilde{e}\tilde{v}^T))=(1-\lambda_1)(1-\lambda_2),
$$
where $\lambda_1$ and $\lambda_2$ are the two largest (in magnitude) eigenvalues of $BJB^T$ with 
$$B=[\tilde{v},\tilde{e}]\quad\text{and}\quad J=\begin{bmatrix}0 & 1\\1 & 0\end{bmatrix}.$$
Since the eigenvalues of $BJB^T$ are same as the eigenvalues of $JB^TB$ (up to some uninteresting zero eigenvalues), we have that 
$$
\begin{split}
\det(I-BJB^T)
&=
\det(I-JB^TB)
=
\det
\left(
\begin{bmatrix}
1-\tilde{e}^T\tilde{v} & -\tilde{e}^T\tilde{e} \\
-\tilde{v}^T\tilde{v}  & 1-\tilde{v}^T\tilde{e}
\end{bmatrix}
\right)\\
&=
\det
\left(
\begin{bmatrix}
1-e^TD^{-1}v & -e^TD^{-1}e \\
-v^TD^{-1}v & 1-v^TD^{-1}e 
\end{bmatrix}
\right)\\
&=
(1-e^TD^{-1}v)^2-(e^TD^{-1}e)(v^TD^{-1}v)\\
&=
\left(1-\sum_{i=1}^n\frac{1}{\beta_i}\right)^2
-
\left(\sum_{i=1}^n\frac{v_i}{\beta_i}\right)
\left(\sum_{i=1}^n\frac{1}{v_i\beta_i}\right).
\end{split}
$$
Putting everything together,
$$
\det(V)
=
(-1)^n\left[\left(1-\sum_{i=1}^n\frac{1}{\beta_i}\right)^2
-
\left(\sum_{i=1}^n\frac{v_i}{\beta_i}\right)
\left(\sum_{i=1}^n\frac{1}{v_i\beta_i}\right)\right]\prod_{i=1}^n\beta_iv_i.
$$
I guess that after some manipulation you could arrive to the formula given in the other answer (probably by playing further with the term $(1-e^TD^{-1}v)^2-(e^TD^{-1}e)(v^TD^{-1}v)$).