How do you find the rank of this matrix
$\begin{bmatrix} 0 &1& 2&1\\ 1&0&1&2\\ 2&1&0&1\\ 1&2&1&0 \end{bmatrix}$
My try:
I wrote $\begin{bmatrix} 0 &1& 2&1\\ 1&0&1&2\\ 2&1&0&1\\ 1&2&1&0 \end{bmatrix}$ as $$\begin{bmatrix} 0 &1& 2&1\\ 1&0&1&2\\ 2&1&0&1\\ 1&2&1&0 \end{bmatrix}= \begin{bmatrix} 0 &1& 1&1\\ 1&0&1&1\\ 1&1&0&1\\ 1&1&1&0 \end{bmatrix}+\begin{bmatrix} 0 &0& 1&0\\ 0&0&0&1\\ 1&0&0&0\\ 0&1&0&0 \end{bmatrix}$$
Now $\begin{bmatrix} 0 &1& 1&1\\ 1&0&1&1\\ 1&1&0&1\\ 1&1&1&0 \end{bmatrix}$ has rank $3$ and $\begin{bmatrix} 0 &0& 1&0\\ 0&0&0&1\\ 1&0&0&0\\ 0&1&0&0 \end{bmatrix}$ has rank $4$.
So using the fact that $rank(A+B)\le rank(A)+rank(B)$, I get $\begin{bmatrix} 0 &1& 2&1\\ 1&0&1&2\\ 2&1&0&1\\ 1&2&1&0 \end{bmatrix}$ has rank less than equal to $7$ which is useless as a $4\times 4$ matrix has rank atmost $4$.
What can I do to calculate the rank of the matrix given above? Please help
Observe that $R_3=R_2+R_4-R_1$. So rank$\leq 3$. Now check to see if $R_1,R_2, R_4$ are linearly independent. The check is fairly straightforward because the columns of the $3 \times 4$ matrix (after deleting $R_3$) \begin{bmatrix} 0 &1& 2&1\\ 1&0&1&2\\ 1&2&1&0 \end{bmatrix} can be easily seen to be forming a basis for $\Bbb{R}^3$. This means the rank of this matrix is $3$, hence the rank of the original matrix is also $3$.