For point mass m at generalised position vec r with respect to origin, its angular momentum is:
vec L = vec r times m vec v = m vecr times ( vec omega times vec r)
From the bac-cab rule
(vec L)/m = vec omega (r^2) - vec r (vec r * vec omega)
In cartesian
(vec L)/m = ((omega_x),(omega_y),(omega_z)) (x^2+y^2+z^2) - ((x),(y),(z)) (((x),(y),(z)) * ((omega_x),(omega_y),(omega_z)) )
(vec L)/m = ((omega_x),(omega_y),(omega_z)) (x^2+y^2+z^2) - ( (x),(y),(z)) (x omega_x + y omega_y + z omega_z)
If we pick out the x-component of angular momentum, we have
L_x/m = omega_x (x^2+y^2+z^2) - x (x omega_x + y omega_y + z omega_z)
= omega_x (y^2+z^2) - x y omega_y - x z omega_z
L_x = color(red)( omega_x) m(y^2+z^2) - color(green)(omega_y) mx y - color(blue)( omega_z) m x z
= I_(x x) omega_x + I_(xy) omega_y + I_(xz) omega_z
We can pattern match to find a 3x3 matrix:
vec L = m ( ( y^2+z^2, -xy, -xz), ( -yx, x^2 + z^2, -yz), (-zx, -zy, x^2+y^2 )) ((omega_x), (omega_y), (omega_z))
= ( ( I_{x x}, I_{xy}, I_{xz}), ( I_{yx}, I_{yy}, I_{yz}), ( I_{zx}, I_{zy}, I_{zz} )) ((omega_x), (omega_y), (omega_z))
So that
I = m ( ( y^2+z^2, -xy, -xz), ( -yx, x^2 + z^2, -yz), (-zx, -zy, x^2+y^2 ))
In this generalised form, inertia is a 3x3 tensor (ie of rank 2).
If we consider simple circular rotation of the mass in a plane about the origin, we can set the co-ordinate system so that rotation is about the z-axis at z = 0, ie with omega_x = omega_y = 0 and omega_z = omega.
Angular momentum then is
L = m ( ( y^2, -xy, 0), ( -yx, x^2 , 0), (0, 0, x^2+y^2 )) ((0),(0),(omega_z))
= m (x^2 +y^2) omega_z = m r^2 omega_z = I omega
In this simplified form, I = mr^2 which is a scalar (but still also a tensor of rank zero).