Sparse basis orthogonal to the ones vector Let $v\in \mathbb{R}^{n}$ be the vector of ones, $v=(1,1,1,\cdots,1).$
I need an orthogonal basis for the orthogonal complement $v^{\perp}$, the space of all vectors orthogonal to $v$. Of course, one can solve for such a basis using Gram-Schmidt, but I have an extra requirement: that the basis vectors are sparse.
Is there a standard such basis? I can start writing down basis vectors in an ad-hoc way, e.g.
\begin{align*}
b_1 &= (1, -1, 0, 0, \cdots)\\
b_2 &= (0, 0, 1, -1, \cdots)
\end{align*}
but obviously this pattern runs out after $n/2$ vectors.
 A: I am not sure how good this approach might work for your problem. But maybe you can give it a shot. Let us try viewing your problem as an optimization problem. Then what you require is a matrix $X$ of dimensions $n\times n-1$ whose columns are orthogonal to each other and also orthogonal to the all-ones vectors. Let's call the all-ones vector as $a$. At the same time you want this matrix as sparse as possible. Then your problem can be written as
$$\min_{X\in\mathbb{R}^{n\times n-1}}~||X||_0 \\s.t.~~X^TX=I ~\\~~~~X^Ta=0$$The first constraint is referred to as the orthogonality constraint. $||X||_0$ is the $L_0$ norm of the matrix $X$ (simply put the number of non-zero entries). Thus, you are trying to find a matrix such that it's columns are orthogonal to each other and also is orthogonal to a given vector $a$. Now, the objective is non-convex (and non-differentiable) and so is the orthogonality constraint.
What is typically followed in practice then is that you can relax the $L_0$ norm to $L_1$ norm. Then objective becomes convex and differentiable. Also, the second constraint is already convex. Now, this belongs to the category of problems typically referred to as optimization with orthogonality constraints. There is already lot of research in this which you can google and find out. One such paper is here. Note that this is more of a universal approach and doesn't take into account about the fact that $a$ is a all-ones vector which is what some other answers are doing and thus might be more effective.
