Prove that a function is affine 
Let $f,g:\mathbb R\to \mathbb R$ be functions such that 
  $$f(x+h)=f(x)+g(x)h+\alpha(x,h)$$ for all $x,h\in \mathbb R$, where
  $|\alpha(x,h)|\le Ch^3$. Show that $f(x)=ax+b$ for some $a,b\in
 \mathbb R$.

I think the way I'm supposed to prove this is by showing that $f'(x)$ is identically constant. The derivative of $f$ at $x$ is $\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$. I can write the given condition as $$\left|\frac{f(x+h)-f(x)}{h}\right|\le |g(x)| + Ch^2,$$and as $h\to 0$, we get $|f'(x)|\le |g(x)|$.
Am I on the right track? Any further hints?
 A: You have that 
$|\frac{f(x+h)-f(x)}{h}-g(x)|=|\frac{\alpha(x,h)}{h}|$
$<|\frac{Ch^3}{h}|=C|h^2|\to 0$ for $h\to 0$ 
so $f$ is derivable in any point and 
$f’(x)=g(x)$
But now 
$|\frac{g(x+h)-g(x)}{h}|=$
$|\frac{\frac{f(x+h+\tau)-f(x+h)}{\tau}-\frac{\alpha (x+h,\tau)}{\tau}-\frac{f(x+r)-f(x)}{r}+ \frac{\alpha (x,r)}{r}}{h}|=$
And if you choose $r=h$ and $\tau=-h$
$=|\frac{\frac{f(x+h-h)-f(x+h)}{-h}-\frac{\alpha (x+h,-h)}{-h}-\frac{f(x+h)-f(x)}{h}+ \frac{\alpha (x,h)}{h}}{h}|=$
$= |\frac{\frac{\alpha (x+h,-h)}{h}+ \frac{\alpha (x,h)}{h}}{h}|= |\frac{\alpha (x+h,-h)}{h^2}+ \frac{\alpha (x,h)}{h^2}|=$
$2C |h|\to 0$ for $h\to 0$ 
and so 
$g$ is a derivable function and $g’(x)=0$ for all $x$ and so $ f$ is linear 
A: I think the OP meant to say $$\big|\alpha(x,h)\big|\leq C|h|^3\tag{*}$$ for all $x\in\mathbb{R}$ and $h\in\mathbb{R}$.  Even if only $h\geq0$ is assumed in the OP's problem, it is not difficult to show that (*) still holds (but the constant $C$ in the OP's setting may need to be changed to a larger constant so that (*) is valid).  

  Suppose that $x\in\mathbb{R}$ is arbitrary and $h>0$.  From $f(x)=f(x-h)+g(x-h)h+\alpha(x-h,h)$, so that $$f(x-h)=f(x)+g(x-h)\cdot (-h)-\alpha(x-h,h)\,.$$  From the work below, we get  $g(x)-g(x-h)=\frac{\alpha(x-h,2h)-\alpha(x,h)-\alpha(x-h,h)}{h}$.  That is, $g(x)-g(x-h)$ is of order $10Ch^2$.  Ergo, (*) indeed holds even for negative $h$, with a different constant $C$.

Let $x$ and $h$ be arbitrary real numbers.  Note that $f(x+2h)-f(x)=2h\,g(x)+\alpha(x,2h)$ and
$$\begin{align}f(x+2h)-f(x)
&=\big(f(x+2h)-f(x+h)\big)+\big(f(x+h)-f(x)\big)
\\&=\big(h\,g(x+h)+\alpha(x+h,h)\big)+\big(h\,g(x)+\alpha(x,h)\big)\,.\end{align}$$
This proves that
$$g(x+h)-g(x)=\frac{\alpha(x,2h)-\alpha(x+h,h)-\alpha(x,h)}{h}\,.$$
From (*) and the Triangle Inequality, we obtain
$$\left|\frac{g(x+h)-g(x)}{h}\right|=\left|\frac{\alpha(x,2h)-\alpha(x+h,h)-\alpha(x,h)}{h^2}\right|\leq \frac{10C|h|^3}{h^2}=10C|h|\,.$$
This proves that $g'$ exists and is identically zero (by taking $h\to 0$).  That is, for some $a\in\mathbb{R}$, we have $g\equiv a$.  As $f'=g$ (see other answers), we conclude that, for some $a,b\in\mathbb{R}$, $f(x)=ax+b$ for every $x\in\mathbb{R}$.

In general, I think this holds.  Let $f,g_1,g_2,\ldots,g_k:\mathbb{R}\to\mathbb{R}$ and $\alpha:\mathbb{R}\times\mathbb{R}\to\mathbb{R}$ be such that, for every $x,h\in\mathbb{R}$, we have
$$f(x+h)=f(x)+g_1(x)\,h+g_2(x)\,h^2+\ldots+g_k(x)\,h^k+\alpha(x,h)\,,$$
where $\big|\alpha(x,h)\big|\leq C|h|^{k+2}$ for any $x,h\in\mathbb{R}$.  Then, $f$ is a polynomial function of degree at most $k$.  Furthermore, $$g_m(x)=\frac{1}{m!}\,f^{(m)}(x)$$ for each $m=1,2,\ldots,k$.  In particular, if $f(x)=a_0+a_1x+a_2x^2+\ldots+a_kx^k$, then $a_0=f(0)$ and $a_m=g_m(0)$ for each $m=1,2,\ldots,k$.
