Cauchy Schwarz - Finding minimum of a function For $x, y , z$ in real numbers, If $2x+y+z=5$, then what is the min value of $x^2 + y^2 + z^2 - 2x + 4y + 6$.  This is a weekend brain teaser in the 2nd week of Calc 3.
 A: This problem can be solved by using elementary math only (no derivatives, no Lagrange multipliers, no C-S ineqaulity etc). 
We have to minimize the expression:
$$f=x^2+y^2+z^2-2x+4y+6=(x-1)^2+(y+2)^2+z^2+1$$
Introduce substitution:
$$u=x-1, \ \ v=y+2, \ \ w=z$$
The expression that has to be minimized now becomes:
$$f=u^2+v^2+w^2+1\tag{1}$$
...with the following constraint:
$$2u+v+w=5\tag{2}$$
Make one more subsitution: 
$$v=x-y, \ \ w=x+y$$
Replace that into (1) and (2) and you get:
$$f=u^2+2x^2+2y^2+1\tag{3}$$
...and the constraint becomes:
$$2u+2x=5\tag{4}$$
The point is: contraint (4) give us the possibility to minimize (3) by simply choosing $y=0$. Now the problem is much simpler. We have to minimize:
$$f=u^2+2x^2+1\tag{5}$$
...with constraint:
$$u+x=\frac52\tag{6}$$
From (6):
$$x=\frac 52-u$$
...so (7) becomes:
$$f=u^2+2(\frac 52 - u)^2+1=3(u-\frac53)^2+\frac{31}{6}$$
So the minimum value is $f_{min}=\frac{31}{6}$ and it is reached for $u=\frac53$.
A: Here is an alternate solution using the Cauchy-Schwarz Inequality:-
We have to minimize  $f(x,y,z)=x^2+y^2+z^2-2x+4y+6=(x-1)^2+(y+2)^2+z^2+1$ subject to $2x+y+z=5$
From the Cauchy-Schwarz Inequality , we have $$(2\cdot(x-1)+1 \cdot (y+2) +1\cdot z)^2 \leq (2^2+1^2+1^2)((x-1)^2+(y+2)^2+z^2)$$ $$ \therefore (2x+y+z)^2 \leq 
6\cdot ( (f(x,y,z)-1)$$
$$ \implies \frac{(2x+y+z)^2}{6} + 1 \leq f(x,y,z) \implies f(x,y,z) \geq \frac{25}{6}+1=\boxed{\frac{31}{6}} $$

Let’s take it a step further , and generalise the result .
We have to find the minimum of $f(x,y,z)=a_1x^2+b_1y^2+c_1z^2+a_2x+b_2y+c_2z+d$ , subject to $a_0x+b_0y+c_0z=l$
First , we complete the squares , and obtain $$f(x,y,z)=(\sqrt{a_1}x+\frac{a_2}{2\sqrt{a_1}})^2+(\sqrt{b_1}y+\frac{b_2}{2\sqrt{b_2}})^2+(\sqrt{c_1}z+\frac{c_2}{2\sqrt{c_1}})^2 +(d-(\frac{a_2^2}{4a_1}+\frac{b_2^2}{4b_1}+\frac{c_2^2}{4c_1}))$$
Then , by the Cauchy Schwarz Inequality , we have :- $$((\sqrt{a_1}x+\frac{a_2}{2\sqrt{a_1}})\cdot \frac{a_0}{\sqrt{a_1}}+(\sqrt{b_1}y+\frac{b_2}{2\sqrt{b_1}})\cdot \frac{b_0}{\sqrt{b_1}}+(\sqrt{c_1}z+\frac{c_2}{2\sqrt{c_1}})\cdot \frac{c_0}{\sqrt{c_1}})^2 \leq (f(x,y,z)-(d-(\frac{a_2^2}{4a_1}+\frac{b_2^2}{4b_1}+\frac{c_2^2}{4c_1})))(\frac{a_0^2}{a_1}+\frac{b_0^2}{b_1}+\frac{c_0^2}{c_1})        $$
And from this , we obtain :- $$ f(x,y,z) \geq \frac{(l+\frac{a_2a_0}{2a_1}+\frac{b_0b_2}{2b_1}+\frac{c_0c_2}{2c_1})^2}{(\frac{a_0^2}{a_1}+\frac{b_0^2}{b_1}+\frac{c_0^2}{c_1})}+(d-(\frac{a_2^2}{4a_1}+\frac{b_2^2}{4b_1}+\frac{c_2^2}{4c_1})$$ Perhaps not the prettiest  result , but certainly works when none of the denominators equate to $0$ . And in your case , on substituting the values , the formula happens to equal $\frac{31}{6}$ .
