Mark M. answered 11/02/18
Retired math prof. Calc 1, 2 and AP Calculus tutoring experience.
I will assume that the dividers are perpendicular to the side of the barn.
Let x = length of the side of the pen against the barn
y = length of a side perpendicular to the barn
Then xy = 120. So, y = 120/x.
A = amount of fencing = x + 4y = x + 480/x, x > 0
So, A' = 1 - 480/x2 = (x2 - 480) / x2
A' = 0 when x2 = 480.
x = sqrt(480) = 4sqrt(30) = 21.9
When 0 < x < 4sqrt(30), A' < 0. So, A is decreasing.
When x > 4sqrt(30), A' > 0. So, A is increasing.
Therefore, A is minimized when x = 4sqrt(30) and y = sqrt(30).