Daniel B. answered 01/15/21
A retired computer professional to teach math, physics
Notation:
1) Let me denote the length of the rod as L, rather than l, because the latter looks like 1.
2) All definite integrals below are between 0 and the length L.
3) Let g be gravitation acceleration.
First calculate the position c of the center of gravity along the rod of length L.
It is the point around which the total torque is zero.
The torque of a point of mass dm at position r from the center of gravity is the product
r g dm
In terms of position x from the beginning of the rod:
r = x - c,
dm = A x dx
The total torque is the sum of all the mass points along the rod and that has to be 0:
∫(x - c) g A x dx = 0
A g ∫(x² - cx) dx = 0
L³/3 - cL²/2 = 0
c = 2L/3
Now we calculate the moment of inertia I.
The moment of inertia dI of a point mass dm of length dx at distance r from the center of gravity is
dI = r²dm
In terms of the x-coordinate
r² = (x - c)² (regardless whether x < c or x > c)
dm = A x dx
The whole moment of inertial is the sum over all the points of mass:
I = ∫(x - c)² A x dx = A ∫(x³ - 2cx² + c²x)dx = A (L4/4 - 2cL³/3 + c²L²/2)
Now substitute the above calculated c = 2L/3:
I = A(L4/4 - 4L4/9 + 4L4/18) = AL4/36
Just for interest we can calculate the mass M of the whole rod:
M = ∫Axdx = AL²/2
Then we can write the moment of inertia as
I = ML²/18