The eigenvalue of a special $n \times n$ matrix, where the rank is 2. I am given the following question:$$$$
A is a $n \times n$ matrix with the following characteristic:
$$A =\left(\begin{matrix} 
0 & 1& 0& 1& \cdots\\
1 & 0& 1& 0& \cdots\\
0 & 1& 0& 1& \cdots\\
1 & 0& 1& 0& \cdots\\
\vdots&\vdots&\vdots&\vdots&\ddots 
 \end{matrix}\right)$$
What is the eigenvalues of A? The answer is $\pm\frac{n}{2}$ which I belive is just an approximation. However, I can't find this approximation. The best I  perceived is the rank of matrix A is 2. So now I know $\lambda = 0$ is repeated $n-2$ times. The exact eigenvalues for $n = 2$ is $\pm1$; $n = 3$ is $\pm \sqrt{2}$, and $n =4$ is $\pm2$ but I can't reach $\pm\frac{n}{2}$ systematically. Please advise.
 A: The cases for even and odd $n$ are somewhat different from one another. In the case $n$ is even, the nonzero eigenvalues are $\pm\frac{n}{2},$ with corresponding eigenvalues $[1,1,\ldots,1]^{T}$ and $[1,-1,1,-1,\ldots,1,-1]^{T},$ as can be seen by computing the product $Ax$ for one of these vectors $x.$ In the case $n=2k+1,$ for some integer $k\geq 1,$ we consider the vectors $x^{+}=\left[1,\sqrt{\frac{k+1}{k}},1,\sqrt{\frac{k+1}{k}},1,\ldots,\sqrt{\frac{k+1}{k}},1\right]^{T},$ and $x^{-}=\left[1,-\sqrt{\frac{k+1}{k}},1,-\sqrt{\frac{k+1}{k}},1,\ldots,-\sqrt{\frac{k+1}{k}},1\right]^{T}.$ Computing, we see that for odd $j$, $(Ax^{\pm})_{j}=\pm\sqrt{k(k+1)},$ and for even $j$, $(Ax^{\pm})_{j}=k+1.$ But in either case, $\left(\pm\sqrt{\frac{k+1}{k}}\right)(\pm\sqrt{k(k+1)})=k+1,$ so we see that $x^{\pm}$ is an eigenvector with corresponding eigenvalue $\pm\sqrt{k(k+1)}.$
A: Let $v_e$ be the vector that has $1's$ in the even entries and $0$'s in the odd entries, and $v_o$ the vector that has $1's$ in the odd entries and $0$'s in the even ones.  Each even column of $A$ is $v_o$ and each odd column is $v_e$ (which quickly gives that the rank is two).  A nonzero eigenvector has to be in the image of $A$, so we can write it as $v=av_e+bv_o$.  However, we can compute:
$$Av_e=\lfloor n/2 \rfloor v_o, \qquad Av_o=\lceil n/2 \rceil v_e.$$
Thus, $A$ restricted to the image of $A$, expressed in terms of the basis $v_e,v_o$ is
$$ \pmatrix{0 & \lceil n/2 \rceil \\ \lfloor n/2 \rfloor & 0} $$
and our eigenvalues are the eigenvalues of this matrix, namely the roots of $x^2-\lfloor n/2 \rfloor\lceil n/2 \rceil.$
