ChatGPT vs DeepSeek: Solve a Multi-Step Calculus Optimization Problem
The Prompt
A manufacturer needs to design a cylindrical can that holds exactly 500 mL of liquid. The material for the top and bottom costs $0.06 per cm², and the material for the side costs $0.03 per cm². Find the dimensions (radius and height) that minimize the total cost of materials. Show all work, verify your answer, and explain why this is a minimum (not a maximum).
GPT-4oGPT-4o — correct but less insightful
## Solution
**Setting up the problem:**
Volume constraint: V = πr²h = 500 cm³, so h = 500/(πr²)
**Cost function:**
- Top + bottom area = 2πr² → cost = 0.06 × 2πr² = 0.12πr²
- Side area = 2πrh → cost = 0.03 × 2πrh = 0.06πrh
Total cost: C(r) = 0.12πr² + 0.06πrh
Substituting h = 500/(πr²):
C(r) = 0.12πr² + 0.06πr × 500/(πr²)
C(r) = 0.12πr² + 30/r
**Finding the minimum:**
C'(r) = 0.24πr − 30/r²
Setting C'(r) = 0:
0.24πr = 30/r²
0.24πr³ = 30
r³ = 30/(0.24π) = 125/π
r = (125/π)^(1/3) ≈ 3.414 cm
**Height:**
h = 500/(π × 3.414²) = 500/(π × 11.655) = 500/36.617 ≈ 13.655 cm
**Second derivative test:**
C''(r) = 0.24π + 60/r³
Since both terms are positive for r > 0, C''(r) > 0, confirming this is a minimum.
**Verification:**
- Volume: π(3.414)²(13.655) = π(11.655)(13.655) = 500.0 ✓
- Cost: 0.12π(11.655) + 30/3.414 = 4.393 + 8.787 = $13.18
- h/r ratio = 13.655/3.414 = 4.0, which makes sense since the side material is cheaper (ratio deviates from h = 2r for equal costs)
**Answer:** r ≈ 3.414 cm, h ≈ 13.655 cm, minimum cost ≈ $13.18
DeepSeek V4GPT-4o — correct but less insightful
## Solution
**Step 1: Define variables and constraints**
Let r = radius of the can (cm), h = height of the can (cm).
Volume: πr²h = 500 → h = 500/(πr²)
**Step 2: Build the cost function**
The can has two circular ends and a rectangular side when unrolled:
- Cost of top + bottom: 2 × πr² × $0.06 = 0.12πr²
- Cost of side: 2πrh × $0.03 = 0.06πrh
Total cost as a function of r:
C(r) = 0.12πr² + 0.06πr · [500/(πr²)]
= 0.12πr² + 30r⁻¹
**Step 3: Differentiate and solve**
dC/dr = 0.24πr − 30r⁻²
Set dC/dr = 0:
0.24πr = 30/r²
r³ = 30/(0.24π) = 125/π
∴ r = ∛(125/π) = 5/∛π ≈ 5/1.4646 ≈ 3.4139 cm
h = 500/(πr²) = 500/(π · 125²/³/π²/³) = 500π²/³/(π · 125²/³)
Simplifying: h = 500/(π · (125/π)²/³) = 4 · 5/∛π = 20/∛π ≈ 13.656 cm
Notice: h = 4r. This is expected! When end-cap material costs 2× the side material, the optimal ratio shifts from h = 2r (equal costs) to h = 4r.
**Step 4: Confirm minimum via second derivative**
d²C/dr² = 0.24π + 60r⁻³
For any r > 0, both terms are strictly positive, so d²C/dr² > 0. ✓
The critical point is indeed a global minimum on (0, ∞).
**Step 5: Compute minimum cost**
C_min = 0.12π(3.4139)² + 30/(3.4139)
= 0.12π(11.655) + 8.787
= 4.393 + 8.787
= **$13.18**
**Step 6: Physical sanity check**
- Volume: π(3.414)²(13.656) ≈ 500.0 cm³ ✓
- The can is tall and narrow (h ≈ 4r) because end-cap material costs twice as much — so the optimizer shrinks the circles and stretches the side.
- If costs were equal, we'd get the classic h = 2r; our 2:1 cost ratio doubles that aspect ratio to 4:1. ✓
**Answer:** r ≈ 3.414 cm, h ≈ 13.656 cm, minimum material cost ≈ $13.18.
🔍 Analysis
Both models nail the calculus — correct setup, clean differentiation, accurate numerical answer ($13.18). The math is identical. Where DeepSeek V4 pulls ahead is in mathematical insight: it recognizes and explains the h = 4r relationship, connects it to the 2:1 cost ratio, and contrasts it with the classic equal-cost case (h = 2r). This kind of conceptual explanation is exactly what a student or engineer needs to actually *understand* the result, not just compute it. GPT-4o's solution is competent and well-organized, but it treats the h/r = 4 ratio as an observation rather than deriving *why* it must be 4. DeepSeek also shows the symbolic simplification (r = 5/∛π) rather than jumping straight to decimals, which is better mathematical practice. For pure computation, it's a tie. For mathematical understanding and pedagogy, DeepSeek V4 wins.
"We gave GPT-4o and DeepSeek V4 the same calculus optimization problem. Both got the right answer — but only one explained WHY the answer makes sense. See the full battle →"