Suppose there are 3 non-negative integers $x$, $y$ and $z$ on the real line. We are told that $x + y + z = 300$. Without loss of generality, assume $x$ to be the smallest integer, and $z$ to be the largest.
How do I minimize $(x + z)$?
Attempt: $x + z = 300 - y$, so for a start I should maximize y. This occurs at $y = z - 1$. So, we have $x + 2z = 301$. Now, $z = \dfrac {301}2 - \dfrac x2$. $\dfrac {dz}{dx} = -\dfrac 12$. Increasing $x$ by $1$ decreases $z$ only by $\dfrac12$. So, I should pick the smallest possible $x$, which is $1$. Then, $z = 150$. $\min (x+z) = 151$.
Questions
- Is my logic correct?
- Is there a systematic way to solve questions of this kind? i.e. given non-negative numbers on the real line that sum up to a fixed value, how to minimize the sum of the largest and smallest of them?