Find the minimum value of $x^2+y^2$, where $x,y$ are nonnegative integers and $x+y=k$. Question: Let $k$ be a fixed odd positive integer. Find the minimum value of $x^2+y^2$, where $x,y$ are nonnegative integers and $x+y=k$.
My approach: After trying some examples I can conjecture that, the minimum value of $x^2+y^2$ is attained at $$x=\left\lceil \frac{k}{2}\right\rceil \text{and } y=\left\lfloor\frac{k}{2}\right\rfloor \text{and equivalently at } x=\left\lfloor\frac{k}{2}\right\rfloor \text{and }y=\left\lceil \frac{k}{2}\right\rceil.$$ This also implies that the minimum value of $x^2+y^2=\left\lceil \frac{k}{2}\right\rceil^2+\left\lfloor\frac{k}{2}\right\rfloor^2.$ 
But, how to prove the same?
Also, since $x+y=k$, this implies that $(x+y)^2=k^2\implies x^2+y^2=k^2-2xy.$ Therefore, we need to maximize $xy$ in order to minimize $x^2+y^2$. 
But, again this is leading me nowhere. 

Try this:
$$
\begin{aligned}
x^{2}+y^{2}&=\frac{(x+y)^{2}+(x-y)^{2}}{2}
\end{aligned}
$$
Since $(x+y)$ is fixed, we minimize $x^{2}+y^{2}$ by minimizing $|x-y|$
