# Vector orthogonal to the set of vectors

Let's suppose that we have $n-1$ vectors $v_1, v_2 ... v_{n-1}$ in $n$-dimensional space.

Now we want to have any non-zero vector $w$ which is orthogonal to all these vectors $v_i$.
If these $n-1$ vectors are linearly independent we have a simple formula for obtaining this vector i.e.
$w = det {\begin{bmatrix} e_1 & e_2 & ... & e_n \\ &v_1^T\\ &v_2^T \\ &..... \\ &v_{n-1}^T \end{bmatrix}}$

where $e_1, e_2, .. e_n$ are standard basis vectors (similar formula is used for 3-D cross product - in $2^{nd},3^{rd} .. n^{th}$ row we have as entries of the matrix components of vectors $v_i$ i.e. scalars but in the first row vectors are entries so the result of calculation of this determinant is a vector).

Question:

how to obtain any non-zero vector $w$ orthogonal to all vectors $v_i$ in the case when $v_1, v_2 ... v_{n-1}$ are linearly dependent or we simply don't know whether they are or are not linearly independent ? Can we achieve it with a use of other single formula ?

• First we want to establish linear independence for the given vectors so that we know what we are dealing with. That's a standard technique. As far as creating an orthogonal vector, that can be done using the dot product. If the vector to be creates is of the form $<a,b,c,d,...>$ then dot this vector with all other vectors and you arrive at a homogeneous system. It's solution is the Null space from which one solution can be obtained for your vector. Oct 19, 2016 at 15:06
• @imranfat Yes, but it is a multi-step procedure. Could not by applied something simpler, in a single step preferably ? Please note that not all orthogonal vectors are required but it's enough to have any single vector.. Oct 19, 2016 at 16:18
• I am not aware of a simpler method, though with a graphing calculator (matrix tool) it isn't all that hard. Provide an actual example might help Oct 19, 2016 at 16:48
• @imranfat Could not be the formula with determinant somehow modified for the purpose of finding an orthogonal vector? Oct 19, 2016 at 17:02
• I honestly don't know. I know the method of the cross product for the R3 case and otherwise the dot product for the general case. Never lets me down Oct 19, 2016 at 19:41

Suppose your $n-1$ vectors span a space of dimension $d<n-1$, then the space $S$ of possible vectors orthogonal to them has dimension $n-d>1$. Now if you take any subspace $L$ of dimension$~1$ in $S$, you can easily make that line to be the only set of possibilities by making a very small adjustment to your vectors (add small multiples of vectors in $S$ but orthogonal to $L$ to some of your vectors). By continuity, the vector of $S$ that your formula chooses must be arbitrarily close to any such line $L$, and the zero vector is the only one that satisfies this requirement.
• Yes, this is a very general description. From other questions I know now that basis vectors of $n$-dimensional space could be applied in the process and some of them, for sure, are not belonging to the subspace. Because operation $Ae_i$ is just a choice of the $i^{th}$ column of A ( we need non-zero vector) the simplest way of finding a required vector it seems to construct $A$ matrix which should be of the form $I-P$ where $P$ is projection into subspace. Is it a good strategy ? Oct 23, 2016 at 12:45
• Additionally. ..Maybe expression $V(V^TV)^{-1}V^T$ can be also useful ? ( $V$ - matrix where columns are $v_i$) ? Oct 23, 2016 at 13:27