Let the numbers be x and y.
Then x - y = 40
That means x = 40 + y
Now, let's say F = xy = (40 + y)(y) = y² + 40y
F will have a minimum where its first derivative is either undefined or equal to 0.
F' = 2y + 40 which is continuous and defined for all real numbers y
If 2y + 40 = 0
2y = -40
y = -20
Is -20 a minimum?
Look at a number to the left of -20, say -21. Now, plug that into F'.
F'(-21) = 2(-21) + 40 = -42 + 40 = -2 < 0, so F is decreasing over this interval (-∞, -20)
Now, look at a number to the right of -20. Take -19.
F'(-19) = 2(-19) + 40 = -38 + 40 = 2 > 0
Therefore, F is increasing over the interval (20, ∞)
By the First Derivative Test, -20 is a minimum point of F
Since y = -20, then x = 40 + y = 40 + (-20) = 40 - 20 = 20