In a right triangle the product of the two hypotenuse segments equals the square of the height. Euclid's theorem (That's the name how this theorem is called in Germany - maybe you know this theorem under a different name)

In comparison with the two sketches you see:

q = h ..... of the cone

p = 2a - h ..... of the cone

The volume of a cone is:

Therefore you get:

To find the maximum volume calculate