Suppose we find a set of basis that constitues the principial axis of some three dimensional body with mass. In this set of basis, our inertia tensor becomes a diagonal matrix, let $I' = diag(I_{x'x'},I_{y'y'}, I_{z'z'})$.
From what we know, principial axis are always perpendicular to each other, meaning that we can find this basis through some rotation transformation of our originally used basis $x,y,z$. For simplicity, we let the basis in which the inertia tensor is diagonal, be such that it's rotated $\theta$ degrees with respect to the $z$-axis.
I'm not exactly sure, but what I remember from linear algebra, we have that the new matrix $I = RI'R^T$ where $R$ is our rotation matrix. Suppose $\theta$ is measured counterclockwise seen from above, since we want to rotate "backwards" in some sense, we have that:
$$ R = \begin{pmatrix} \cos(\theta) & \sin(\theta)& 0\\ -\sin(\theta)& \cos(\theta)& 0\\ 0 & 0& 1\\ \end{pmatrix}$$
$R$'s transpose is easy to calculate. We get:
$$ R^T = \begin{pmatrix} \cos(\theta) & -\sin(\theta)& 0\\ \sin(\theta)& \cos(\theta)& 0\\ 0 & 0& 1\\ \end{pmatrix}$$
Therefore $$I = R = \begin{pmatrix} \cos(\theta) & \sin(\theta)& 0\\ -\sin(\theta)& \cos(\theta)& 0\\ 0 & 0& 1\\ \end{pmatrix} diag(I_{x'x'},I_{y'y'}, I_{z'z'}) \begin{pmatrix} \cos(\theta) & -\sin(\theta)& 0\\ \sin(\theta)& \cos(\theta)& 0\\ 0 & 0& 1\\ \end{pmatrix} = \begin{pmatrix} I_{x'x'} \cos^2(\theta) + I_{y'y'} \sin^2(\theta) & (I_{y'y'}-I_{x'x'}) \cos(\theta) \sin(\theta) & 0\\ (I_{y'y'}-I_{x'x'}) \cos(\theta) \sin(\theta) & I_{x'x'} \sin^2(\theta) + I_{y'y'} \cos^2(\theta) & 0\\ 0 & 0& I_{z'z'} \\ \end{pmatrix}$$
I see that in alot of problems, the axis are just rotated with some angle, and I'd like to express the matrix in my original set of basis $xyz$ in the fashion above. So I now wonder, is my idea right, and is there an even more generalized way of doing this?
Thanks.