How can I say that this matrix is invertible? Let $A_{ij}=1$ if $i=j$ and let $A_{ij}=\frac{1}{2}$ if $i \neq j$. How can I formally argue that $A$ is an invertible matrix? I can made for particular examples, but I don't know how to argue for the general case.

$$
\begin{bmatrix}
1&\frac12&\frac12&\cdots&\frac12\\
\frac12&1&\frac12&\cdots&\frac12\\
\frac12&\frac12&1&\cdots&\frac12\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
\frac12&\frac12&\frac12&\cdots&1\\
\end{bmatrix}
$$
subtract $\frac1n\times$ the sum of the $n-1$ right columns from column $1$ and we get
$$
\begin{bmatrix}
\frac{n+1}{2n}&\frac12&\frac12&\cdots&\frac12\\
0&1&\frac12&\cdots&\frac12\\
0&\frac12&1&\cdots&\frac12\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&\frac12&\frac12&\cdots&1\\
\end{bmatrix}
$$
subtract $\frac1{n-1}\times$ the sum of the $n-2$ right columns from column $2$ and we get
$$
\begin{bmatrix}
\frac{n+1}{2n}&\frac1{2(n-1)}&\frac12&\cdots&\frac12\\
0&\frac{n}{2(n-1)}&\frac12&\cdots&\frac12\\
0&0&1&\cdots&\frac12\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&0 &\frac12&\cdots&1\\
\end{bmatrix}
$$
Continuing for the rest of the columns, we end up with
$$
\begin{bmatrix}
\frac{n+1}{2n}&\frac1{2(n-1)}&\frac1{2(n-2)}&\cdots&\frac12\\
0&\frac{n}{2(n-1)}&\frac1{2(n-2)}&\cdots&\frac12\\
0&0&\frac{n-1}{2(n-2)}&\cdots&\frac12\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&0&0&\cdots&1\\
\end{bmatrix}
$$
Computing the determinant of the upper triangular matrix gives
$$
\frac{n+1}{2^n}
$$
