<s>[INST] Invertibility of a matrix in portfolio optimization Let $A$ be an $n\times n$ symmetric matrix with non-negative entries. Let $\mathbf{1}$ be the column vector of dimension $n$ with all entries being $1$. 
Consider the $(n+1)\times (n+1)$ matrix
$$ B=
\begin{bmatrix} 
A & \mathbf{1} \\
\mathbf{1}^T & 0 
\end{bmatrix}
$$
Question: what is the condition for $A$ so that $B$ is invertible? 
Remark: This matrix is related to portfolio optimization problems in finance. I note that when $A$ is a constant matrix, the determinant of $B$ is $0$ and thus $B$ is not invertible.
 [/INST] If $\det(A) \neq 0$ so that $A^{-1}$ exists
and the scalar $\alpha = \mathbf{1}^T A^{-1} \mathbf{1} \neq 0$, then we have
$$B^{-1} = \begin{bmatrix} 
A^{-1} - \alpha^{-1}A^{-1}\mathbf{1}\mathbf{1}^TA^{-1}  & \alpha^{-1}A^{-1}\mathbf{1} \\
\alpha^{-1}\mathbf{1}^TA^{-1} & -\alpha^{-1} 
\end{bmatrix}$$
Note that
$$\begin{align}BB^{-1}&= \begin{bmatrix} 
AA^{-1} - A\alpha^{-1}A^{-1}\mathbf{1}\mathbf{1}^TA^{-1}+  \mathbf{1}\alpha^{-1}\mathbf{1}^TA^{-1}  & A\alpha^{-1}A^{-1}\mathbf{1}-\alpha^{-1}\mathbf{1} \\
 \mathbf{1}^TA^{-1} - \mathbf{1}^T\alpha^{-1}A^{-1}\mathbf{1}\mathbf{1}^TA^{-1} + 0\alpha^{-1}A^{-1}\mathbf{1}  & \mathbf{1}^T\alpha^{-1}A^{-1}\mathbf{1}-0\alpha^{-1}
\end{bmatrix} \\ \\&= \begin{bmatrix} 
I -\alpha^{-1}\mathbf{1}\mathbf{1}^TA^{-1}+  \alpha^{-1}\mathbf{1}\mathbf{1}^TA^{-1}  & \alpha^{-1}\mathbf{1}-\alpha^{-1}\mathbf{1} \\
 \mathbf{1}^TA^{-1} - \alpha^{-1}\alpha\mathbf{1}^TA^{-1}  & \alpha^{-1}\alpha \end{bmatrix}\\ \\  &= \begin{bmatrix} 
I  & \mathbf{0} \\
 \mathbf{0}^T  & 1 \end{bmatrix}\end{align} $$
Addendum
In general, for a block matrix
$$B = \begin{bmatrix} 
A  & C \\
E & D 
\end{bmatrix},$$
if $A^{-1}$ exists , then the Schur complement
 of $A$ is $D- EA^{-1}C$ and 
$$\det(B) = \det(A) \det(D- EA^{-1}C)$$
Thus, $\det(B) \neq 0$ and $B^{-1}$ exists if and only if $\det(D- EA^{-1}C) \neq 0$.
In this case, the Schur complement reduces to a scalar $-\mathbf{1}^TA^{-1} \mathbf{1}$, and  the condition $\mathbf{1}^TA^{-1}\mathbf{1} \neq 0$ is necessary and sufficient for $B$ to be invertible.
</s>