Solution (source code)

= Solution

By the definition of the <subdifferential>, $p\in\partial J(u)$ means
$$
J(v)\geq J(u)+\langle v-u,p\rangle\quad\text{for every }v.
$$
Rearrangement bounds $\langle v,p\rangle-J(v)$ by $\langle u,p\rangle-J(u)$, and equality is attained at $v=u$. Taking the supremum in the definition of the <convex conjugate> gives $J^*(p)=\langle u,p\rangle-J(u)$. Conversely this equality bounds every member of that supremum and rearranges to the <subgradient> inequality. Therefore
$$
\boxed{p\in\partial J(u)\iff J(u)+J^*(p)=\langle u,p\rangle.}
$$
Apply the same argument to $J^*$ and use the <Fenchel-Moreau theorem> $J^{**}=J$. With the canonical Hilbert identification of the bidual, the equality is also equivalent to $u\in\partial J^*(p)$. This proves <subgradient inversion under convex conjugacy>:
$$
\boxed{p\in\partial J(u)\iff u\in\partial J^*(p).}
$$
The conditions include finiteness at the points in question; expressions involving $+\infty$ are not <subgradients> merely by formal subtraction.