The operation is called matrix diagonalisation and goes as follows for a symmetric matrix (like an intertia tensor), with your matrix denoted as A and 1 the unit matrix.
- Find the eigenvalues a by solving 0 = det{A - a 1) for a. The values of a are the principal moments of inertia.
- Find the eigenvectors v of A by solving A v = a v for v.
- Normalize the eigenvectors.
- Form the matrix C whose whose columns consist of the normalized
- D = C^T A C is the diagonal matrix of principal moments of inertia.
In principle, you can write down D directly after 1), however, completing 1) to 5) gives a check on your work.
Note: C^T is the transpose of C.
For this case where the only off diagonal terms are 12 and 21, you
know it only needs a rotation about axis 3 to diagonalize it. Use a
similarity transformation:
A'JA where A is the 3x3 rotation matrix about z.
Solve to find
j12 = 0 = j11cos^a -j22sin^2a solve for a
j22 = j22cos^2(a) - j11sin^2(a)
j11 = j11cos^2(a) - j22sin^2(a)
I dont know if that's easier.





