A farmer has an by foot corner wall and feet of fence. He wants to use the fence to construct an by foot rectangular field using the corner wall for one corner, and part or all of its sides. What should and be to maximize the area of the field? For the demonstration, , , , and . There are four cases relating , , , and , depending on whether , and , and , or . Vary to see the possible field boundaries. The largest field is shown in green, and as a "double square" when it is a 2 by 1 or 1 by 2 rectangle. Study its shape as (or or ) varies, in the cases , and . It can be a square, a 1x2 or 2x1 rectangle, or an "intermediate" rectangle. The possible shapes and a formula for the dimensions of the largest field are derived in the Details.
Maximizing the area of a rectangle with given perimeter, and maximizing the area of a rectangular field bordering a river with a given amount of fence, are special cases ( , and , ). In these problems, is maximum when the rectangle is a square, and a 2 by 1 rectangle, respectively. The case =0 and is a problem of both V. L. Klee, Jr., and J. L. Walsh. In this problem, the max is when , where does not exist. The "Corner Wall Problem" is interesting because there can be one, two, or three critical points, and the largest rectangle can be described geometrically. In general, is a continuous, piecewise linear function of , for . is zero at the endpoints and positive in between. A positive maximum exists. The maximum occurs where or where does not exist, i.e. where or . There can be up to three critical points. The maximum can be found by 1) determining the domain for for each case, 2) determining whether at a point interior to the domain for some case, 3) computing and comparing the values of where and at the endpoints for each case. The maximum is the largest of these values. This method is straightforward, given particular values of , , and , and is the method used in the Demonstration to find the maximum and where it occurs. But, it is not easy to carry this method out for arbitrary values of , , and . A formula for the dimensions of the maximum rectangle in terms of , , and can be determined as follows. Note the graph of is concave downward because when it exists. Thus there is a unique maximum. The maximum occurs either where , or where and , when does not exist. That is because, at these points, is increasing from the left and decreasing to the right. Since , . In the four cases, , , , and , and these formulas give the left and right derivatives when or . Suppose . In cases 1 and 4, we see is increased by making the rectangle more square. In cases 2 and 3, A is increased by making it more 2×1 or more 1×2. This tells us the largest rectangle is either a square, a 1×2 or 2×1 rectangle, or an "intermediate" rectangle with side or side . We first consider the nonboundary cases, and . is maximum when . Case 1: and : . In this case . A is max when . Thus, and . Case 2: and : . In this case, . is max when . Thus, and . Case 3: and : . In this case, . is max when and . Case 4: and : . In this case, . A is max when . Thus, and . Now the boundary cases, where or . A is maximum when and . Case 12: and : and . In this case, , and is max when and . Case 34: and : and . In this case, , and is max when and . Case 13: and : and . In this case , and is max when and . Case 24: and : and . In this case , and is max when and . Case 1234: and : and . In this case, , and is max when and . Solving the inequalities in each of these cases, we determine when and where the maximum can occur. The inequalities were solved graphically. An example is given for each case. is a maximum, with , when (1) , where . E.g., , , . (2) and , where and . E.g., , , . (3) and , where and . E.g., , , . (4) , where . E.g., , , . is a maximum, with or , when (12) and or and , where and . E.g., , , , and , , . (34) and , or and , where and . E.g., , , , and , and . (13) and , or and , where and . E.g., , , , or , , . (24) and , or and , where and . E.g., , , , or , , . (1234) and , where and . E.g., , , . SUMMARY. We express these results as inequalities for , given and : When , the maximum rectangle is square with if , has , if , is 1x2 with if , has , if , and is square with if . E. g., , . The maximum rectangle is square if , has if , is 1x2 if , has if , and is square if . When , the maximum rectangle is square with if , has , if , has , if , and is square with if . E. g., , . The maximum rectangle is square if , has if , has if , and is square if . When , the maximum rectangle is square with if , has , if , is 2x1 with if , has , if , and is square with if . E. g., , . The maximum rectangle is square if , has if , is 2x1 if , has if , and is square if . When , the maximum rectangle is square with if , has , if , has , if , and is square with if . E. g., , . The maximum rectangle is square if , has if , has if , and is square if . When , and the wall a staight wall, the maximum rectangle is 2x1 with , if , has , if , and is a square with if . Thus, for the Walsh/Klee problem, where and , the maximum rectangle has and . This Demonstration can check, and also suggest these results. When the (green) maximum area rectangle is 1×2 or 2×1, it is drawn as two squares, to emphasize this fact. All possibilites can be examined by choosing and so and , and varying . For reference, a function maxcornerformula[a,b,L], which implements the summary formula, is included in the Initializiation Code section. Changing its name to maxcorner will cause it to replace the function which finds the maximum rectangle by comparing values of A at critical points. This problem is a generalization of a problem of J. L. Walsh, former Professor of Mathematics at Harvard: A farmer wishes to enclose a rectangular field of largest area. He has already erected a straight fence of length 100 feet, and has at his disposal 200 additional feet of fencing. What is the largest rectangular field he can fence in, by making use of all or part of the fence already standing? J. L. Walsh, A Rigorous Treatment of MaximumMinimum Problems in the Calculus, Heath, 1962. Also, C. O. Oakley credits the same problem to V. L. Klee, Jr., but when the fance makes use of all of the existing fence. C. O. Oakley, "EndPoint Maxima and Minima, The American Mathematical Monthly, Vol. 54, No. 7, Part 1 (Aug.  Sep., 1947), pp. 407409. Pierre Malraison studied the general case of the "Wall Problem" in a film and slides produced at a 1974 NSF Workshop at Carleton College, Computer Graphics for Learning Mathematics.
