Let x: length of the pigpen
Let y: width of the pigpen (the block wall will also be y m wide, to run parallel to these 2 sides)
Objective function (Quantity to be optimized): Cost = 40x + 40y + 35y = 40x + 75y
Constraint: A = xy = 50 : . y = 50/x. We substitute this expression in for y in the cost function to get cost as a function of x only:
C(x) = 40x + 3750 / x Now, we differentiate w respect to x and set the derivative = 0 and solve:
C'(x) = 40 - 3750x-2 = 0
40x2 - 3750 = 0
x2 = 375/4
x = √375 / 2 = 5√15 / 2
y = 100 / √375 = 20 / √15