*Definition*: for $D \subseteq \mathbb{R}^n$ let $f: D \to \mathbb{R}$ be differentiable and $D$ contains no boundary points (open). A point $\mathbf{x^*} \in D$ is called a critical point for $f$ $\iff \nabla f(\mathbf{x^*}) = \mathbf{0}$.
*Definition*: $f$ has (strict) global $\begin{matrix} \text{ maximum } \\ \text{ minimum } \end{matrix}$ in $\mathbf{x^*} \in D$ $\iff \forall \mathbf{x} \in D \backslash \{\mathbf{x^*}\} \Big[f(\mathbf{x^*}) \begin{matrix} (>) \\ \geq \\ \leq \\ (<) \end{matrix} f(\mathbf{x}) \Big]$.
*Definition*: $f$ has (strict) local $\begin{matrix} \text{ maximum } \\ \text{ minimum } \end{matrix}$ in $\mathbf{x^*} \in D$ $\iff \exists r_{>0} \forall \mathbf{x} \in D \backslash \{\mathbf{x^*}\} \Big[f(\mathbf{x^*}) \begin{matrix} (>) \\ \geq \\ \leq \\ (<) \end{matrix} f(\mathbf{x}) \;\land\; (0) < \|\mathbf{x}- \mathbf{x^*}\| <r \Big]$
*Theorem*: if $f$ has local $\begin{matrix} \text{ maximum } \\ \text{ minimum } \end{matrix}$ at $\mathbf{x^*} \in D$ then $\mathbf{x^*}$ is a critical point of for $f$.
<details>
<summary><em>Proof</em>:</summary>
will be added later.
</details>
<br>
## A second derivative test
*Definition*: suppose $f: \mathbb{R}^n \to \mathbb{R}$ is differentiable with $\mathbf{x} \in \mathbb{R}^n$. The Hessian matrix of $f$ is defined as
* If $H_f(\mathbf{x^*})$ is positive definite (all eigenvalues are positive), then $f$ has a local minimum at $\mathbf{x^*}$.
* If $H_f(\mathbf{x^*})$ is negative definite (all eigenvalues are negative), then $f$ has a local maximum at $\mathbf{x^*}$.
* If $H_f(\mathbf{x^*})$ is indefinite (both positive and negative eigenvalues), then $f$ has a saddle point at $\mathbf{x^*}$.
* If $H_f(\mathbf{x^*})$ is neither positive nor negative definite, nor indefinite, (eigenvalues equal to zero) this test gives no information.
<details>
<summary><em>Proof</em>:</summary>
will be added later.
</details>
<br>
## Extrema on restricted domains
*Theorem*: let $D \subseteq \mathbb{R}^n$ be bounded and closed ($D$ contains all boundary points). Let $f: D \to \mathbb{R}$ be continuous, then $f$ has a global maximum and minimum.
<details>
<summary><em>Proof</em>:</summary>
will be added later.
</details>
<br>
**Procedure to find the global maximum and minimum**:
* Find critical points in the interior.
* Find global extrema on the boundary.
* Find the largest/smallest among them.
### Lagrange multipliers
*Theorem*: let $f: M \to \mathbb{R}$ and $g: \mathbb{R}^n \to \mathbb{R}$ with $M$ the boundary of $D$ given by
suppose that there is global maximum or minimum $\mathbf{x^*} \in M$ of $f$ that is not an endpoint of $M$ and $\nabla g(\mathbf{x^*}) \neq \mathbf{0}$. Then there exists a $\lambda^* \in \mathbb{R}$ such that $(\mathbf{x^*}, \lambda^*)$ is a critical point of the Lagrange function
suppose that there is global maximum or minimum $\mathbf{x^*} \in S$ of $f$ that is not an endpoint of $S$ and $D \mathbf{g}(\mathbf{x^*}) \neq \mathbf{0}$. Then there exists a $\mathbf{\lambda^*} \in \mathbb{R^m}$ such that $(\mathbf{x^*}, \mathbf{\lambda^*})$ is a critical point of the Lagrange function
suppose that there is global maximum or minimum $\mathbf{x^*} \in M_1 \cap M_2$ of $f$ that is not an endpoint of $M_1 \cap M_2$ and $\nabla g_{1,2}(\mathbf{x^*}) \neq \mathbf{0}$. Then there exists a $\lambda_{1,2}^* \in \mathbb{R}$ such that $(\mathbf{x^*}, \lambda_{1,2}^*)$ is a critical point of the Lagrange function