Tutorials › Calculus I › Fencing A Region Against A Wall

Optimization and Newton's Method · Tutorial 869 of 1495

Fencing A Region Against A Wall

Learn to turn the wall-and-fence constraint into a one-variable area function, then identify and verify its global maximum.

Advanced 10 min read

What You'll Learn

  • Assign variables to the enclosure’s depth and wall-parallel side.
  • Express the fencing constraint and feasible domain using one variable.
  • Build the area function and locate its interior critical point.
  • Check boundary cases, including degenerate enclosures.
  • Prove that the resulting dimensions give the global maximum.
  • Recognize why counting a side along the wall as fenced gives the wrong model.

Introduction

A wall can serve as one side of a rectangular enclosure, so fencing is needed along only the other three sides. This changes the constraint from the fixed-perimeter rectangle problem: two fenced sides have the same length, while the third runs parallel to the wall. The key is to model those lengths carefully before maximizing the area.

We will use one variable for the distance from the wall and use the fencing constraint to express the remaining side. Then we can find the largest area and check every feasible boundary case.

Set Up the Model

Suppose the available length of fencing is \(F\), where \(F>0\). Let \(x\) be the distance perpendicular to the wall, and let \(y\) be the side parallel to the wall, opposite it. The two perpendicular sides both require fencing, as does the side of length \(y\). The wall itself supplies the fourth side, so it uses no fencing.

Model: The fencing constraint is \(2x+y=F\), and the enclosure’s area is \(A=xy\). For a nonnegative, possibly degenerate enclosure, the feasible lengths satisfy \(x\ge 0\), \(y\ge 0\), and \(2x+y=F\).

Solving the constraint for \(y\) gives \(y=F-2x\). Since both dimensions must be nonnegative, \(x\ge 0\) and \(F-2x\ge 0\). Therefore the feasible interval is \(0\le x\le F/2\). Substituting into the area formula gives the one-variable objective

$$ A(x)=x(F-2x)=Fx-2x^2,\qquad 0\le x\le \frac{F}{2}. $$

The endpoints have a direct geometric meaning. If \(x=0\), the perpendicular sides have zero length and the area is zero. If \(x=F/2\), then \(y=0\), so the side parallel to the wall has zero length and the area is again zero. These are degenerate limiting cases rather than usable enclosures, but including them makes the feasible interval closed and lets us compare them directly with the interior candidate.

Find and Check the Maximum

On the interior of its feasible interval, the area function is differentiable. Its derivative is \(A'(x)=F-4x\). A critical point occurs when \(A'(x)=0\), so \(F-4x=0\) and \(x=F/4\). This is feasible because \(0<F/4<F/2\) when \(F>0\). The corresponding side parallel to the wall is \(y=F-2(F/4)=F/2\).

A critical point alone does not settle a constrained optimization problem: feasible boundary cases must also be checked. Here, \(A(0)=0\) and \(A(F/2)=0\), whereas the area at the interior point is positive. The result can be established even more directly by rewriting the entire objective.

Theorem: For \(F>0\), among nonnegative lengths satisfying \(2x+y=F\), the greatest area is \(F^2/8\). It occurs at \(x=F/4\) and \(y=F/2\).

Why These Dimensions Give the Global Maximum

The derivative identifies the only interior critical point, but completing the square proves that no other feasible choice can have a greater area. Starting from \(A(x)=Fx-2x^2\), factor out \(-2\) from the quadratic terms and complete the square:

$$ \begin{aligned} A(x) &= -2\left(x^2-\frac{F}{2}x\right)\\ &= -2\left[\left(x-\frac{F}{4}\right)^2-\frac{F^2}{16}\right]\\ &= \frac{F^2}{8}-2\left(x-\frac{F}{4}\right)^2. \end{aligned} $$

For every feasible \(x\), the square \(\left(x-\frac{F}{4}\right)^2\) is nonnegative. Therefore \(A(x)\le F^2/8\). Equality holds exactly when the square is zero, which requires \(x=F/4\). The constraint then gives \(y=F/2\). Since this \(x\) is feasible, the bound is attained, proving that it is the global maximum, not merely a local candidate. At either endpoint, the area is zero, strictly less than \(F^2/8\) because \(F>0\).

This proof also explains the shape of the objective: moving away from \(x=F/4\) makes the subtracted square larger and the area smaller. The dimensions at the maximum are not equal. The side along the wall is twice the depth, since \(y=F/2=2(F/4)=2x\).

Worked Examples

Worked Example: 120 Metres of Fencing

A rectangular enclosure uses a straight wall for one side and has \(120\) metres of fencing for the other three. Find the dimensions that give the greatest area, and check the boundary cases.

Let \(x\) be the depth in metres and \(y\) the fenced side parallel to the wall, also in metres. The fencing constraint is \(2x+y=120\), so \(y=120-2x\). Nonnegative dimensions require \(0\le x\le 60\). The area is \(A(x)=x(120-2x)=120x-2x^2\), measured in square metres.

Differentiate: \(A'(x)=120-4x\). Set \(A'(x)=0\): \(120-4x=0\), so \(4x=120\) and \(x=30\) metres. The remaining side is \(y=120-2(30)=120-60=60\) metres. The area is \(A=30\cdot60=1800\) square metres.

Check the constraint: \(2(30)+60=60+60=120\) metres, so all the fencing is accounted for. Check the endpoints: \(A(0)=0\cdot120=0\) square metres and \(A(60)=60\cdot(120-120)=0\) square metres. The candidate’s area, \(1800\) square metres, exceeds both boundary values. The completed-square result also gives \(120^2/8=14400/8=1800\) square metres, confirming the maximum.

Worked Example: 84 Feet of Fencing

Find the dimensions of greatest area when \(84\) feet of fencing are available, with a wall forming one side.

Let \(x\) and \(y\) denote the depth and the fenced wall-parallel side, respectively, in feet. Then \(2x+y=84\), so \(y=84-2x\). The feasible interval is \(0\le x\le 42\), and the area function is \(A(x)=x(84-2x)=84x-2x^2\) square feet.

Its derivative is \(A'(x)=84-4x\). Solving \(84-4x=0\) gives \(4x=84\), hence \(x=21\) feet. Substitution into the constraint gives \(y=84-2(21)=84-42=42\) feet. Thus \(A=21\cdot42=882\) square feet.

Verify the fencing: \(2(21)+42=42+42=84\) feet. At the boundary \(x=0\), \(y=84\) and \(A=0\cdot84=0\) square feet. At \(x=42\), \(y=84-84=0\) and \(A=42\cdot0=0\) square feet. The interior area \(882\) square feet is greater than either boundary area. As a second check, \(F^2/8=84^2/8=7056/8=882\) square feet.

Worked Example: Compare a Proposed Design with the Maximum

There are \(200\) metres of fencing. A proposed design has a depth of \(40\) metres. Compare its area with the maximum possible area.

For the proposed depth \(x=40\) metres, the constraint \(2x+y=200\) requires \(y=200-2(40)=200-80=120\) metres. The proposed design uses \(2(40)+120=80+120=200\) metres of fencing, as required. Its area is \(40\cdot120=4800\) square metres.

The maximizing depth is \(F/4=200/4=50\) metres, and the corresponding side is \(F/2=200/2=100\) metres. Its fencing check is \(2(50)+100=100+100=200\) metres, and its area is \(50\cdot100=5000\) square metres.

The difference can also be checked using the completed-square identity. For \(x=40\), the loss from the maximum is \(2(40-50)^2=2(-10)^2=2(100)=200\) square metres. Indeed, \(5000-4800=200\) square metres. The proposed dimensions are feasible, but because \(40\ne50\), they do not attain the maximum.

Boundary Cases and Physical Feasibility

There are two related ways to describe the feasible set. If zero lengths are allowed for the purpose of checking limiting cases, the set is the closed interval \(0\le x\le F/2\), and both endpoints are feasible degenerate configurations with zero area. If an actual enclosure is required to have positive side lengths, then \(x>0\) and \(y>0\), so the domain is the open interval \(0<x<F/2\). The maximum is still attained in that physical domain because \(x=F/4\) lies strictly inside it.

It is important not to treat an endpoint as a usable enclosure: a zero side gives no enclosed area. It is equally important not to ignore endpoints when using the closed feasible interval. Here their area values confirm that they cannot beat the interior candidate. In other problems, endpoints can be important candidates, which is why they are checked rather than assumed irrelevant.

Common Mistake: Fencing the Wall Side

A common modeling error is to count all four sides as requiring fencing. That changes the constraint to \(2x+2y=F\), which describes a rectangle fenced on every side, not an enclosure that uses a wall.

Correction: When the wall forms one side and needs no fencing, count only the two perpendicular sides and the opposite side: \(2x+y=F\). Use that constraint before forming the area function.

For example, with \(120\) metres of fencing, the incorrect four-sided model would suggest a square with sides \(30\) metres, because \(4(30)=120\). Its area would be \(30\cdot30=900\) square metres. But for the wall enclosure, fencing three sides of length \(30\) metres uses only \(2(30)+30=90\) metres. It does not use all \(120\) metres, so it is not the solution to the stated fixed-fencing problem. The correct three-sided model gives dimensions \(30\) metres by \(60\) metres, uses \(2(30)+60=120\) metres, and encloses \(1800\) square metres.

Why the Model Matters

The optimization is short once the constraint is right. The wall determines which side needs no fencing; the two equal depths contribute \(2x\); and the remaining fenced side is whatever length is left, \(F-2x\). Reversing these roles or counting a wall side as fenced produces a different objective and a different answer.

The result gives a practical design rule: with a fixed amount of fencing and a sufficiently long straight wall, use one quarter of the fencing length for each perpendicular side and one half for the side opposite the wall. The rule assumes the wall can supply the entire side of length \(F/2\), the ground is suitable for a rectangle, and no additional materials or geometric restrictions change the constraint. Under those assumptions, the square-completion argument verifies the best possible area for every feasible design.

Check Your Understanding

Answer these questions using the three-sided enclosure model.

  1. If \(F\) is the available fencing, why is the constraint \(2x+y=F\) rather than \(2x+2y=F\)?
  2. What is the feasible interval for \(x\), and what geometric configuration does each endpoint represent?
  3. Starting from \(A(x)=x(F-2x)\), find the dimensions that maximize area.
  4. How does completing the square show that the candidate gives a global maximum?
  5. For \(F=160\) metres, calculate the maximizing dimensions and area, then verify that the fencing constraint is satisfied.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon