W = length of the side perpendicular to L
40 = (L - 3) + (L - 1) + 2W
22 = L + W
W = 22 - L
area, A = LW = L(22 - L)
shouldn't need calculus to find the value of L that maximizes the area.
remember that the question is asking for the value of (L - 3).