(SOLVED) How to build a 3D random vector perpendic. to another vector Hi everybody, do you have an efficient method for build up a vector with random components which is perpendicular to another (unitary) 3D vector ? Context: I have to randomly select polarization vector (P) for unpolarized photons propagating on a certain direction (K) and the only condition is P being orthogonal to K. input: K = (Kx, Ky, Kz) (it can be normalized if needed) output: P = (Px, Py, Pz), P must be perpendicular to K and also unitary (modulus = 1) I guess the Gram-Schmidt process must be used BUT the important thing is that P has to be randomly chosen on the plane perpendicular to K among the infinite possibilities with equal probability. My photons propagates toward a preferential direction so if I chose everytime Px = Kx for starting the process, I'm giving a preferential orientation to P which is not the case. One more thing is that I have to do this in a code so if you want to put the answer in the form of an algorithm it would be really appreciated! Otherwise consider the use of random variables at some point in your explanation. Thank you very much in advance! :) ------------------------------------------ one possible solution (???) I choose a completely random vector, R, on a sphere centered at the origin of the reference frame of K. Then I make the cross product between R and K and I should obtain P perpendicular to K (and R) but randomly chosen.. P = K x R The question now is: does a random selection on a sphere produce a random vector on the plane perpendicular to K via cross product ?