Let $R$ be the radius and $h$ be the height of cone.
$\therefore O A=h-r$
In $\Delta O A B$
$r^{2} =R^{2}+(h-r)^{2}$
$\Rightarrow r^{2} =R^{2}+h^{2}+r^{2}-2 r h$
$\Rightarrow R^{2}=2 r h-h^{2}$
The volume $V$ of the cone is given by
$V =\frac{1}{3} \pi R^{2} h$
$=\frac{1}{3} \pi h\left(2 r h-h^{2}\right) =\frac{1}{3} \pi\left(2 r h^{2}-h^{3}\right)$
On differentiating w.r.t. $h$, we get
$\frac{d V}{d h}=\frac{1}{3} \pi\left(4 r h-3 h^{2}\right)$
For maximum and minimum, put $\frac{d V}{d h}=0$
$\Rightarrow 4 r h=3 h^{2}$
$\Rightarrow 4 r=3 h$
$\Rightarrow h=\frac{4 r}{3}$
Now, $\frac{d^{2} V}{d h^{2}}=\frac{1}{3} \pi(4 r-6 h)$
At $h=\frac{4 r}{3},$
$\left(\frac{d^{2} V}{d h^{2}}\right)_{h=\frac{4 r}{3}} =\frac{1}{3} \pi\left(4 r-6 \times \frac{4 r}{3}\right)$
$=\frac{\pi}{3}(4 r-8 r)$
$=\frac{-4 r \pi}{3}<0$
$\Rightarrow V$ is maximum when $h=\frac{4 r}{3}.$
Hence, volume of the cone is maximum when $h=\frac{4 r}{2}$, which is the altitude of cone.