<s>[INST] 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!
 [/INST] Since
$$
x^2+y^2=\frac12\left((x+y)^2+(x-y)^2\right)
$$
the minimum comes when $|x-y|$ is smallest, that is $1$ if $x+y$ is odd. Thus, the minimum is
$$
\frac12\left((x+y)^2+1\right)
$$
</s>