<s>[INST] Find min,max value of $P=2x-y$ Let $x,y$ such that $\sqrt{\left(x+2\right)^2+y^2}+\sqrt{\left(x-2\right)^2+y^2}=6$. Find minimize, maximize value of $$P=2x-y$$

We have :
$$y=2x-P$$ so from condition:
$$\sqrt{\left(x+2\right)^2+\left(2x-P\right)^2}+\sqrt{\left(x-2\right)^2+\left(2x-P\right)^2}=6$$
i solved if $x=\frac {18} {\sqrt {41}}$ then $P=\sqrt {41}$ and $x=-\frac {18} {\sqrt {41}}\rightarrow P=-\sqrt {41}$ but  i do not know how to prove it is max,min value
 [/INST] The condition it's the equation of the ellipse with focuses $(2,0)$ and $(-2,0)$ and $a=3,$
which gives $b^2=5$ and  an equation of the ellipse:
$$\frac{x^2}{9}+\frac{y^2}{5}=1.$$
Also, easy to get this equation by squaring twice.
Now, let $2x-y=k$.
Thus, $$y=2x-k$$ and the equation $$\frac{x^2}{9}+\frac{(2x-k)^2}{5}=1$$ or
$$41x^2-36kx+9k^2-45=0$$ has real roots.
Id est, for the discriminant of this equation we obtain:
$$324k^2-41(9k^2-45)\geq0$$ or
$$k^2\leq41$$ or
$$-\sqrt{41}\leq k\leq\sqrt{41}.$$
For $k=-\sqrt{41}$ the line $y=2x+\sqrt{41}$ is a tangent line to the ellipse and the equality occurs in the touching point, which says that $-\sqrt{41}$ is a minimal value. 
$\sqrt{41}$ is a maximal value because $y=2x-\sqrt{41}$ is a tangent to the ellipse.  
</s>