Build the objective and its domain
Fence a pen against a river
A farmer has 180 m of fence for a pen against a river, with no fence on the river side and one fence across the middle.
Drag the depth \(x\), the length of the three orange pieces. The bar under the pen lays the fence end to end as three pieces of length \(x\) and one of width \(w\).
The pieces fill the 180 m bar, so the width is \(w = 180 - 3x\), and one number fixes the pen.
The graph shows the area for each depth. It is 0 at \(x = 0\), where the pen has no depth, and at \(x = 60\), where it has no width.
Objective, constraint and domain
Without numbers, the pen has depth \(x\) and width \(w\), and the bar holds all of the fence.
As you drag, the pieces still add up to all the fence. This equation is the constraint, and it links \(w\) to \(x\).
The objective is the quantity to make largest or smallest, here the area. The constraint lets you write it with \(x\) alone.
The domain is the set of values of \(x\) for which a pen exists, the thick part of the x-axis on the graph.
Notation
Name the objective, here the area, the depth times the width.
\[\cb{A} = \cy{x}\,w\]Write the constraint: the pieces add up to all the fence.
\[3\cy{x} + w = 180\]Solve the constraint for \(w\). Then replace \(w\) in the objective, so the area depends on \(\cy{x}\) alone.
\[\begin{aligned} w &= 180 - 3x \\ \cb{A}(x) &= x(180 - 3x) \end{aligned}\]State the domain: each piece of fence needs a length that is not negative.
\[\begin{aligned} x \ge 0, \quad 180 - 3x &\ge 0 \\ \Longrightarrow \quad 0 \le x &\le 60 \end{aligned}\]At each end one side has length 0, which is not negative, so the pen exists with area 0. The domain is a closed interval that includes both ends.
When it fails
The formula has a value for every \(x\). At \(x = 70\) it gives \(-2100\), but no pen has a negative area.
Without the domain, you can report a depth that no pen can have.
Example 1: An open box with a square base
A box has a square base of side \(x\) m, no lid, and a volume of 32 m³. Write the area of material as a function of \(x\), and give the domain.
The objective is the area of material, one square base plus four sides that are \(x\) wide and \(h\) tall, where \(h\) is the height.
\[S = \cy{x}^2 + 4\cy{x}h\]The constraint is the volume, base area times height.
\[\cy{x}^2 h = 32\]Solve the constraint for \(h\). Then replace \(h\) in the objective.
\[\begin{aligned} h &= \frac{32}{x^2} \\ S(x) &= x^2 + 4x \cdot \frac{32}{x^2} = x^2 + \frac{128}{x} \end{aligned}\]A base of side 0 gives no box, so \(x > 0\). Each positive \(x\) gives a positive height, so the domain has no upper limit.
\[x > 0\]
Example 2: A cable across a river
A cable joins a plant to a factory across a river 3 km wide. It runs under water to a point \(x\) km along the far bank from the point straight across, then along the bank to the factory, 8 km from that point. The cable costs 5000 dollars per km under water and 3000 per km on land. Write the cost in thousands of dollars as a function of \(x\), and give the domain.
Under water, the cable is the longest side of a right triangle with legs 3 km and \(x\), so the Pythagorean theorem gives its length.
\[\sqrt{3^2 + x^2} = \sqrt{9 + x^2}\]A tempting wrong move: The land piece also has length \(x\).
\[C(x) = 5\sqrt{9 + x^2} + 3x\]The land piece runs from the landing point to the factory, so at \(x = 8\) it has length 0. This formula still adds 24, the red gap on the graph.
The land piece is the rest of the 8 km, so its length is \(8 - x\). In thousands of dollars, the cost per km is 5 under water and 3 on land.
\[C(x) = 5\sqrt{9 + x^2} + 3(8 - x)\]The cable can land anywhere from the point straight across to the factory, including both ends.
\[0 \le x \le 8\]
Practice
A 48 cm wire is cut into two pieces. The first piece, of length \(x\), is bent into a square. The second is bent into another square. Write the total area as a function of \(x\), and give the domain.
Each piece is the perimeter of its square. Find the length of the second piece first.
Solution
The two pieces add up to 48 cm, so the second piece has length \(48 - x\).
\[x + (48 - x) = 48\]Each piece is the perimeter of its square, and a side is one fourth of that, so the sides are \(\frac{x}{4}\) and \(\frac{48 - x}{4}\).
\[A(x) = \left(\frac{x}{4}\right)^2 + \left(\frac{48 - x}{4}\right)^2\]A piece may have length 0, when one square uses the whole wire, so the domain includes both ends.
\[0 \le x \le 48\]
Questions
Questions 1 and 2 use the point \(P = (x, x^2)\) on the parabola and the fixed point \((0, 2)\).
The figure shows \(P\) at \(x = -1.5\). The squared length of the orange segment is a function \(D^2(x)\). What is its domain?
- All real numbers
- \(x > 0\)
- \(0 \le x \le 2\)
Answer
All real numbers
At \(x = 0.5\) the horizontal leg of the right triangle is 0.5 and the vertical leg is 1.75. Which formula gives \(D^2(x)\)?
- \(x^2 + (2 - x^2)^2\)
- \(x + (2 - x^2)\)
- \(x^2 + (2 - x)^2\)
- \(x^2 + x^4\)
Answer
\(x^2 + (2 - x^2)^2\)
Two positive numbers have product 48. The first number is \(x\). Which function gives their sum, and what is its domain?
- \(S(x) = x + \dfrac{48}{x}\), with \(x > 0\)
- \(S(x) = x + \dfrac{48}{x}\), with \(0 \le x \le 48\)
- \(S(x) = x + 48x\), with \(x > 0\)
- \(S(x) = 48\), with \(x > 0\)
Answer
\(S(x) = x + \dfrac{48}{x}\), with \(x > 0\)
Summary
You name the objective, use the constraint to write it in one variable, and state the domain where a shape exists.
This works because the constraint ties the dimensions together, so one number fixes the shape.
Use it first in every optimization problem, before you differentiate.
This is one of four skills in topic 5.11 of Which & Why: AP Calculus.