I want to find the rank of this $n\times n$ matrix \begin{pmatrix} 1 & a & a & \cdots & \cdots & a \\ a & 1 & a & \cdots & \cdots & a \\ a & a & 1 & a & \cdots & a \\ \vdots & \vdots & a& \ddots & & \vdots\\ \vdots & \vdots & \vdots & & \ddots & \vdots \\ a & a & a & \cdots &\cdots & 1 \end{pmatrix}
that is, the matrix whose diagonals are $1's$ and $a$ otherwise, where $a$ is any real number.
My first observation is when $a=0$ the rank is $n$ and when $a=1$ the rank is $1.$ Then I can assume $a\neq 0, 1$ and proceed row reduction to find its pivot rows. I obtain
\begin{pmatrix} 1 & a & a & \cdots & a \\ 0 & 1+a & a & \cdots & a \\ 0 & a & 1+a & \cdots & a \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & a & a & \cdots & 1+a \end{pmatrix} by subtracting the first row multiplied $a$ for each row below the first, and then divides the factor $(1-a)$, and stuck there. Any hints/helps?
Then $\det A=0\Rightarrow \mathrm{rank}(A)<n$, and
$\quad\quad\det A\ne0\Rightarrow \mathrm{rank}(A)=n$
– StubbornAtom Mar 11 '17 at 05:38