On this page
Optimisation word problems go wrong in two places. The first is turning the words into a function. The second is trusting the first critical point you find. An AI chatbot is useful for the first step and risky for the second. So split the work: let the AI set up the function, then run the endpoint and second-derivative checks yourself.
The same method is taught in the Class 12 NCERT chapter Application of Derivatives.
How do you ask AI to set up the function to optimise?
The free OpenStax textbook sets out a six-step strategy for optimisation problems: introduce the variables, decide what to maximise or minimise, write its formula, use the constraints to reduce it to one variable, find the domain from the physical problem, then look at critical points and endpoints. Ask the AI for steps one to five only. Something like this:
"Here is a word problem. Don't solve it yet."
"Name every variable, with units, and say what each one means in the picture."
"Write the quantity to be maximised as a function of one variable, and show how you used each constraint."
"State the domain, and say which sentence in the question gives each end of it."
That last line matters most, as the example below shows.
Why can't you trust the AI's maximum straight away?
Language models are uneven at multi-step word problems. In the GSM-Symbolic study by Mirzadeh and colleagues, adding a single clause that seemed relevant but played no part in the answer caused performance drops of up to 65% across the models tested. Those were grade-school problems, not calculus, but the lesson carries over: one sentence can throw a model off. In optimisation, that sentence is often a constraint like "the wall is 40 m long", which changes the answer.
Worked example: what if the wall is too short?
A farmer has 100 m of fencing for three sides of a rectangular plot. The fourth side is an existing wall that is 40 m long. What is the largest area?
A good AI setup looks like this. Let x be each side perpendicular to the wall and y the side along it. Then y = 100 − 2x, so the area is A(x) = x(100 − 2x) = 100x − 2x². Now the domain. Because y ≤ 40, x ≥ 30. Because y > 0, x < 50. So the domain is 30 ≤ x < 50.
Here is the trap. Setting A′(x) = 100 − 4x = 0 gives x = 25, and A″(x) = −4 is negative, so the second derivative test says local maximum. That would give an area of 1250 m². But x = 25 means y = 50 m, longer than the wall. The critical point is outside the domain.
On 30 ≤ x < 50, A′(x) is negative, so the area only falls as x grows. The maximum sits at the endpoint x = 30, where y = 40 m and A = 1200 m². The second derivative was correct and still pointed the wrong way, because it only describes the curve near x = 25.
How do you check endpoints and the second derivative?
The Extreme Value Theorem says a continuous function on a closed, bounded interval [a, b] has an absolute maximum and an absolute minimum somewhere in it. OpenStax's rule for finding them is short: evaluate the function at both endpoints and at every critical point inside the interval, then compare. Use this checklist on the AI's answer:
Is every critical point inside the domain? Throw out any that are not.
Is the domain closed? If yes, work out f at both ends. If an end is open, as with x < 50 above, check what f approaches there.
Compare all the values. The largest is the maximum, wherever it sits.
Use the second derivative only to classify a critical point. By the second derivative test, f″(c) < 0 means a local maximum, f″(c) > 0 a local minimum, and f″(c) = 0 tells you nothing.
Check it makes sense: right units, positive lengths.
For more practice, try minimising the surface area of a closed cylinder, or use the first derivative test for local maxima and minima when f″ gives zero.
What should you do when your check and the AI disagree?
Don't just ask it to try again. Tell it which constraint failed ("y = 50 is longer than the 40 m wall") and ask it to redo only the domain step. If it still argues, trust the check you can see on paper. The same habit works for other topics, such as checking an AI limit answer numerically.
If you keep setting up the function wrong, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. And Fermi's AI tutor works through a problem with you, notices where you are stuck, and decides whether to explain, ask or show.
Tonight, try one textbook problem this way: the AI does steps one to five, you do the endpoints.



