# Minimal Optimization

1. Apr 18, 2012

### AvgStudent

A farmer wishes to build a rectangular chicken coop with as close to, but not greater than N square units. He wants to purchase the least amount of fencing possible, but fencing can only be purchase by the integer foot. How does he do this?

P = 2x+2y
N = xy
y=N/x

P = 2x + 2(N/x)

P' = 2 - (2N)/x^2
0 = 2-(2N)/x^2
x = sqrt(N)
y = sqrt(N)

We obviously don't want to just make N a perfect square because the difference between high numbers won't make the square feet near N. Any suggestions to get the integer foot?

2. Apr 18, 2012

### HallsofIvy

Staff Emeritus
You can't "just make N a perfect square" because N is given.
Take x to be the largest integer less than N, y to be x+1.

3. Apr 18, 2012

### AvgStudent

I'm sorry, I don't exactly understand your answer. How would that minimize the perimeter? And in the problem it says you have to be as close to, but not more than N.

4. Apr 18, 2012

### SammyS

Staff Emeritus
As the problem is stated here, only the perimeter needs to be an integer.

As long as x and y each is not restricted to being an integer, it's possible to values of x and y so that the area is exactly N, whether or not N is an integer.

5. Apr 19, 2012

### AvgStudent

Ooh. I didn't catch that. Is there a possible way to create a formula to find x and y relating to N? No matter how I think about it, it doesn't apply to all N.