Here, variation of density is given by
`rho = A + Bx`
Let `a` be the area of cross-section of the linear rod. Consider a small element of the rod, of length `dx`, Fig at a distance `x` from the left end.
Volume of the element `= a dx`
mass of element, `dm = (a dx) rho = (A + Bx) a dx`
The x-coordinate of the centre of mass is
`x_(cm) = (int_(0)^(L) x dm)/(int_(0)^(L) dm) = (int_(0)^(L) x(A + Bx)a dx)/(int_(0)^(L)(A + Bx)a dx)`
`= ([A(x^(2))/(2) + B(x^(3))/(3)]_(0)^(L))/([Ax + (Bx^(2))/(2)]_(0)^(L)) = ([(AL^(2))/(2) + (BL^(3))/(2)])/([AL + (BL^(2))/(2)])`
`x_(cm) = (3AL + 2BL^(2))/(3(2A + BL))`