<s>[INST] The minimum of $x^2+y^2$ under the constraints $x+y=a$ and $xy=a+3$ I solved the following problem: If $x,y,a \in \mathbb{R}$ such that $x+y=a$ and $xy=a+3$, find the minimum of $x^2+y^2$
Here is my solution. $x^2+y^2=(x+y)^2 -2xy= a^2-2a-6$. The minimum value is obtained when $a=1$ and it is $-7$. Where did I go wrong?
The answer says that the minimum is $2$ when $x=y=-1$
 [/INST] Another way:  
$$(x+y)^2 \ge 2xy \implies a^2 \ge 2(a+3) \implies a \in (\infty, -2] \cup [3,\infty)$$
$$(x^2+y^2)(1+1)\ge(x+y)^2 \implies x^2+y^2 \ge \tfrac12 a^2 \ge 2$$
Equality is achieved in both inequalities when $x=y=-1$, so this is the minimum.
</s>