If a vector lies in the line of rotation, after multiplying the rotational matrix on the vector, the vector stays the same.
That is to say if we denote this vector by , then we have
Equivalently we are looking for eigenvector corresponding to eigenvalue 1. We need to solve characteristic equation
By row reduction we have
So the eigenvector is
which is the vector direction of axis.