Hardy-Littlewood Maximal Function and Characteristic Functions 
For $f\in L^{1}_{\textrm{loc}}(\mathbb R),$ define the (centered) Hardy-Littlewood maximal function 
  $$
Mf(x)=\sup\limits_{r>0}\frac{1}{2r}\int_{-r}^{r}\vert f(x-t)\vert\,dt$$
  for $x\in\mathbb R.
$
  Fix real numbers $a<b$. Compute $M\text{$\bf1$}_{[a,b]}$ explicitly.

$\textbf{My Attempt & Ideas:}$ Writing down the definition, I have
$$
\begin{align*}M\text{$\bf1$}_{[a,b]}(x)
&=\sup\limits_{r>0}\frac{1}{2r}\int^{r}_{-r}\text{$\bf1$}_{[a,b]}(x-t)dt
=\sup\limits_{r>0}\frac{1}{2r}\int_{x-r}^{x+r}\text{$\bf1$}_{[a,b]}(t)dt\\&=\begin{cases}1&\text{if }x\in(a,b)\\\frac{b-a}{2(b-x)}&\text{if }x\leq a\\\frac{b-a}{2(x-a)}&\text{if }x\geq b\end{cases}\;.
\end{align*}$$
My reasoning for this is that if $x\in(a,b)$ I can choose $r$ such that $(x-r,x+r)\subset[a,b]$.
However, if $x<a$ then $(x-r,x+r)\not\subset(a,b)$ implies that $\int_{x-r}^{x+r}\text{$\bf1$}_{[a,b]}(t)dt=0,$ and if $(x-r,x+r)\subset(a,b)$, then the value of $r$ that gives the expression of the supremum is $r=b-x$ and similarly if $x>b$, the value that gives the supremum above is $r=x-a$.

I am not confident about my reasoning, as I am sure it is not rigorous enough. Any hints on how to proceed in a more precise manner or is the calculation above actually on the right track?
Any feedback is much appreciated. 
Thank you for your time.
 A: One may gain more insights by writing the maximal operator in a different way. By change of variable, 
$$
Mf(x)=\sup\limits_{r>0}A_r(f)
$$
where $A_r(f)$ is the average of the function $|f|$ over the interval $B_x(r)=(x-r,x+r)$:
$$
A_r(f)=\frac{1}{2r}\int_{x-r}^{x+r}\vert f(t)\vert\;dt\;.
$$
One can then focus on the case $[a,b]=[0,1]$ since the general one is not very different. 
When $f=1_{[0,1]}$, the average is given by
$$
A_r(f)=\frac{|B_x(r)\cap (0,1)|}{|B_x(r)|}\tag{1}
$$
namely, the ratio of the length of the intersection $B_x(r)\cap (0,1)$ and the length of $B_x(r)$. One can immediately see that this quantity is at most $1$. 
To find the maximal value (1), it is helpful to draw a picture. There are several cases.


*

*When $x\in(0,1)$, the average $A_r(f)$ achieves its maximal value $1$ whenever $B_x(r)\subset (0,1)$.

*When $x=0$ or $x=1$, the length of $B_x(r)\cap (0,1)$ is at most a half of $B_x(r)$, which gives the maximal value of $A_r(f)$ as $\dfrac12$ in this case. 

*The cases when $x<0$ and $x>1$ are similar. Let us consider $x>1$. Again, drawing a picture will be very helpful. 


*

*If $r< x-1$, then the numerator in (1) is zero. So to achieve the maximum, we must have $r\ge x-1$. 

*On the other hand, if $r> x-0$, the numerator of (1) remains the same and the denominator will increase if one raises the value of $r$. So the maximal of $A_r(f)$ must be achieved for $x-1\leq r\leq x-0$. Explicitly, one can write
$$
A_r(f) = \frac{r-(x-1)}{2r} = \frac{1}{2}-\frac{x-1}{2r},\quad r\in[x-0,x-1]\;,
$$
which implies that the maximal is at $r=x-0$.


