Legendre transform
The Legendre transform of $f(\v x): \R^n\to\R$ is defined as $$ \begin{align*} f^\ast(\v p) = \sup_{\v x} \left[\v p\cdot \v x - f(\v x)\right] \end{align*} $$ whose domain is all $\v p\in\R^n$ for which the right hand side is finite.
Let $f(\v x): \R^n\to\R$ be a function and $f^\ast$ be its Legendre transform.
The domain of $f^\ast$ is a convex set, and $f^\ast$ is a convex function.
If $f$ is convex, then $f^{\ast \ast} = f$.
If $f: \R^n \to \R$ is strictly convex and differentiable, then the Legendre transform $$ \begin{align*} f^\ast(\v p) = \v p\cdot \v x(\v p) - f(\v x(\v p)) \end{align*} $$ where $\v x(\v p)$ is the solution to $\v p = \nabla f(\v x)$.