Let $U \subseteq \mathbb R^2$ be an open, bounded, connected subset.
Let $f:U \to U$ be a smooth map and suppose that $h:=f \circ f$ is affine (i.e. $\nabla^2h=\operatorname{Hess}h=0$).
Is $f$ affine?
Differentiating $dh=df \circ df$, we get: $$ 0=\operatorname{Hess}h=\nabla df\circ df+ df\circ \nabla df. $$
I am not sure how to proceed.
Take in the complex numbers the annulus $U = \{ z ∈ ℂ;~\frac 1 2 < \lvert z \rvert < 2\}$ and $f \colon U → U,~z ↦ \frac 1 z$.