Let H and D denote the height and diameter, respectively, of cylinder P, and h and d the height and diameter of cylinder Q.
Then the volumes of P and D, denoted V and v, respectively, are
V = π (D / 2)² H = π D ² H / 4
v = π (d / 2)² h = π d ² h / 4
The height of P is twice the height of Q, so H = 2h.
The diameter of P is half the diameter of Q, so D = d / 2.
Substitute these into equation for the volume of cylinder P:
V = π (d / 2)² (2h) / 4
V = π (d ² / 4) (2h) / 4
V = π d ² h / 8
V = 1/2 • π d ² h / 4
V = v / 2
That is, cylinder P has half the volume of cylinder Q.
Recall that density is equal to mass per unit of volume. So R and ρ, the respective densities of cylinders P and Q, are
R = m / V = m / (v / 2) = 2 m / v
ρ = m / v
which means cylinder P has twice the density of cylinder Q (assuming both cylinders have the same mass m).