The diagram shows
A cylinder inside a cone on a horizontal base.
The cone and cylinder have the same vertical axis
The base of the cylinder lies on the base of the cone
The circumference of the top face of the cylinder touches the curved surface of the cone
The cylinder has radius $r$ cm and volume $V$ cm$^3$.
Show that $$V=12\pi r^2-3\pi r^3$$
This question is from the IGCSE Edexcel 2016 3HR exam. I have tried many times to solve it, then I looked up the answer and I couldn't understand it. I even searched for solutions online, but could not find any help.

You'll have to consider similar triangles. Let the height of the cylinder by $h$. Then $\frac{12}{h}=\frac{4}{4-r}$. This way you'll find $h$ in terms of $r$. You get that $h=12-3r$. Now you just have to simplify $V=\pi r^2 h$.