Assuming the two numbers are x and y so that
x+y = 40
Where xy is maximum
Solve y in terms of x
y = 40-x
Then since
f(x,y) = xy is maximum substitute y = 40-x
f(x,y) = x(40-x)
Get the derivative both sides in terms of x
f'(x,y) = 40-2x
Equate it to 0 to solve x
0 = 40-2x
2x = 40
x = 20
For x+y = 40
Substitute x = 20
20+y = 40
y = 40-20
y = 20
Therefore
The two numbers are 20 and 20 whose their product is in maximum