Farmer John is building a pen to keep his pig in. John has 40m of fencing. He will only need to make 3 sides to the pen because the 4th side will be along a barn. If John wants the maximum area what should the side lengths of the pen be?

L + 2w = 40

so
L = 40 - 2w

A = L * w
A =(40-2 w)(w) = 40 w - 2 w^2

2 w^2 - 40 w = -A
w^2 - 20 w = -A/2

w^2 - 20 W + 100 = -A/2 + 100
(w-10)^2 = -(1/2)(A-200)
vertex at w = 10, A = 200
so L = 20

To find the side lengths of the pen that will give the maximum area, we can use the concept of calculus. The problem can be formulated as follows: maximize the area of a rectangle with fixed perimeter.

Let's denote the two equal side lengths of the pen as x, and the side along the barn as y. Since there are three sides in total, the perimeter of the pen is given as:

2x + y = 40m

We can solve this equation for y:

y = 40m - 2x

Now, the area of the rectangle is given by:

Area = x * y = x * (40m - 2x)

To find the maximum area, we need to find the value of x that maximizes the area. To do this, we can take the derivative of the area function with respect to x and set it equal to zero:

d(Area)/dx = 40m - 4x = 0

Now, solving for x:

40m = 4x
x = 10m

Plugging this value of x back into the equation for y:

y = 40m - 2(10m)
y = 20m

Therefore, the side lengths of the pen should be 10m and 20m to maximize the area.