Moment of inertia of solid cylinder I want to work out the moment of inertia of a solid cylinder of radius $r$, length $l$ and mass $M$ about an axis through the centre of the cylinder. 
My approach was to line the central axis of the cylinder with the $x$-axis and consider a small cylindrical element of thickness $dx$. Then my mass element would be $dm = \rho \pi r^2 dx$, where $\rho$ is the mass per unit volume (density). 
Using the formula for moment of inertia and integrating from $0$ to $l$, I then find the answer to be $Mr^2$. Now that is wrong, there should be a factor of $\frac{1}{2}$ in there. But I don't understand why. Some solutions I've seen online consider concentric disks, but I don't understand why this method isn't working. 
 A: The $dm$ you have calculated is incorrect. The radius will vary. Which you have assumed constant. So ,
(https://i.stack.imgur.com/f4VjF.png)
[r1=x is the distance of each element from axis]
$$dm=\rho 2\pi x dx l$$.
$$\rho=\frac{M}{\pi R^2l}$$
$$dI=(dm) x^2$$
So,
$$I=\int_0^R \frac{2M}{R^2}x^3$$
$$I=\frac{MR^2}{2}$$
A: The definition of moment of inertia is definied as $\iiint_V r^2\rho dV$.
Where r is the distance between the axis of ratation and the volume dV.
In the case of a cylinder this integral will be:
$$\rho\int_0^{2\pi}d\theta\int_0^Rr^2.rdr\int_0^{h}dz$$
Your answer is wrong because you threated r as if it was a constant, I guess.
A: I think you have a hard conceptualizing your $dm$, which is fine because it is not easy at first. Consider $dm$ as a tiny bit of matter in your cylinder. A bit comprised between radius $r$ and $r+dr$, $z$ and $z+dz$ and $\theta$ and $\theta+d\theta$, where all the $dx$ are an infinitesimal increment. 
The integral means you take the contribution $r^2 dm$ of each of these tiny bit of matter to the total moment of inertia. The position (the value of $r$) of your element in a cylinder varies from the inner radius to the outer radius. If your cylinder is not hollow, this means your inner radius is zero. Therefore, if we focus only on the r dependency of the integral, we obtain $\int_0^Rr^3dr = \frac{1}{4}R^4$. 
The $2\pi$ factor from integrating the angular part, and the definition of the density as the total mass divided by the total volume (for an homogeneous cylinder) will give you the $\frac{1}{2} R^2$ final result (again, focusing only on the radial part of the result)
