Defining an Arbitrary Axis

I'm trying to define an axis as a set of 3 unit vectors--u, v, and w. at a given point P

Suppose we are given the following vector u. From this vector u, we must define a plane such that u is normal to the plane. This plane will be represented by two perpendicular vectors v and w.

There are infinite many solutions to this problem; however, I am writing a computer program to do this, so step by step algorithm is needed. I know that once we find v, w will be the cross product of u and v.

All you need here is the vector u and a basis of three vectors that you already know span the space--x, y, and z.

Your first basis vector is [itex]u[/itex]. The second basis vector is [itex]v = x - \hat u \cdot x[/itex]. The third basis vector is [itex]w = y - \hat u \cdot y - \hat v \cdot y[/itex]. These vectors all need to be normalized when you're done, and in general, you need three vectors (x, y, and z) in case one of these vectors is aligned perfectly with u or v, but this can be handled simply.

If I understood correctly you have a vector at a point and you want the plane that passes through that point and in normal to the vector, right? I am also not sure why you would need 2 normal vectors to define the plane.

The general equation of a plane is [itex]f(x,y,z)=ax+by+cz+d=0[/itex]. You need three equations to find the constants.

The first is that the plane is passing through the vector origin, which gives you "d".

Now, your normal vector is [itex]\nabla f=ai+bj+ck[/itex]. This is the vector that you already have, which means that the plane's coefficients a,b,c are simply the components of your vector. There is not even a need to find the unit normal

If all you want is the axis that the vector defines, you can always dot product it with i,j,k to find its components, and you get the axis in vector form directly.