Show that $u(t)=\frac{1}{2r}\int_{t-r}^{t+r}u(x)\,{\rm d}x=\frac{u(t-r)+u(t+r)}{2}$. Specifically, the question is as follows:

Let $(a,b) \subset \mathbb{R}$.
a) Suppose a function $u:(a,b) \rightarrow \mathbb{R}$ is a solution of $u^{\prime\prime}(x) = 0$ for $x \in (a,b)$. Show that
  $$
u(t) = \frac{1}{2r} \int_{t-r}^{t+r} u(x) \, {\rm d} x = \frac{u(t-r) + u(t+r)}{2}
$$
   for every $t \in (a,b)$ and for every interval $(t-r, t+r) \subset (a,b)$ with $r>0$.
b) Suppose a sufficiently smooth function $w:(a,b) \rightarrow \mathbb{R}$ satisfies
  $$
w(t) = \frac{1}{2r} \int_{t-r}^{t+r} w(x) \, {\rm d} x
$$
   for every $t \in (a,b)$ and for every interval $(t-r, t+r) \subset (a,b)$ with $r>0$.
Show that 
   $
\displaystyle \frac{w(t-r) + w(t+r)}{2} = w(t)
 $
   and $w^{\prime\prime}(t) = 0$.

So, together, parts a) and b) make up an if and only if statement. My struggle is primarily with part a), but I'm also not entirely sure on part b).
For part a), I understand that $u''(x)=0$ tell us that $u$ is (at most) linear in $x$. However, I'm not sure how to proceed from that assessment.
For part b), here is my proposed solution:
Observe that 
$$w(t-r)=\frac{1}{2r}\int_{t-2r}^tw(x)dx=\frac{w(t)-w(t-2r)}{2r}$$
and 
$$w(t+r)=\frac{1}{2r}\int_{t}^{t+2r}w(x)dx=\frac{w(t+2r)-w(t)}{2r}.$$
So
$$\frac{w(t-r)+w(t+r)}{2}=\frac{w(t+2r)-w(t-2r)}{4r}=\frac{1}{4r}\int_{t-2r}^{t+2r}w(x)dx.$$
Thus, without loss of generality, let $r=2r$, and the desired result follows. Then, by application of the Leibniz integral rule,
$$w'(t)=\frac{d}{dt}\frac{1}{2r}\int_{t-r}^{t+r}w(x)dx$$
$$=\frac{1}{2r}\left[w(t+r)\cdot\frac{d}{dt}(t+r)-w(t-r)\cdot\frac{d}{dt}(t-r)+\int_{t-r}^{t+r}\frac{\partial}{\partial t}w(x)dx\right]$$
My questions here are specifically if I can simply let $r=2r$, or if I need to further justify that claim; and how do I handle $\int_{t-r}^{t+r}\frac{\partial}{\partial t}w(x)dx$ (or have I misunderstood the application of the Liebniz integral rule)?
Please note that this is a homework question, so I would prefer guidance to a full solution. Thank you.
 A: $\textbf{Edit}$: This is incorrect (specifically part b). I'll leave it here in case others are tempted make the same error. A corrected version has been appended to the end to replace the section between the horizontal rules.
a) Because $u''(x)=0$, $u$ is linear in $x$. That is, $u(x)=\alpha x+\beta$, for some $\alpha,\beta\in\mathbb{R}$. Then,
$$\frac{u(t-r)+u(t+r)}{2}=\frac{\alpha(t-r)+\beta+\alpha(t-r)+\beta}{2}=\alpha t+\beta=u(t).$$
Similarly,
$$\frac{1}{2r}\int_{t-r}^{t+r}\alpha x+\beta=\frac{1}{2r}\left[\frac{\alpha x^2}{2}\bigg\rvert_{t-r}^{t+r}+\beta x\bigg\rvert_{t-r}^{t+r}\right]$$
$$=\frac{1}{2r}\left[\frac{\alpha(t+r)^2}{2}-\frac{\alpha(t-r)^2}{2}+\beta(t+r)-\beta(t-r)\right]=\frac{1}{2r}[2\alpha tr+2\beta r]=\alpha t+\beta=u(t).$$
The desired result follows.
b) Observe that 
$$w(t-r)=\frac{1}{2r}\int_{t-2r}^tw(x)dx=\frac{w(t)-w(t-2r)}{2r}$$
and 
$$w(t+r)=\frac{1}{2r}\int_{t}^{t+2r}w(x)dx=\frac{w(t+2r)-w(t)}{2r}.$$
So
$$\frac{w(t-r)+w(t+r)}{2}=\frac{w(t+2r)-w(t-2r)}{4r}=\frac{1}{4r}\int_{t-2r}^{t+2r}w(x)dx.$$
Thus, without loss of generality, let $r=2r$, and the desired result follows. 

Then, let $W$ be the anti-derivative of $w$. Hence, by assumption, 
\begin{align}
\tag{*}
w(t)=\frac{1}{2r}(W(t+r)-W(t-r)).
\end{align}
Thus,
$$w'(t)=\frac{d}{dr}\left[\frac{1}{2r}(W(t+r)-W(t-r))\right].$$
By application of the product rule and the fact that the derivative of a difference is the difference of the derivatives, this evaluates to
$$\frac{1}{2r}(w(t+r)-w(t-r))-\frac{1}{2r^2}(W(t+r)-W(t-r)).$$
Then, since $\frac{w(t-r) + w(t+r)}{2} = w(t)$, this further reduces to 
$$\frac{w(t)}{r}-\frac{1}{2r^2}(W(t+r)-W(t-r)).$$
Applying $(*)$ to this, it follows that
$$w'(t)=\frac{1}{2r^2}(W(t+r)-W(t-r))-\frac{1}{2r^2}(W(t+r)-W(t-r))=0.$$
Therefore, $w''(t)=0$, as desired.

Then, applying the Leibniz integral rule,
$$w'(t)=\frac{d}{dt}\left(\frac{1}{2r}\int_{t-r}^{t+r}w(x)dx\right)$$
$$=\frac{1}{2r}\left(w(t+r)\frac{d}{d t}(t+r)-w(t-r)\frac{d}{d t}(t-r)+\int_{t-r}^{t+r}\frac{\partial w}{\partial t}dx\right)=\frac{1}{2r}(w(t+r)-w(t-r)).$$
So,
$$w''(t)=\frac{d}{dt}(w'(t))=\frac{d}{dt}\left(\frac{1}{2r}(w(t+r)-w(t-r))\right)$$
$$=\frac{1}{2r}\left(\frac{1}{2r}(w(t+2r)-w(t))-\frac{1}{2r}(w(t)-w(t-2r))\right)$$
\begin{align}
\tag{$*$}
=\frac{1}{2r}\left(\frac{1}{2r}(w(t+2r)-w(t-2r))-\frac{1}{2r}(2w(t))\right).
\end{align}
Then, using the substitution $\frac{w(t-r) + w(t+r)}{2} = w(t)$, it follows that
$$(*)=\frac{1}{2r}\left(\frac{w(t)}{r}-\frac{w(t)}{r}\right)=0,$$
as desired.
