Let x and y be the two numbers. We assume that x is greater than y. Then x-y =40 ´╗┐which implies that y = x-40.
Their product P is P = x(x-40) = x^2-40x. To find the minimum, we should find the first derivative and set it to zero:
\frac{dP}{dx} =2x-40= 0.
By the second derivative test, since \frac{d^2 P}{dx^2} = 2 > 0
then P has a minimum at x.
Therefore, x = 20 and the other number is x-40=20-40=-20.
Indeed, their difference is 20-(-20)=40.