We want to enclose a fixed area in a rectangular pasture. What is the minimal amount of fencing needed if one side of the pasture is enclosed by a stone wall. (So, we want to minimize the length of the three other sides of the enclosure, subject to the constraint that the pasture must have area .)

Let be the length of the side of the pasture parallel to the stone wall and be the length of the sides perpendicular to the stone wall. Then, is fixed, so . The function we want to minimize is . Taking the derivative we have,

Thus, when and we have

Therefore, is decreasing when and increasing when . Hence, has a minimum when . Furthermore,