In relation to a more generalized way of finding a vector, v, such that it is perpendicular to all the vectors in the set S (which holds n-1 vectors, and we are in R^n for the moment), you can use the Gram-Schmidt Process.

You can first choose an arbitrary vector, w, to be our new vector in the set which we will change into a perpendicular vector. The GS Process works in a way such that it doesn't matter which vector w we choose, because it will change it into the correct perpendicular vector (the process also normalizes it, such that it has a length of 1).

Let's do an example.

Let's say we have 2 orthogonal vectors. We can use this process to make any set of vectors orthogonal to each other, but at this time, we are just trying to find a vector that is orthogonal to a set of already orthogonal vectors.

z = (1/3)*(2,2,1)

v = (1,-1,0)

Notice that z.v = 0

So, we want to find a vector, w such that z.w = 0 and v.w = 0.

Let's just choose w = (1,1,1)

In order to find this orthogonal vector, we use the GS procedure. Let u3 = orthogonal vector to z and v.

u3 = w - <z,w>z - <v,w>v

Where <x,y> = x.y (in this case).

<z,w> = (1,1,1) dot (1/3)(2,2,1) = (1/3)(2+2+1) = 5/3

<v,w> = (1,0,0) dot (1,1,1) = 0

Therefore:

u3 = (1,1,1) - (5/3)*(1/3)*(2,2,1) - 0*(1,0,0)

u3 = (-1/9,-1/9,4/9)

So, we have found our orthogonal vector to z and v using this process. This can be generalized to a set of k vectors, by assuming that we have k vectors (v1,v2,v3...vk)

uk = vk - <v1,vk>*v2 - <v2,vk>*v2 ..... - <v_k-1, vk>*v_k-1