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$.

  1. 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}$?
  2. Does it generalize to $\mathbb{R}^n$?

EDIT: I reformulated the question after Shubham Johri corrected a mistake I did previously - Thanks!

  • 3
    $\begingroup$ When you swap the second and third co-ordinates of $(1,0,-1)$ and complete with zeroes, you get $(0,\color{red}1,\color{red}0)$, which is perpendicular to the former. $\endgroup$ Jul 30, 2019 at 18:23
  • 1
    $\begingroup$ @oskarryn: The rule comes from just make it work. Zeroes in the new vector make the corresponding components of the given vector irrelevant (as they contribute nothing to the dot product value). Now, since you're looking for non-zero vectors, you can't put zeroes everywhere. A single non-zero component would only help if there were a zero in the given vector (just give the new vector, say, a $1$ in the matching component); with or without a zero in the given vector, two non-zero components in the new vector can work, in just the way Did described. $\endgroup$
    – Blue
    Jul 30, 2019 at 20:07
  • 3
    $\begingroup$ Maybe looking at the problem in higher dimensions will help. Say we have a vector $(a,b,c,d,e)$ in $\mathbb R^5$. Let's say we choose to perform the "recipe" on the last two components to get $(0,0,0,-e,d)$. Look at what happens when we take the dot product of this vector with the original one. The result is: $a*0+b*0+c*0+d*(-e)+e*d$. All those $0$s at the start- they make it so that all components, $a,b,c$, play no role in the dot product- they're all "zeroed out". In the end, the only components that could affect the dot product are $d$ and $e$. And the terms involving $d$ and $e$ cancel out $\endgroup$ Jul 30, 2019 at 20:49
  • 2
    $\begingroup$ @Cardioid_Ass_22: Correct, with a caveat: At least one of the two components on which the recipe is performed must be non-zero, or else the resulting vector is all-zeroes. (Assuming the given vector is non-zero, we are assured a way to choose a non-zero component.) $\endgroup$
    – Blue
    Jul 30, 2019 at 21:46
  • 1
    $\begingroup$ @oskarryn: Ah, yes ... That wasn't very clear. By "two non-zero components" there, I was thinking about the two components of the new vector that hadn't already been populated with zeros from the first part of the process. (So, "the two components that you didn't personally force to be zero".) If, in the second part of the process, the "recipe" happens to zero-out one of the remaining components, that's okay, but by that stage you don't even have to be paying attention. :) $\endgroup$
    – Blue
    Jul 31, 2019 at 9:12

1 Answer 1


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}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .