Understanding the Legendre transform
Solution 1:
The change of variable part you got right. However, the Legendre transform of $f:\mathbb R\to\mathbb R$ is $$ f^*(p)=\sup_{x\in\mathbb R}\{xp-f(x)\}\,. $$ Since $f$ is convex: $$ f^*(p)=xp-f(x)\,,\text{ for }f'(x)=p\,. $$ In other words: $f^*(p)$ is a function of $p=f'(x)$ which contains the same information as $f\,.$
Example: $f(x)=e^x,f'(x)=e^x$ leads to $f^*(p)=xp-e^x$ with $p=e^x$, or $x=\log p\,.$ That is: $$ f^*(p)=p\log p-p\,. $$
A marvellous paper motivating the Legendre transform in physiscs is
R.K.P. Zia, E.F. Redish, S.R. McKay, Making Sense of the Legendre Transform, arXiv:0806.1147v2, 2009.