Let's say I have two real values $x_1$ and $x_2$, to each of which I associate $y_i$ and $y'_i$ satisfying $$ (y_2-y_1)(y'_2 - y'_1) \geq 0. \tag{1} $$ I would like to find a polynomial $f:[x_1,x_2]\to \Bbb R$ such that $f(x_i) = y_i$, $f'(x_i) = y'_i$ and $f$ is convex on $[x_1,x_2]$. The lowest relevant degree of $f$ is $3$ since the four equality conditions have to be satisfied in general. However, it is easy to find counterexample. Say, for $x_1 = -1$, $x_2 = 10$ and $y_i,y'_i$ given by $x(x-1)(x+1)$ satisfy $(1)$, but clearly $x(x-1)(x+1)$ is the only polynomial of degree 3 that satisfies all the four equality conditions, and it is not convex on $[-1,10]$.
What is the minimal degree of a polynomial that satisfies all the four equality conditions together with being convex, and what are its coefficients?
Actually, after giving some thought I concluded that $(1)$ can't be sufficient. It is necessary that $$ y_2 \geq y'_1\cdot(x_2 - x_1)\tag{2} $$ $$ y'_2 \geq\frac{y_2-y_1}{x_2-x_1} \tag{3} $$ otherwise it is easy to provide counterexamples. Are those additional requirements sufficient?