<s>[INST] Finding the maximum of an expression in three variables I am trying to find the max of $\frac{(a)(a-1)(9-a)}{2} + \frac{(b)(b-1)(9-b)}{2} + \frac{(c)(c-1)(9-c)}{2}$ subject to $a+b+c=9$ over nonnegative integers. I originally tried to see if something could work with Jensen's or calculus, and I have a conjecture that I haven't been able to prove that the maximum occurs when $a=5, b=4, c=0$ by simply plugging in an initial guess $a=b=c=3$ and then trying $a=4, b=3, c=2$ and then eventually $a=4, b=4, c=1$. Then because the function $f(x) = \frac{(x)(x-1)(9-x)}{2}$ is increasing when $x<6$ and $f(0)=f(1)=0$ we know that $(5,4,0) > (4,4,1)$.
Is there a more rigorous approach to this?
 [/INST] Without loss of generality $a \geq b \geq c$. So $c \leq 3$ and if you write down a list of all the values of $\frac{x(x-1)(9-x)}{2}$ for $0 \leq x \leq 9$ it's easy to check which pair $(a,b)$ maximises the total for each of the four possessible values of $c$, then see which of those is the greatest.
</s>