# Find ratio between dimensions of can w/ largest capacity

Tags:
1. Oct 27, 2016

### toforfiltum

1. The problem statement, all variables and given/known data
A cylindrical metal can is to be manufactured from a fixed amount of sheet metal. Use the method of Lagrange multipliers to determine the ratio between the dimensions of the can with the largest capacity.

2. Relevant equations

3. The attempt at a solution
$$V(r,h)=\pi r^2h$$
$$2 \pi rh=k$$
Let $$g(r,h)=2 \pi rh$$
$$\nabla V(r,h)=[2 \pi rh, \pi r^2]$$
$$\nabla g(r,h)=[2 \pi h, 2 \pi r]$$
$$2 \pi rh = c(2 \pi h)$$
$$\pi r^2=c(2 \pi r)$$
$$2 \pi rh=k$$

Now, here I'm stuck. If I eliminate $c$, I get a nonsensical equation such as $r= \frac{1}{2}r$.

So, I tried another way. Since $2 \pi rh=k$, I let $k- 2 \pi ch$, which after some algebraic manipulation gives me the answer $h=\frac{k}{\pi r}$

But my answer is wrong. The answer is that the height of cylinder equals its diameter. I don't know how to come to that conclusion.

Is my method wrong?

Thanks.

2. Oct 27, 2016

### Let'sthink

You need to maximize V(r,h)=π*(r^2)*h, with constant A = 2πrh + πr^2, which is fixed amount of metal sheet. I do not remember the exact steps of Lagrange's method. I will myself solve and then post here. But you can also use those two equations to eliminate one variable say h, which would be simpler to get an expression for V in terms of r and constant A. maximize it to get the value of r and then use equation A to get h and the required ratio [h/(2r)].

3. Oct 27, 2016

### Staff: Mentor

What would you get, if you gave your can a bottom?

4. Oct 28, 2016

### toforfiltum

@fresh_42 @Let'sthink Ah, I see now. I didn't think that the can would have a bottom since there is a fixed sheet of metal. I figured that wrapping the sheet around to form a cylinder would leave the bases empty. Thanks so much!

5. Oct 28, 2016

### Staff: Mentor

@tofortiltum, since A is a constant, you can solve the second equation above for h in terms of r. From that you can write V(r, h) as a function of r alone, and then find the maximum volume by using the ordinary derivative.

This is almost the same thing I said in this post: https://www.physicsforums.com/threads/determine-the-highest-and-lowest-elevation-on-a-path.891018/

6. Oct 28, 2016

### Ray Vickson

I agree: he can do that. But, if his question tells him to use Lagrange multipliers, then that is what he must do.

Besides, Lagrange multipliers play a fundamental role in theory and practice in optimization; for example, many effective numerical optimization methods depend crucially on the ability to compute and update Lagrange multiplier estimates along with solution estimates; this speeds up convergence, and leads to much faster and much more robust algorithms.

7. Oct 28, 2016

### Staff: Mentor

You're right -- it says to use this method in the problem description. I missed that.

8. Oct 28, 2016

### toforfiltum

9. Oct 28, 2016

### toforfiltum

Now I have another problem. How do I show that the dimensions I get are those that are of largest capacity? So let me write out my steps again.
$$V(r,h)= \pi r^2h$$
$$A(r,h)= 2 \pi r^2 +2 \pi rh$$
$$\nabla V(r,h)=[2 \pi rh, \pi r^2]$$
$$\nabla A(r,h)=[4 \pi r + 2 \pi h, 2 \pi r]$$
$$2 \pi rh=c(4 \pi r+2 \pi h)$$
$$\pi r^2= c(2 \pi r)$$
$$2 \pi r^2+2 \pi rh=k$$

After doing some algebraic manipulation, I did get $$h=2r$$

But when I formed the Hessian matrix for $$H V(r,h)=\begin{bmatrix} 2 \pi h & 2 \pi r \\ 2 \pi r & 0 \end{bmatrix}$$, it showed that the point is the saddle point. Am I doing things wrong here?

10. Oct 28, 2016

### Ray Vickson

The second-order optimality tests are more complicated when you have constraints. Basically, the tests are that the Hessian matrix of the Lagrangian (NOT the objective function $V$), projected onto the subspace of the constraint's tangent plane, should be (i) negative semidefinite---necessary condition for a local maximum; or (ii) negative definite---sufficient condition for a strict local max. Never mind if that sounds like mumbo-jumbo to you; the point is that the test is not what you think it should be.

Even if you use the Lagrange multiplier method to solve the problem, you can look at what the objective $V$ would have become if you had used Mark44's suggestion to solve for h in terms of r from the constraint and so convert the problem to an unconstrained univariate maximization. Standard one-dimensional second-derivative tests apply to that problem. (Perhaps surprisingly, these are equivalent to testing the Hessian of the Lagrangian in the tangent plane of the constraint.)

11. Oct 29, 2016

### toforfiltum

Haha, what you said above was definitely mumbo-jumbo to me. But what do you mean by the tangent plane of the constraint? Is it taking the Hessian of the gradient of the equation of constraint?

So, in the case of this question, I do not need to show that the value I get is indeed largest, is it? I can just assume from instructions of the question?

12. Oct 29, 2016

### Ray Vickson

Somehow you need to convince yourself that the value you get is, indeed, the largest possible constrained value. One way would be to show that when you use the constraint to eliminate a variable, the solution you get is the maximum of the resulting one-variable unconstrained problem. Another way is to use the procedure I outlined.

Probably the best way to illustrate the second approach is to go through it in detail from start to finish. Eliminate the factors of $\pi$ (by changing volume and area measurement units) and take Area = 24 to make later writing easier. The problem is to maximize $V = r^2 h$ subject to $A = 24$, where $A = 2 r^2 + 2rh$. The Lagrangian is $L = V - u A$ (writing $u$ instead of $\lambda$), and solving by the usual method gives the solution $(r,h,u) = (2,4,1)$. The $(r,h)$-Hessian of the Lagrangian $L$ at the solution is
$$H = \left. \pmatrix{2h - 4u & 2r - 2u\\2r - 2u & 0} \right|_{(r,h,u) = (2,4,1)} = \pmatrix{4 & 2 \\2 & 0 }.$$
The associated quadratic form for $H$ is
$$Q = \langle \Delta r, \Delta h \rangle H \pmatrix{\Delta r\\\Delta h} = 4 \Delta r^2 + 4 \Delta r \Delta h$$.
The tangent line to the constraint at the point $(r,h) = (2,4)$ is $16 \Delta r + 4 \Delta h = 0$; that is the line $(r,h) = (2+\Delta r, 4 + \Delta h)$ that is tangent to the constraint curve at the solution.

On the tangent line we have $\Delta h = - 4 \Delta r$, so on the tangent line we have $Q = 4 \Delta r^2 + 4 \Delta r (- 4\Delta r) =-12 \Delta r^2$, and that means that the Hessian of $L$ projected onto the tangent line is $\partial^2 Q/ \partial \Delta r^2 = -24$. Considered as a $1 \times 1$ matrix, this is negative definite, so the point $(r,h) = (2,4)$ is a strict local maximum.

Basically, this calculation means that along the constraint curve we have
$$V(2+\Delta r, 4 + \Delta h) \approx V(2,4) + \frac{1}{2} (-12 \Delta r ^2) = 16 - 6 \Delta r^2,$$
which has a strict local maximum at $\Delta r = 0$.

Note: what I wrote was not a typo: the constrained value of $V$ is related to the Hessian of the Lagrangian $L$, not just to the Hessian of $V$ alone.

Note that if we use the area constraint to express $h$ in terms of $r$ we would have $V = V(r) = 12 r - r^3$, so $V(2 + \Delta r) \approx 16 - 6 \Delta r^2$. This is exactly what we got by looking at the projected Hessian of the Lagrangian!

Last edited: Oct 29, 2016
13. Oct 31, 2016

### toforfiltum

Whew! I can't follow what you wrote, but thanks anyway. I don't even understand why the Lagrangian is $L=V-uA$

14. Nov 1, 2016

### Ray Vickson

When you wrote $2 \pi rh = c(2 \pi h)$ and $\pi r^2=c(2 \pi r)$ in your post #1 you were essentially setting $\nabla(V - cA) = 0$ (so you called your Lagrange multiplier $c$ instead of my $u$). The only problem was that you had an incorrect formula for $A$. Setting $\nabla(V - cA) = 0$ is the same as setting $\nabla V = c \nabla A$.