W=3*106/L (Note the unit of 3 is million square feet)
F = 2(L + W) + W
F = 2L + 3W = 2L + (9*106/L)
dF/dL = 2 - (9*106/L2)
At the minimum 2L2 = 9*106 and L = 3*103/√2 =(3/2)*103√2 feet
W = 103√2 feet
and you can get F the number of feet of fence as 2L + 3W