Convergence of a kind of difference quotient Let $f:\mathbb{R}\to \mathbb{R}$ be a measurable function and $(h_j)_j$ be a sequence of nonzero real numbers converging to zero as $j\to \infty$. Is it true that for almost every $x\in \mathbb{R}$:
$$\frac{1}{h_j}(\cos(f(x+h_j)-f(x))-1)\to 0\quad\mathrm{as}~~ j\to \infty~~?$$
It feels that the Lebesgue differentiation theorem or maybe some other measure-theoretic theorem must be used to prove it, if it is true at all.
 A: Let $$f(x) = \frac{\pi}{2}\mathbf{1}_\mathbb{Q}(x)$$
Take $x\in \mathbb{R}\backslash\mathbb{Q}$. Then $f(x)=0$. Let $q_n$ be a sequence of rationals converging to $x$. Let $h_n=q_n-x$. Then
$$\frac{1}{h_n}(\cos(f(x+h_n)-f(x))-1)= \frac{-1}{h_n}\nrightarrow 0$$
A: Let $f$ be a path of Brownian motion.  Then $E [|f(x+h_j) - f(x)|^2] = |h_j|$ so
$\frac{E [ \cos(f(x+h_j) - f(x)) - 1 ]}{h_j}$ does not converge to 0.  I think it
shouldn't be hard to convert the expected value statement to an "almost surely" statement, 
and then to go from that to an "almost all $x$" using Fubini's theorem. 
A: This is an elaboration on the answer of @Robert Israel. Let $B:\mathbb{R}\times\Omega\to\mathbb{R}$ be a (two-sided) Brownian motion defined on some probability space. Let
  $$
  X_j(x,\omega) = \frac{\cos(B(x + h_j,\omega) - B(x,\omega)) - 1}{h_j}.
  $$
Let $S = \{(x,\omega): X_j(x,\omega) \to 0\}$, $S_x=\{\omega:(x,\omega)\in S\}$, and $S_\omega=\{x:(x,\omega)\in S\}$. Let $m$ denote Lebesgue measure. We claim that
  $$
  P(\{\omega: m(S_\omega) = 0\}) = 1.
  $$
This claim implies that for $P$-a.e. $\omega$, the function $f(x)=B(x,\omega)$ serves as a (continuous) counterexample, showing that the answer to the original question is no. In fact, for such an $f$, the set of $x$ for which the quotient converges to zero is a set of measure zero.
To prove the claim, let us begin by defining
  $$
  Z_j(x,\omega) = \frac{B(x + h_j,\omega) - B(x,\omega)}{|h_j|^{1/2}}.
  $$
Then
  \begin{align*}
  |X_j| &= \left|{\frac{\cos(|h_j|^{1/2}Z_j) - 1}{h_j}}\right|\\
  &= \frac{\sin^2(|h_j|^{1/2}Z_j)}{|h_j||\cos(|h_j|^{1/2}Z_j) + 1|}\\
  &= \left({\frac{\sin(|h_j|^{1/2}Z_j)}{|h_j|^{1/2}Z_j}}\right)^2
    \frac1{|\cos(|h_j|^{1/2}Z_j) + 1|}Z_j^2.
  \end{align*}
Since $x\mapsto B(x,\omega)$ is continuous, $|h_j|^{1/2}Z_j\to0$ as $j\to\infty$. Hence, $X_j\to0$ if and only if $Z_j\to0$, which implies $S = \{(x,\omega): Z_j(x,\omega) \to 0\}$.
Now fix $x\in\mathbb{R}$, and suppose that $P(S_x)>0$. By Blumenthal's $0$-$1$ law, this implies $P(S_x)=1$. Thus, $Z_j(x)\to0$ a.s. But each $Z_j(x)$ is a standard normal random variable. Thus, $E|Z_j(x)|^2=1$ for all $j$, which implies that the sequence $\{Z_j(x)\}_j$ is uniformly integrable. Hence, almost sure convergence implies convergence in $L^1$, giving $E|Z_j(x)|\to0$ as $j\to\infty$. But this contradicts the fact that each $Z_j(x)$ is a standard normal. Therefore, $P(S_x)=0$ for all $x\in\mathbb{R}$.
We now have
  $$
  \int_\mathbb{R}\int_\Omega 1_S(x,\omega)\,dP(\omega)\,dx
    = \int_\mathbb{R} P(S_x)\,dx = 0.
  $$
By Fubini's theorem,
  $$
  \int_\Omega\int_\mathbb{R} 1_S(x,\omega)\,dx\,dP(\omega)
    = \int_\Omega m(S_\omega)\,dP(\omega) = 0.
  $$
Hence, $m(S_\omega)=0$ a.s., which proves the claim.
A: Here's another approach; hopefully it adds something to the answers already given. Suppose there is a Borel set $E$, with $m(E)>0$, and a preassigned sequence $\{h_j\}$ such that $\chi_E(x+h_j)\not\to \chi_E(x)$ for a.e. $x\in E$. Then $f(x)=\chi_E(x)$ provides a counterexample. In the spirit of @Ben Derret's original answer, I'm trying to show that a much weaker conclusion fails to hold, even in the context of characteristic functions of Borel sets.
As for the existence of $E$, I think a fat Cantor set will work if the sequence $\{h_j\}$ is chosen carefully. More precisely, let $E=\bigcap_kE_k$, where $E_0=[0,1]$, and $E_{k+1}$ is obtained from $E_k$ by removing an open segment of length $\frac{1}{2}\cdot\frac{1}{3^{k+1}}$ from the center of each of the $2^{k}$ disjoint intervals whose union is $E_k$. It's not hard to show that $m(E)=\frac{1}{2}$.
Suppose $x\in E$, and let $I=[a,b]$ be the interval housing $x$ at the $k$th stage in the construction; i.e., $I$ is one of the $2^k$ disjoint intervals (of common length) whose union is $E_k$. The length of $I$ is then
$$\frac{1}{2^k}\left(1-2^{-1}\sum_{n=1}^k\frac{2^{n-1}}{3^n}\right)=\frac{3^k+2^k}{6^k}<\left(\frac{5}{6}\right)^k\qquad(\text{assuming }k>1).$$
So $x\in\left(b-\frac{i}{6^k},b-\frac{i-1}{6^k}\right]$ for some $i\leq 5^k$.
For $i=0,\dots,5^k$, define $p_{i,k}=\frac{i}{6^k}$, and let $\{h_j\}$ be an enumeration of the $p_{i,k}$ satisfying $h_j\to0$. (For instance, $p_{0,1},\dots,p_{5,1};p_{0,2},\dots,p_{25,2};\dots.$)
If $x\in E$ and $I=[a,b]$ is as above, choose $p_{i,k}$ so that
$$b<p_{i,k}+x\leq b+\frac{1}{6^k}.$$
The complement $E_k^c$ of $E_k$ is the disjoint union of segments $S$, each with length at least $\frac{1}{2}\cdot\frac{1}{3^k}>\frac{1}{6^k}$. So $p_{i,k}+x$ lies in one of the $S\subset E_k^c$ (namely, the one that has $b$ for a left endpoint).  
There is a $j$ for which $p_{i,k}=h_j$. Then $x+h_j\notin E_k\supset E$. This can be done for all $k$, so $x+h_j\notin E\,$ infinitely often, and, if I haven't made an error, $\chi_E(x+h_j)\not\to\chi_E(x)$ whenever $x\in E$.
