Find a vector NOT perpendicular to a given set of vectors

Here is an algorithm that will work, although it might not work well in practice (because it might involve very large numbers). Reorder your vectors so that $v_2, \ldots, v_k$ are the vectors orthogonal to $v_1$, and $v_{k+1}, \ldots, v_m$ are not orthogonal to $v_1$. Recursively solve the problem for the vectors $v_2, \ldots, v_k$, so that you get a vector $y$ which is not orthogonal to any of $v_2, \ldots, v_k$. (If $k = 1$, i.e. there are no vectors in the set orthogonal to $v_1$, you can take any non-zero vector.)

Now define $$ \alpha = \max\left\{\left|\frac{\langle y, v_i\rangle}{\langle v_1, v_i\rangle}\right| \mid i \in \{k+1, \ldots, m\}\right\} + 1. $$ Then set $x = \alpha v_1 + y$. For $i \in \{2, \ldots, k\}$ we have $$ \langle x, v_i\rangle = \langle \alpha v_1 + y, v_i\rangle = \langle y, v_i\rangle \neq 0 $$ by definition of $y$. For $i \in \{k+1, \ldots, m\}$ we have $$ \langle x, v_i\rangle = \alpha\langle v_1, v_i\rangle + \langle y, v_i\rangle. $$ Now if this were to equal zero, we would have $$ \alpha = \frac{-\langle y, v_i\rangle}{\langle v_1, v_i\rangle} $$ which contradicts the definition of $\alpha$. Therefore $x$ is a vector which is not orthogonal to any element of the original set.


I don't think it matters whether $m > n$ or not, and clearly we assume that $s_i \ne 0$ for any $i$

Define a sequence of vectors $(x_j)_ {j = 1}^m$ and constants $(\alpha_i)_{i = 1}^m$ as follows and then $x = x_m$ satisfies your requirement.

$\alpha_1 = 1; x_1 = \alpha_1 s_1$ and so $x_1$ is not orthogonal to $s_1$.

Given $k < m$ and $x_k = \sum_{i = 1}^k \alpha_i s_i$ and $x_k$ not orthogonal to any $\{s_i\}_{i = 1, k}$
Then for $i = 1, k + 1$ let $c_i = x_k \cdot s_i$ so that by non-orthogonality $c_i \ne 0$ for $i = 1, k$.
If $c_{k+1} \ne 0 $ then put $\alpha_{k+1} = 0 \implies x_{k+1} = x_k$ and $x_{k+1}$ is not orthogonal to $\{s_i\}_{i = 1}^{k+1}$

Otherwise, chose $\alpha_{k+1} \ne 0$ and such that $\alpha_{k+1} s_{k+1} \cdot s_i \ne - c_i$ for $i = 1, k$
(which can be done even if $s_{k+1}\cdot s_i = 0$, since $c_i \ne 0$ for $i = 1, k$).
Then for $i = 1, k$,
$$ \begin{split} x_{k+1} \cdot s_i &= (x_k \cdot s_i) + \alpha_{k+1}(s_{k+1} \cdot s_i) \\ &= c_i + \alpha_{k+1}(s_{k+1}.s_i) \\ &\ne 0 \end{split} $$

And for $i = k+1$,
$$ \begin{split} x_{k+1} \cdot s_i &= (x_k \cdot s_i) + \alpha_{k+1}(s_{k+1} \cdot s_i) \\ &= (x_k \cdot s_{k+1}) + \alpha_{k+1}(s_{k+1} \cdot s_{k+1}) \\ &= 0 + \alpha_{k+1}(s_{k+1} \cdot s_{k+1}) \\ &\ne 0 \end{split} $$ So, $x_{k+1}$ is not orthogonal to $\{s_i\}_{i = 1, k+1}$