The density of a linear rod of length 'L' varies as p = A+Bx where x is the distance from the left end. Then the position of the centre of mass from the left end is
3AL+2BL23(2A+BL)
xcm = ∫L0dmx∫L0dm
where dm = ρdx
dm = (A+Bx)dx
⇒xcm=∫L0[(A+Bx)dx]x∫L0(A+Bx)dx=∫L0Axdx+∫L0Bx2dx∫L0Adx+∫L0Bxdx
⇒xcm=3AL+2BL23(2A+BL)