# Scott's question at Yahoo! Answers regarding optimization with constraint

#### MarkFL

##### Pessimist Singularitarian
Staff member
Here is the question:

Scott said:
An athletic field is to be built in the shape of a rectangle x units long capped by semicircular regions of radius r at the two ends?

The field is to be bounded by a 400 meter running track. What values of x and r will give the rectangle the largest possible area?
I have posted a link there to this thread so the OP can view my work.

#### MarkFL

##### Pessimist Singularitarian
Staff member
Hello Scott:

The objective function (that which we wish to optimize) is the area of the rectangle, and is as follows:

$$\displaystyle f(r,x)=2rx$$

And if we let $P$ be the perimeter of the field, we may state the constraint:

$$\displaystyle g(r,x)=2x+2\pi r-P=0$$

Now, we have two ways to proceed. The first is to solve the constraint for one of the two variables $r$ or $x$, and then substitute into the objective function so that we have a function in one variable and then optimize by differentiation. Sol if we solve the constraint for $r$, we obtain:

$$\displaystyle r=\frac{P-2x}{2\pi}$$

And the substituting into the objective function, we obtain:

$$\displaystyle f(x)=2\left(\frac{P-2x}{2\pi}\right)x=\frac{x(P-2x)}{\pi}$$

Now, at this point we see we have a quadratic function opening downwards and we could use a precalculus technique to find the maximum value. We see the roots are:

$$\displaystyle x=0,\,\frac{P}{2}$$

We know then that the axis of symmetry lies midway between these roots, and so the axis of symmetry is at :

$$\displaystyle x=\frac{P}{4}$$

And so we have:

$$\displaystyle r=\frac{P-2\left(\frac{P}{4}\right)}{2\pi}=\frac{P}{4\pi}$$

Now, let's try differentiation. Recall:

$$\displaystyle f(x)=\frac{x(P-2x)}{\pi}=\frac{1}{\pi}\left(Px-2x^2\right)$$

Hence, differentiating with respect to $x$, and equating the result to zero to obtain the critical value(s), we obtain:

$$\displaystyle f'(x)=\frac{1}{\pi}\left(P-4x\right)=0\implies x=\frac{P}{4}$$

And like before, we find:

$$\displaystyle r=\frac{P}{4\pi}$$

$$\displaystyle f''(x)=-\frac{4}{\pi}<0$$

Since the objective function is concave down everywhere, we know the critical value is at the global maximum.

Now, let's examine a multivariable method: Lagrange multipliers. Recall, we have:

The objective function:

$$\displaystyle f(r,x)=2rx$$

Subject to the constraint:

$$\displaystyle g(r,x)=2x+2\pi r-P=0$$

Hence, we obtain the system:

$$\displaystyle 2x=\lambda(2\pi)$$

$$\displaystyle 2r=\lambda(2)$$

Hence, this implies:

$$\displaystyle \lambda=\frac{x}{\pi}=r$$

Substituting for $r$ into the constraint, we obtain:

$$\displaystyle 2x+2\pi\left(\frac{x}{\pi}\right)-P=0$$

$$\displaystyle 4x=P$$

$$\displaystyle x=\frac{P}{4}\implies r=\frac{P}{4\pi}$$

So, given that the objective function is zero for $x=0$, we may conclude that this critical point is at a maximum.

Thus, we have shown in various ways that:

$$\displaystyle f_{\max}=f\left(\frac{P}{4},\frac{P}{4\pi}\right)$$

Using the given value $P=400\text{ m}$, we then may conclude that the rectangular portion of the field is maximized for:

$$\displaystyle x=\frac{400\text{ m}}{4}=100\text{ m}$$

$$\displaystyle r=\frac{400\text{ m}}{4\pi}=\frac{100}{\pi}\text{ m}$$

This means that the straight portions of the track are equal in length to the curved portions.