Orthogonal basis in Euclidean space Assume that in the Euclidean space $\mathbb{R}^{n}$ we have an orthogonal basis made from vectors with coordinates equal to $1$ or $-1$. 
Show that either $n \leq 2$ or $n = 4k$, where $k \in \mathbb{N}$.
The case when $n \leq2$ is quite easy, but how to show that $n$ is a multiple of $4$?
 A: Assume that $n \geq 3$ and let 
$$ v_1 = (a_1, \ldots, a_n), \\
   v_2 = (b_1, \ldots, b_n), \\
   v_3 = (c_1, \ldots, c_n) $$
be three vectors such that $a_i, b_i, c_i \in \{ \pm 1 \}$ and 
$$ \left<v_1, v_2 \right> = \left<v_1, v_3 \right> = \left<v_2, v_3 \right> = 0. $$
Define the following four sets:
$$ I_{ij} = \{ 1 \leq k \leq n \, | \, b_k = (-1)^i a_k, \, c_k = (-1)^j a_k \} $$
where $i, j \in \{ 0, 1 \}$. For example, $I_{00}$ is the collection of all indices $1 \leq k \leq n$ such that $a_k = b_k = c_k$. Clearly, the subsets $I_{ij}$ partition $\{ 1, \ldots, n \} = [n]$ and we have
$$ \{ i \in [n] \, | \, a_i = b_i \} = I_{00} \cup I_{01}, \\
   \{ i \in [n] \, | \, a_i = -b_i \} = I_{10} \cup I_{11}, \\
   \{ i \in [n] \, | \, a_i = c_i \} = I_{00} \cup I_{10}, \\
   \{ i \in [n] \, | \, a_i = -c_i \} = I_{01} \cup I_{11}, \\
   \{ i \in [n] \, | \, b_i = c_i \} = I_{00} \cup I_{11}, \\ 
   \{ i \in [n] \, | \, b_i = -c_i \} = I_{01} \cup I_{10}. $$
Using the descriptions above, we can write the orthogonality relations as
$$ 0 = \left< v_1, v_2 \right> = \sum_{i=1}^n a_i b_i = \sum_{\{ i \in [n] \, | \, a_i = b_i \}} 1 + \sum_{\{i \in [n] \, | \, a_i = -b_i \}} (-1) = |I_{00}| + |I_{01}| - |I_{10}| - |I_{11}|, \\
0 = \left< v_1, v_3 \right> = \sum_{i=1}^n a_i c_i = \sum_{\{ i \in [n] \, | \, a_i = c_i \}} 1 + \sum_{\{i \in [n] \, | \, a_i = -c_i \}} (-1) = |I_{00}| + |I_{10}| - |I_{01}| - |I_{11}|, \\
0 = \left< v_2, v_3 \right> = \sum_{i=1}^n b_i c_i = \sum_{\{ i \in [n] \, | \, b_i = c_i \}} 1 + \sum_{\{i \in [n] \, | \, b_i = -c_i \}} (-1) = |I_{00}| + |I_{11}| - |I_{01}| - |I_{10}|. $$
Written explicitly, we have the following system of equations
$$ |I_{00}| + |I_{01}| + |I_{10}| + |I_{11}| = n, \\
|I_{00}| + |I_{01}| = |I_{10}| + |I_{11}|, \\
|I_{00}| + |I_{10}| = |I_{01}| + |I_{11}|, \\
|I_{00}| + |I_{11}| = |I_{01}| + |I_{10}|.
$$
These system of equations have a unique solution $|I_{00}| = |I_{01}| = |I_{10}| = |I_{11}| = \frac{n}{4}$ which imply that $4$ divides $n$.
