If any two polynomials touch exactly at a point (but do not cross), will they always have the same gradient at that touching point? If not, is it almost always and there are a few subtle conditions? I'm assuming it's true but I can't think how to prove it and couldn't seem to find any answer online.
Let $f(x)$ and $g(x)$ be the functions in question. If the functions "touch but do not cross" at a point $x_0$, then it must be the case that $f(x) \geq g(x)$ in some neighborhood of $x_0$, with equality only holding at $x = x_0$. (Note that this can be done without loss of generality—define $f(x)$ to be the function that is never less than the other function in this neighborhood.) In particular, this means that $f(x) - g(x) \geq 0$ in this neighborhood, with equality (again) only at $x = x_0$. Thus, $x = x_0$ is a local minimum of the function $f(x) - g(x)$.
Now, if $f(x)$ and $g(x)$ are both differentiable functions in a neighborhood of $x_0$, then $f(x) - g(x)$ is also differentiable. Since $f(x) - g(x)$ has a local minimum at $x_0$, this implies that $f'(x_0) - g'(x_0) = 0$, which gives us that $f'(x_0) = g'(x_0)$ as desired.