# How to find all 3 orthogonal vectors to a 4D vector

For a program I'm writing, I need to find the vectors orthogonal to a given vector rotated at an arbitrary angle, and in 4D. It is a unit vector.

For 3D, I found the two orthogonal vectors like this:

I would find the first orthogonal vector by taking the spherical coordinates of the original vector, adding $\frac{\pi}{2}$ to $\phi$, and calculating the resulting vector's rectangular coordinates.

To find the third and final orthogonal vector in 3D, I take the cross product of the orthogonal vector and the original vector.

I want to implement a version of this in 4D. However, I can't easily visualize this happening, and I understand little about vectors as it is. I believe I need to find two orthogonal vectors through the method of adding $\frac{\pi}{2}$ to the correct spherical coordinate, giving me 3 orthogonal vectors. I can then take the cross product of these three vectors. I have been completely unable to even start on this. Is there a better way, or can I just not see it?

If it helps, I'm using these vectors to "rotate" coplanar 3D and 4D points to align along an axis, removing one of the dimensions needed to render the full shape. Essentially, I'm trying to render the cross section of higher-dimensional solids.

• How about finding a basis containing that vector, extending the basis to a basis for the space, and then applying Gram-Schmidt to get an orthonormal basis? Dec 26 '13 at 6:43

One way to do this is by using the fundamental theorem of linear algebra: http://en.wikipedia.org/wiki/Fundamental_theorem_of_linear_algebra . Using the 4d-vector as the first row of a $4 \times 4$ matrix $M$ , then finding the nullspace of that matrix, since ker$M$ =orthogonal complement of the row space. This will extend the 4d-vector into a basis for $\mathbb R^4$