The density of a linear rod of length L varies as
ρ = A + Bx where x is the distance from the left end.
Locate the centre of mass.
Let the cross-sectional area be α. the mass of an element of length dx located at a distance x away from the left ends is (A + Bx) dx. The x-coordinate of the centre of mass is given by
Xcm=∫xdm∫dm=∫LOx(A+Bx)adx∫LO(A+Bx)adx
=AL22+BL33AL+BL22=3AL+2BL23(2A+BL)