## 如何使用？

\begin{align} \min &f(x,y) = x^2y\\ \text{s.t. } & x^2 + y^2 = 1 \end{align}

$$\left\{\begin{array}{l} \dfrac{\partial L}{\partial x}= 2xy + 2x \lambda =0 \\ \dfrac{\partial L}{\partial y}=x^2 + 2y \lambda =0 \\ \dfrac{\partial L}{\partial \lambda}=x^2 + y^2 - 1=0 \end{array}\right.$$

\begin{aligned} &\min \left\{x^{2} y \mid x^{2}+y^{2}=1\right\}=-\frac{2}{3 \sqrt{3}} \text { at }(x, y)=\left(-\sqrt{\frac{2}{3}},-\frac{1}{\sqrt{3}}\right) \\ &\min \left\{x^{2} y \mid x^{2}+y^{2}=1\right\}=-\frac{2}{3 \sqrt{3}} \text { at }(x, y)=\left(\sqrt{\frac{2}{3}},-\frac{1}{\sqrt{3}}\right) \end{aligned}

\begin{align} \min &f(x,y,z) = xyz\\ \text{s.t. } &\frac{1}{x}+\frac{1}{y}+\frac{1}{z}=\frac{1}{a} \\ &\text{and } x,y,z,a >0 \end{align}

$$\left\{\begin{array}{l} \dfrac{\partial L}{\partial x}=y z-\dfrac{\lambda}{x^{2}}=0 \\ \dfrac{\partial L}{\partial y}=x z-\dfrac{\lambda}{y^{2}}=0 \\ \dfrac{\partial L}{\partial z}=x y-\dfrac{\lambda}{z^{2}}=0 \\ \dfrac{\partial L}{\partial \lambda}=\dfrac{1}{x}+\dfrac{1}{y}+\dfrac{1}{z}-\dfrac{1}{a}=0 \end{array}\right.$$

## 为什么取极值时一定相切？

$$\nabla f = \lambda \nabla g$$

$$\nabla f - \lambda \nabla g = \vec{0}$$

## 分析学证明

$$h^{\prime}(t)=f^{\prime}(\vec{r})=\left.\nabla f\right|_{\mathbf{r}(t)} \cdot \mathbf{r}^{\prime}(t)$$

PS：实际上充分条件是邻域同号，但我们相当于已经直到了是极值，所以用必要条件导数为零即可。

$$h^{\prime}(0)=\left.\nabla f\right|_{P} \cdot \mathbf{r}^{\prime}(0)=0$$

Thus, $\left.\nabla f\right|_{P}$ is perpendicular to any curve on the constraint surface through $P$. This implies $\left.\nabla f\right|_{P}$ is perpendicular to the surface. Since $\left.\nabla g\right|_{P}$ is also perpendicular to the surface we have proved $\left.\nabla f\right|_{P}$ is parallel to $\left.\nabla g\right|_{P} . \quad$ QED