I was deriving the formula of cone volume yesterday but I was stuck at a place.My reason for asking help in Math SE is because I was not doing it by looking at any book or the internet.So,I want your help to know where my thinking went wrong.
My attempt:
In a right circular cone with base radius $r$ and height $h$,both keep changing as we move upward.So,my integral must take into account the change of height (from $0$ to complete length $h$) and change of radius (from base radius $r$ to $0$ at the apex.)
So $$\begin{align} V_{cone} & =\int_r^0\int_0^h\pi r^2 dr \space dh \\ & =\int_r^0\pi r^2 dr \cdot \int_0^h\pi r^2 dh \end{align}$$
In the first integral I'm treating $r$ as a variable but in the second integral I'm treating it as a constant.
Solving this does not yield the formula $V_{cone}=\frac13\pi r^2h$.
Where I made a mistake?
What you're calculating has unit of $\text{length}^4$ so it can't be volume. Where you went wrong is : $h$ and $r$ are related via $r=h\tan\alpha$ where $\alpha=$ half the angle at vertex. If the base radius is $R$ and height of the base from vertex is $H,$
the volume is
$$ \int_0^H\pi r^2dh=\int_{0}^H\pi\tan^2\alpha \,h^2dh={1\over3}\pi\tan^2\alpha H^3=\frac13\pi {R^2\over H^2}H^3={1\over3}\pi R^2H $$ as $R=H\tan\alpha$.
If you want direct integration use triple integral $$ \int_0^{2\pi}\int_0^R\int_{r\cot\alpha}^H rdh\,dr\,d\theta={\pi\over3}R^2H $$