Let $M = \begin{pmatrix} p_0 (1- p_0) & -p_0 p_1 &\ldots & p_0 p_n\\ -p_1 p_0 & p_1 (1-p_1) & \ldots & p_1 p_n\\ \vdots & & &\vdots\\ -p_np_0 &\ldots&&p_n(1-p_n)\end{pmatrix}$ where $\sum_i p_i = 1$ and $p_i >0$ for all i. How to show this matrix has rank n?
For clarity, $M_{i,j} = p_i(\delta_{ij} - p_j)$ and $\delta_{ij} = 1$ if $i = j$ and 0 otherwise, where $\sum_i p_i = 1$ and $p_i >0$.
I tried random values of $\{p_0, \ldots, p_n\}$ and it consistently returns n, so hoping for the rank be n.
Your matrix is $$M=D-uu^\top$$
, where $D=\text{diag}(p_0,p_1,\ldots,p_n)$ and $u=(p_0,p_1,\ldots,p_n)^\top$
Consequently, $$\operatorname{rank}(M)\ge |\text{rank}(D)-\operatorname{rank}(uu^\top)|=n+1-1=n$$
The matrix $M$ of order $(n+1)\times(n+1)$ is related to the dispersion matrix of a singular multinomial distribution ('singular' because of the restriction $\sum\limits_{k=0}^n p_k=1$). Hence rank of $M$ is at most $n$.
This is also seen from the fact that $$\det M=\left(\prod_{k=0}^n p_k\right)\left(1-\sum_{k=0}^n p_k\right)=0$$
So, $\operatorname{rank}(M)=n$.