The Center of Mass of a Rod

Homework Statement

A rod of length 30.0 cm has linear density (mass-per-length) given by

λ = 50.0 g/m + 20.0x g/m2

where x is the distance from one end, measured in meters. (a) What is the mass of the rod?

(b) How far from the x = 0 end is the center of mass?

Xcm = l/2

The Attempt at a Solution

λ = 50.0 g/m + (20.0)(.3m) g/m2

λ = 56 g/m * .3 m

λ = 16.8 g

Xcm = .3/2 = .15

The actual answers are 15.9 g and .159 m

Am I not using the formulas correctly?

$$m=\int\limits_0^L \lambda(x) {\rm d}x$$

$$x_G=\frac 1 m \int\limits_0^L x\lambda(x) {\rm d}x$$

Would I consider λ a constant.

m = λ1/2x2

m = (50.0 g/m + (20.0)(.3m) g/m2)(1/2)(.32)

of integrate it as well. Both ways that doesn't seem to be the right answer either. I get 2.43 if I integrate λ, and 2.52 if I don't.

Would I consider λ a constant.

$$\lambda$$(x) is a function of x that happens to be 50.0 + 20.0x, so you replace

$$\lambda$$(x) by 50.0 + 20.0x and integrate the result.

This is ridiculously when you put it that way. Thanks, I understand how to apply the formulas now. Hopefully when it gets rearranged for a test I will still see it.