Given a hyperplane $\{x\in\mathbb R^n | a^T x=0\}$ where $a\in\mathbb R^n$, and I want to find some orthogonal basis to this hyperplane.
I found many solutions for special cases, but non of which considers the general case.
Thanks in advance!
Given a hyperplane $\{x\in\mathbb R^n | a^T x=0\}$ where $a\in\mathbb R^n$, and I want to find some orthogonal basis to this hyperplane.
I found many solutions for special cases, but non of which considers the general case.
Thanks in advance!
On
I address the question of finding the most general form of an orthonormal basis of an hyperplane.
Once you have a particular orthonormal basis of the hyperplane $x^{\perp}$, (column) identified with the columns of a certain $n \times (n-1)$ matrix $B$, the most general answer is that any other orthonormal basis is associated with $B':=\Omega B$ where $\Omega$ is any orthogonal ($n \times n$) matrix, because orthogonal matrices ($\Omega^T=\Omega^{-1}$) preserve orthonormality.
Remark: this method works for orthonormal bases of any $k$-dimensional subspace.
Adapted from the answer under the link in the comment by jibounet, but without the messy formulae.
Without loss of generality assume $\|a\|=1$ (in other words replace $a$ by its normalisation, if necessary). Find one of the standard basis vectors, or its negative, that is different from $a$, say $e=\pm e_k\neq a$, which is clearly always possible (you can even make a choice such that $\|a-e\|>1$, for the sake of numeric stability in what follows). Then $v=a-e$ is a nonzero vector, and the orthogonal reflection $R$ with respect to the hyperplane perpendicular to $v$ will send $e_k\mapsto\pm a$. This means column $k$ of the matrix of $R$ equals$~\pm a$, and the remaining columns give you a basis of your hyperplane (remember, the columns of any orthogonal matrix, like that of a reflection, form an orthonormal basis of the space)
Concretely, the matrix of $R$ is given by $I-\frac2{\|v\|^2}(v\cdot v^T)$.