Daniel B. answered 01/05/21
A retired computer professional to teach math, physics
The mass is the integral of density over the length of the rod.
Let's first do the indefinite integral
∫Ax²dx = Ax³/3
a)
The definite integral from 0 to L is AL³/3
b)
First note that the mass of any section between x-values a and b
is the definite integral from a to b, i.e.
(b³-a³)A/3
The center of gravity is the value xcm, such that the mass to the left is the same as the mass to the right. That is,
(xcm³-0³)A/3 = (L³-xcm³)A/3
xcm = L / 21/3