Let x be th first number and y be the second
So x + y = 18 ⇒ y = 18 - x
Call the function that we wish to maximize, M....so we have
M = xy^2
M = x (18 - x)^2
M = x (x^2 - 36x + 324)
M = x^3 - 36x^2 + 324x
Take the derivative and set to 0
M' = 3x^2 - 72x + 324 = 0
x^2 - 24x + 108 = 0 factor
(x - 18) (x - 6) = 0
Set each factor to 0 and solve for x and we have that x = 18 or x = 6
The second derivative will gives us a min and max for the function
Taking the second derivative. we have
6x - 72
Subbing 18 into this gives a positive....so.... this is a minimum for the function
Subbing 6 into this gives a negative so this is a max for the function
So the max product is when x = 6 and y = 12 = 6 (18 -6)^2 = 6 * 12^2 = 864