I wish to find non-zero vectors $\mathbf{v} \in \mathbb{R}^3$ perpendicular to a vector $\mathbf{u} \in \mathbb{R}^3$. I know that $\mathbf{u} \perp \mathbf{v} \iff \mathbf{u} \cdot \mathbf{v} = 0$, hence these perpendicular vectors must lie on a plane $u_1v_1 + u_2v_2 +u_3v_3 = 0$.
In "How to find perpendicular vector to another vector?", @Did gave a method:
Choose two coordinates, switch them, add a minus sign, and complete with zeroes. For example: choosing i and j might yield 4i-3j, choosing i and k might yield 2i+3k, and choosing j and k might yield 2j+4k
I can see why this recipe works in $\mathbb{R}^2$ (where the "complete with zeroes" step doesn't exist). For $\mathbf{u},\mathbf{v} \in \mathbb{R}^2$, $u_1v_1 + u_2v_2 = 0 \to v_2=-\frac{u_1}{u_2}v_1$ hence all vectors $\mathbf{v}=(c,-\frac{u_1}{u_2}c), c\in\mathbb{R}$ are perpendicular to $\mathbf{u}$. Then, by setting $c=u_2$ or $c=-u_2$ I get a perpendicular vector $\mathbf{v}=(u_2, -u_1)$ or $\mathbf{v}=(-u_2, u_1)$, respectively. That's precisely the rule described above. The solutions obtained with the rule come from the set of solutions and I'm assured that it should work for any $\mathbf{u} \in \mathbb{R}^2$.
The problem arises when I seek to explain the case of $\mathbb{R}^3$.
The rule seems to work for any $\mathbf{u} \in \mathbb{R}^3$. I can't find any combinations of swaps which would not result in a perpendicular vector. However, I can't verify this rule via the general solution as I did before. Here is my attempt:
$$u_1v_1 + u_2v_2 +u_3v_3 = 0$$
Taking $v_3 = u_3^{-1}(-v_1u_1 - v_2u_2)$ I obtain:
$$\mathbf{v} = \begin{bmatrix}a\\b\\u_3^{-1}(-au_1 - bu_2) \end{bmatrix} \quad | \quad a,b \in \mathbb{R}$$
I could set $a=b=u_3$ which results in a perpendicular vector $\mathbf{v}=(u_3, u_3, -u_1-u_2)$, or $a=b=-u_3$ which gives $\mathbf{v}=(-u_3, -u_3, u_1+u_2)$. I don't see any particular values of $a, b$ which would give me "the rule", as I found previously for $\mathbb{R}^2$.
- How can I verify this rule in $\mathbb{R}^3$? I want to show that for any $\mathbf{u} \in \mathbb{R}^3$, any form of the application of the rule (different swapping) always provides a vector $\mathbf{v} \in \mathbb{R}^3$ perpendicular to $\mathbf{u}$?
- Does it generalize to $\mathbb{R}^n$?
EDIT: I reformulated the question after Shubham Johri corrected a mistake I did previously - Thanks!
Thanks to @Blue and @Cardioid_Ass_22 for helping me with the problem in comments. I think I got it, here's my answer to my question.
The case of $\mathbb{R}^3$ can be reduced to the explanation given for $\mathbb{R}^2$. In fact, any $\mathbb{R}^n$ can.
To find $\mathbf{v} \in \mathbb{R}^n$ perpendicular to $\mathbf{u} \in \mathbb{R}^n$, I can assume $n-2$ variables (components of $\mathbf{v}$) to be zero, which makes the corresponding components of $\mathbf{u}$ irrelevant in the dot product.
$$u_1v_1 + ... + u_iv_i + .... + u_jv_j + ... + u_nv_n = 0$$
$$u_10 + ... + u_iv_i + .... + u_jv_j + ... + u_n0 = 0$$
$$u_iv_i + u_jv_j = 0$$
Now, the only condition is that at least one of the components chosen for swaping is non-zero: $u_i$ or $u_j$ is non-zero.
Then, according to the recipe swap components and change the sign of one of them: $v_i=u_j$, $v_j=-u_i$
$$(u_i)(u_j) + (u_j)(-u_i) = 0 \to \mathbf{u} \cdot \mathbf{v} = 0 \to \mathbf{u} \perp \mathbf{v}$$
The above is also valid in terms of the verification I did for $\mathbb{R}^2$ before (i.e. finding the general solution of $u_iv_i + u_jv_j = 0$).
EDIT: I just wanted to add that the only method simpler than the recipe above is when there exists a zero component in $\mathbf{u}$. When $u_i=0$, then a vector $\mathbf{v}$ with only one non-zero component $v_i$ (e.g. $v_i=1$) is perpendicular to $\mathbf{u}$.