# Calculus Optimization: Maximum Volume of a Cylinder Inside a Sphere

A classic calculus optimization problem is to find the maximal volume or area of one type of object inscribed within a fixed space. When something is inscribed, it means its corners lie on the boundary of the enclosing space. Inscribing a cylinder of unknown dimensions within a unit sphere (radius = 1) is an example of a volume maximization problem. Only one set of cylindrical dimensions will produce a cylinder with the largest possible volume. Here we show how to solve this problem using single-variable differential calculus. It can also be solved with the multi-variable technique of Lagrange multipliers.

## Setting up the Equations

The volume of a cylinder is a function of its height h and radius r. The formula is

V(h, r) = πhr^2

Because this is a function in two variables, we need more information to find the values of r and h that produce a cylinder of maximal volume. Since the cylinder is inscribed within a sphere of radius = 1, our values of r and h are restricted. In fact, the value of one dimension dictates the value of the other because they are bound in a geometric relation. The equation of that relation is

r^2 + (h/2)^2 = 1

This expression comes from applying the Pythagorean Theorem to the diameter of the cylinder (2r), the height of the cylinder (h), and the diameter of the sphere (2). Because the diameter and height of the cylinder are at right angles to each other, and because the diagonal length of the cylinder is equal to the diameter of the sphere the Pythagorean Theorem gives us

(2r)^2 + h^2 = 2^2

4r^2 + h^2 = 4

r^2 + (h/2)^2 = 1

## Finding the Equation to Optimize

Since we have V(h, r) = πhr^2 and r^2 + (h/2)^2 = 1, we can use the second equation to turn V(h, r) into a function of h only. With this single variable equation we can then take the derivative to find the optimal dimensions.

The equation r^2 + (h/2)^2 + 1 can be rewritten as r^2 = 1 - (h/2)^2. Now we can use this to replace r^2 in the volume function, giving us

V(h) = πh[1 - (h/2)^2]

V(h) = π(h - 0.25h^3)

## More Calculus Help

**Cone of Maximal Volume Inscribed in a Sphere**- How to Maximize the Area of an Enclosure Against One Wall
- How to Maximize the Volume (Capacity) of a Rectangular Box Cut From a Rectangle
- How to Maximize the Area of an Enclosure Against Two Perpendicular Walls
- Volume of a Barrel: Formula and Examples
- Implicit Differentiation for Second Derivatives

## Taking the Derivative

The volume function is V(h) = π(h - 0.25h^3) and its derivative with respect to h is

V* '*(h) = π(1 - 0.75h^2)

Setting this equation equal to 0 and solving for h gives us

0 = π(1 - 0.75h^2)

0 = 1 - 0.75h^2

0.75h^2 = 1

h^2 = 4/3

h = 2/sqrt(3), h = -2/sqrt(3)

we can discard the negative solution since it doesn't make physical sense in the context of the problem. The bounds of h are from 0 to 2.

Just because the derivative at h = 2/sqrt(3) is zero doesn't necessarily mean it is a maximum. Local minimums an inflection points may also have a derivative of zero. The confirm that h = 2/sqrt(3) is indeed the local max on the interval [0, 2] we can look at the graph of V(h).

As you can see from the graph, there is only one local maximum on the domain [0, 2], so the solution h = 2/sqrt(3) is the height that yields the maximal volume.

## Finding the Optimal Radius

Since we know that the height of the cylinder of maximal volume is h = 2/sqrt(3), we can plug this value into the equation

r^2 + (h/2)^2 = 1

to find the corresponding cylindrical radius. This gives us

r^2 + 1/3 = 1

r^2 = 2/3

r = sqrt(2/3)

So the dimensions of the cylinder with maximal volume inscribed within a unit sphere are

**h = 2/sqrt(3) = 1.1547**

**r = sqrt(2/3) = 0.8165**

## Comments

Great explanation, thanks for showing the steps of how to solve this. I was wondering how to solve a similar problem of maximizing the volume of a cone inscribed in a sphere. Is the technique similar (replacing r as a function of h or vice versa and taking derivative) or is there some extra aspect to consider?