Proof that $f^{**}=f$ for almost everywhere differentiable $f$, where $f^*$ is the Legendre transform Let $D\subset\mathbb R^n$ be a convex set and let $f\colon D\to\mathbb{R}$ be a convex function. $f^*$ denotes the Legendre transformation of $f$. If $f$ is doubly differentiable, $f=f^{**}$ (there's a proof on Wikipedia).
Problem: In thermodynamics we deal with functions that are not everywhere differentiable (for example piecewise defined continuous functions) and thus we have to stick to the definition involving the supremum.
Question: How can I prove / where can I find a proof of $f=f^{**}$ for a almost everywhere differentiable $f$?
 A: First, it is not necessarily true on $\partial D$.  Consider $D = [-1,1]$:
$$ f(x) = \cases{\frac{x^2}2 & if $|x| < 1$ \\ 5 & if $|x| = 1$ .} $$
Then
$$ f^*(p) = \cases{\frac{p^2}2 & if $|p| \le 1$ \\ |p|-\tfrac12 & if $|p| \ge 1$ .}$$
Then it can be seen that $f^{**}(1) = \tfrac12 \ne 5$.
Lemma 1: If $x_0 \in D$, then $f^{**}(x_0) \le f(x_0)$.
Proof: For any $p \in D^*$, and any $x \in D$, we have $f^*(p) \ge x \cdot p - f(x)$.  In particular $f^*(p) \ge x_0 \cdot p - f(x_0)$, and so $f(x_0) \ge x_0 \cdot p - f^*(p)$.  Taking the supremum over $p \in D^*$, the result follows. $\square$
Lemma 2: If $x_0 \in D^\circ$, then $f^{**}(x_0) \ge f(x_0)$.
Proof: By the Hahn Banach Theorem, there exists a separating hyperplane in $\mathbb R^n \times \mathbb R$ between $C = \{(x,y): x \in D, y \ge f(x)\}$ and $(x_0,f(x_0)$).  Choose one such hyperplane.
This hyperplane is of the form $r\cdot (x - x_0) + s(y-f(x_0)) = 0$.  See that $s \ne 0$, because both $C \cap \{(x,y) : r \cdot (x-x_0) > 0\}$ and $C \cap \{(x,y) : r \cdot (x-x_0) < 0\}$ are non-empty.
Let $p_0 = -r/s$ be the slope of this hyperplane.  Thus the hyperplane is $ y = f(x_0) + (x-x_0) \cdot p_0 $.  It may be seen $p_0 \in D^*$, and $f^*(p_0) = x_0 \cdot p_0 - f(x_0)$.  Then $f^{**}(x_0) \ge x_0 \cdot p_0 - f^*(p_0) = f(x_0)$. $\square$
