TITLE: approximately linear functions
QUESTION [7 upvotes]: i suppose it's fairly well known that if a (continuous, real-valued) function $f$ on the real line satisfies
$f(x-y)=f(x)-f(y)+const$
then it is necessarily linear.
are there any general characterizations of "approximate" linearity? for example, what can be said if $|f(x-y)-f(x)+f(y)-f(0)|$ is bounded by some small $\epsilon$? or, more relevant to what i need, if the $L^2$ norm of this difference is bounded by a small constant? in particular, suppose,
$$E[(f(X-Y)-f(Y)+f(Y)-f(0))^2]\leq\epsilon$$
for a pair of independent random variables $X,Y$. is there a sense in which $f$ is approximately linear?

REPLY [14 votes]: Let $E$ and $E'$ be Banach spaces. Mappings $f:E\to E'$, which satisfy  the inequality
$$\|f(x + y) − f(x) − f(y)\| \leq\epsilon$$
for all $x, y \in E$,  are called $\epsilon$-additive (or approximately additive). The main result concerning approximately additive functions is due to D. Hyers
(link).

Theorem. Let $f(x)$ be an $\epsilon$-additive mapping of a Banach space $E$ into another Banach space  $E'$. Then $l(x)=\lim f(2^nx)/2^n$ exists for each $x$ in $E$, $l(x)$ is linear, and the inequality $$\|f(x)-l(x)\|\leq\epsilon$$ is true for all $x$ in $E$. Moreover, $l(x)$ is the only linear mapping satisfying this inequality. If $f(x)$ is continuous at at least one point, then $l(x)$ is continuous everywhere in $E$. 

So in your case $E=L^2(\Omega)$, $E'=\mathbb R$.
Edit. As Yemon Choi indicated, finite dimensional versions of the result had been discovered earlier and independently. Check out, for instance, the Pólya and Szegö problem book (Ch 3, Problem 99):

Assume that the terms of the sequence $a_1,a_2,a_3,\dots$ satisfy the condition 
  $$a_m+a_n-1 < a_{m+n} < a_m+a_n+1.$$
  Then
  $$\lim\limits_{n\to\infty}\frac{a_n}{n}=\omega$$
  exists; $\omega$ is finite and we have
  $$\omega n-1 < a_n < \omega n +1.$$