Explanation:
2x + 2y = 28 <=====given
x * y = 40 <===given ..... re-arrange to :
y = 40 / x <===substitute this 'y' into the first equation
2x + 2 ( 40/x) = 28 <=====solve for x
2x^2 -28x + 80 = 0
x^2 -14x +40 = 0
(x -10)(x-4) = 0 shows x = 10 or 4 then y = 4 or 10
dimensions 10 and 4 inches