I have a set of weighted points in 3D space (in fact, a molecule) and I'm trying to align the principal axes of this set with the $x$, and $y$ and $z$ axes. To do so, I've first translated my points so their barycenter coincides with the origin. Then, I've calculated the moment of inertia tensor $I$ and its eigenvalues ($\lambda_i$) and eigenvectors ($V_i$).
Then, I need to build the rotation matrix associated with the rotation bringing my vectors $V_i$ onto $(x,y,z)$. I assumed that would be the inverse of the matrix formed by the vectors $V_i$ in columns, but it is not. So, how would you write this matrix from what I have already calculated?