Find the minimum value of $x^2+y^2$, where $x,y$ are non-negative integers and $x+y$ is a given positive odd integer Let $k$ be a fixed positive odd integer. Find the minimum value of $x^2+y^2$, where $x,y$ are non-negative integers and $x+y=k$  
My approaches:


*

*Since $k$ is odd, $x$ and $y$ have different parity. I consider, $k=2m+1$, so that $x+y=2m+1$.
I also consider $x$ to be even and $y$ to be odd.
So, $2p+2q+1=2m+1$.
Also, $4p^2+4q^2+4q+1+8pq+4p=4m^2+4m+1$  which apparently doesn't lead me anywhere. 

*$x+y=k$. Then 
$x^2+y^2+2xy=k^2$.
Now I am stuck!
Please help!

Starting with $x<y$ and $y\neq x+1$ then $\left(x+1\right)^{2}+\left(y-1\right)^{2}<x^{2}+y^{2}$ so then pair
$\left(x,y\right)$ will not provide the minimal value (pair $\left(x+1,y-1\right)$ does 'better'). This shows
that we need $y=x+1$.
If $k=2n+1$ then $x=n$ and $y=n+1$ give the minimum value $n^{2}+\left(n+1\right)^{2}=\frac{1}{2}\left(k^{2}+1\right)$
In situations like this it is a good habit to pick out a 'small' one (p.e. $k=7$)  and to investigate the candidates $0+7$, $1+6$,... et cetera. Patterns show up that are useful.
