Problem: Let \(k\) be a fixed odd positive integer. Find the minimum value of \(x^2 + y^2\), where \(x,y\) are non-negative integers and \(x+y=k\).


Solution: We have \(y=k-x\). Therefore we get an equation in \(x\) where \(k\) is a constant, precisely \(f(x) = x^2 + (k-x)^2\).

To minimise, we differentiate \(f(x)\) w.r.t \(x\).

So \(f'(x) = 4x-2k = 0\) (for minimum \(f(x)\))

That gives us \(x=\frac{k}{2}\).

But the question tell us that \(k\) is odd and \(x\) is an integer. therefore we have to take the closest possible integer value to \(\frac{k}{2}\), which is \(\frac{k+1}{2}\) and \(\frac{k-1}{2}\).

As already defined, taking \(x\) to be any one of the above \(y\) automatically takes the other value.

Therefore the minimum value of \(x^2 + y^2\) is given by \((\frac{k+1}{2})^2 + (\frac{k-1}{2})^2\) \(= \frac{k^2+1}{2}\).