Let $f:\mathbb{R}\to\mathbb{R}$ be defined by $$f(x)=\begin{cases} 1 & \text{ if } x<1 \\ 3x-1 & \text{ if } x\geq 1 \end{cases}$$ How do I determine the Legendre transform $f^*$ of $f$, and the Legendre transform $(f^{*})^*$ of $f^*$?
Given a function $g:A\to \mathbb{R}$, where $A\subseteq \mathbb{R}^k$, the definition of $g^*$ is defined by $$g^*(p)=\sup\{xp-g(x)\mid x\in A\}$$ for $p\in \mathbb{R}^k$, where the supremum on the right side is finite.
Clearly, we have $$ \sup\{xp-f(x)\mid x <1\}=-1;\\ \sup\{xp-f(x)\mid x \geq 1\}=1. $$ Determining the maximum of them, we get that $f^*(p)=1$ and the domain of $f^*$ is $\{3\}$. Am I understanding this correctly? The Legendre transform has different names, such as a Legendre-Fenchel or a conjugate function.
Hint:
$$f^*(p) = \max \Big\{ \sup_{x<1} \big(y x -1\big), \sup_{x\geq 1} \big( y x - 3x+1\big)\Big\}$$
Now let's evaluate the first supremum in the max.
If $y<0$, then that supremum is $+\infty$ (by letting $x\to-\infty$).
If $y \geq 0$, then that supremum is $\lim_{x\to 1^-} (yx-1)=y-1$.
Now argue similarly for the second supremum and put it all together.