the sum of three positive numbers is 40. The first plus three times the second plus four times the third add up to 80. Select the numbers so that the product of all three is as large as possible.

first number --- x

2nd number ----y
3rd number ---- 40-x-y

x + 3y + 4(40-x-y) = 80
x + 3y + 160 - 4x - 4y = 80
-3x- y = -80
3x + y = 80
y = 80-3x

product = x(y)(80-x-y)
= 80xy - x^2 y - x y^2
= 80x(80-3x) -x^2(80-3x) - x(6400 - 480x + 9x^2)
= ....
= 160x^2 - 6x^3

d(product)/dx = 320x - 18x^2
=0 for a max/min of product
18x^2 - 320x = 0
9x^2 - 160x= 0
x(9x - 160) = 0
x = 0, which would product a minimum product of 0
or
x = 160/9
then y = 80-160/3 = 80/3
third number = 80-160/9 - 80/3 = 320/9

check my arithmetic and algebra, I was expecting nicer numbers.