From Words to a Function You Can Optimize
In optimization, the hardest part is often not taking derivatives—it is building the objective function from a real description. The goal is to turn a plain-language situation into a single-variable function f(x) that represents what you want to maximize or minimize, together with a correct domain that reflects real constraints.
A repeatable workflow
- (1) Choose the decision variable and name the objective quantity. Decide what you control (a length, a time, a distance, a cut position). Write the objective in words first.
- (2) Translate constraints into equations/inequalities. Convert “fixed perimeter,” “volume is 32,” “must be nonnegative,” “must stay within the segment,” etc., into math.
- (3) Reduce to one variable using substitution. Use the constraint(s) to eliminate extra variables until the objective depends on one variable.
- (4) Determine the valid domain from real constraints. Include positivity, geometric feasibility, and any given bounds. The domain is part of the model.
- (5) Optimize using derivative tests and endpoints. Find critical points in the interior of the domain and compare with endpoint values when the domain is closed/bounded.
- (6) Interpret the result with units and meaning. Report the decision variable value(s) and the optimized quantity, with correct units and a sentence explaining what it means.
Writing templates you can reuse
Use these sentence starters to keep your setup organized and checkable.
- Let x represent… (decision variable, including units)
- Objective: (what to maximize/minimize)
f(x)=... - Constraint: (equation/inequality linking variables)
... - Domain: (all allowable values of
x)...
Example 1: Minimizing Material for an Open-Top Box (Square Base)
Scenario. You want an open-top box with a square base that holds a fixed volume V. You want to minimize material, meaning minimize the surface area of the base plus four sides (no lid).
(1) Decision variable and objective quantity
Let x represent… the side length of the square base (units: cm). Let h be the height (cm).
Objective: minimize surface area S (cm2).
- Listen to the audio with the screen off.
- Earn a certificate upon completion.
- Over 5000 courses for you to explore!
Download the app
For an open-top box with square base:
- Base area:
x^2 - Four sides: each has area
x·h, so total4xh
So S = x^2 + 4xh.
(2) Constraint
Constraint: fixed volume V (cm3):
V = x^2 h
(3) Reduce to one variable
Solve the constraint for h:
h = V / x^2
Substitute into S:
S(x) = x^2 + 4x(V/x^2) = x^2 + 4V/x
(4) Domain from real constraints
Domain: x > 0 (a length must be positive; also 4V/x requires x≠0).
(5) Optimize (derivative + checks)
Differentiate:
S'(x) = 2x - 4V/x^2
Critical points satisfy S'(x)=0:
2x = 4V/x^2 ⇒ 2x^3 = 4V ⇒ x^3 = 2V ⇒ x = (2V)^{1/3}
Because x>0, this critical point is valid. (On (0,∞), the surface area grows large as x→0^+ and as x→∞, so this interior critical point gives the minimum.)
(6) Interpret with units
The material-minimizing box has base side length
x = (2V)^{1/3} cm.
Its height is
h = V/x^2 = V/(2V)^{2/3} = V^{1/3}/2^{2/3} cm.
Notice the model’s meaning: the “best” proportions come from balancing base area (x^2) against side area (4V/x).
Example 2: Maximizing Area with Fixed Perimeter (Rectangle)
Scenario. You have a fixed amount of fencing P and want a rectangular enclosure with maximum area.
(1) Decision variable and objective quantity
Let x represent… the rectangle’s length (meters). Let y be the width (meters).
Objective: maximize area A = xy (m2).
(2) Constraint
Constraint: fixed perimeter P (m):
2x + 2y = P
(3) Reduce to one variable
Solve for y:
y = P/2 - x
Substitute into area:
A(x) = x(P/2 - x) = (P/2)x - x^2
(4) Domain from real constraints
Domain: lengths must be nonnegative:
x ≥ 0y = P/2 - x ≥ 0 ⇒ x ≤ P/2
So 0 ≤ x ≤ P/2.
(5) Optimize (derivative + endpoints)
Differentiate:
A'(x) = P/2 - 2x
Set to zero:
P/2 - 2x = 0 ⇒ x = P/4
Check endpoints as well:
A(0)=0A(P/2)=0A(P/4) = (P/4)(P/4) = P^2/16
The maximum occurs at x=P/4.
(6) Interpret with units
The rectangle of maximum area is a square: x=y=P/4 meters, and the maximum area is P^2/16 m2.
Example 3: Minimizing Travel Time by Choosing a “Landing Point”
Scenario. A person starts at point A on land, must reach point B in the water. They can travel on land faster than in water. They will run along the shore to some point P (on the shoreline) and then swim straight to B. Where should they enter the water to minimize total travel time?
This is a classic “choose the point” optimization: the decision variable is a location, and the objective is time.
Geometry setup
Assume the shoreline is a straight line. Place coordinates so the shore is the x-axis.
- Let
A=(0,0)be the starting point on the shore. - Let
B=(d,w)whered>0is the horizontal distance along the shore andw>0is the perpendicular distance offshore. - Let
P=(x,0)be the entry point, withxmeasured along the shore fromA.
Let land speed be v_L and swim speed be v_W, with v_L > v_W > 0.
(1) Decision variable and objective quantity
Let x represent… the distance (m) from A to the entry point P along the shore.
Objective: minimize total time T(x) (seconds).
(2) Constraints
Here the “constraints” are geometric relationships (distances) and physical restrictions (you must enter somewhere on the shore segment you are willing/able to run along).
- Run distance:
AP = x - Swim distance:
PB = √((d-x)^2 + w^2)
(3) Reduce to one variable
Time = distance/speed, so
T(x) = x/v_L + √((d-x)^2 + w^2)/v_W
This is already a single-variable objective function.
(4) Domain from real constraints
Domain: if you restrict to entering between A and the point on shore closest horizontally to B, then 0 ≤ x ≤ d. (This is a modeling choice that matches “run toward the destination, then swim.” In some situations you might allow x<0 or x>d, but you must state it.)
(5) Optimize (derivative + endpoint checks)
Differentiate:
T'(x) = 1/v_L + (1/v_W)·d/dx[ √((d-x)^2 + w^2) ]
Compute the derivative of the square root:
d/dx[ √((d-x)^2 + w^2) ] = (1/(2√((d-x)^2+w^2)))·2(d-x)·(-1) = -(d-x)/√((d-x)^2+w^2)
So
T'(x) = 1/v_L - (d-x)/(v_W·√((d-x)^2+w^2))
Set T'(x)=0 to find critical points:
1/v_L = (d-x)/(v_W·√((d-x)^2+w^2))
Rearrange into a more interpretable form:
(d-x)/√((d-x)^2+w^2) = v_W/v_L
The left side is the cosine of the swim angle measured from the shoreline direction (adjacent over hypotenuse). This equation says the optimal entry point balances the geometry with the speed ratio. After solving for x (often numerically, depending on values), compare the resulting T(x) with endpoint times T(0) and T(d) to ensure the minimum occurs inside the chosen domain.
(6) Interpret with units
The minimizing value x (meters) tells you how far to run before entering the water. The minimized value T(x) is the least travel time (seconds). Always report both: the decision (x) and the outcome (time), and confirm the choice is feasible within 0 ≤ x ≤ d.
Common Modeling Moves (and Common Mistakes)
How to spot the decision variable
- If the problem says “choose,” “where,” “how far,” “what dimensions,” that choice is your variable.
- Pick a variable that naturally has a simple domain (often a length along a segment or a radius/side length).
Constraints are not optional
- “Fixed perimeter,” “fixed volume,” “must fit,” “must be nonnegative,” “must be within the interval” all become equations/inequalities.
- Write the constraint before substituting; it is your justification for eliminating variables.
Domain is part of the answer
- Geometric quantities usually require
>0(or≥0if a degenerate case is allowed). - Substitution can introduce restrictions (e.g., dividing by
xforcesx≠0). - If the domain is closed (like
[0,d]), you must check endpoints in addition to interior critical points.
Units keep the model honest
- Objective function units should match the quantity: area (m2), surface area (cm2), time (s).
- When you substitute, units should still be consistent (e.g.,
V/xhas units of area ifVis volume andxis length).
Fill-in Templates (Copy and Adapt)
Template A: Geometry/material optimization
- Let x represent… __________________ (include units).
- Other variables: __________________.
- Objective: minimize/maximize __________________. Define
f:f(x, y, ...)=... - Constraint(s): __________________. Write as equations/inequalities:
... - Substitute: solve constraint for __________________ and substitute into
fto getF(x)=... - Domain: __________________ (positivity, bounds, feasibility):
... - Optimize: find critical points of
Fon the domain; check endpoints if applicable. - Interpret: state optimal
x(units) and optimal objective value (units) in context.
Template B: Time minimization with piecewise travel
- Let x represent… the location/entry point/distance along a line (units).
- Objective:
T(x) =(time on segment 1)+(time on segment 2). - Constraint: distances from geometry (often Pythagorean distance).
- Domain:
xmust lie on the allowed segment:a ≤ x ≤ b. - Optimize: compute
T'(x), solveT'(x)=0in[a,b], compare withT(a)andT(b). - Interpret: “Enter at
x=...” and “minimum time isT=....”