Well the excercise ask me:
Find a constant $c$ that best approximates $X$ in $L^1$ where $X = 2 \cdot \mathbb{1}_{[0,1/3]} - \mathbb{1}_{[2/3,1]}$.
Well I know that the result is 0 but it is impossible for me to reach obtain $c = 0$.
My idea is the following:
$\text{min}_{c \in \mathbb{R}}$ $\mathbb{E}(|X-c|)$ = $\text{min}_{c \in \mathbb{R}}$ $\int_{0}^{1/3} |2-c|dx + \int_{1/3}^{2/3} |-c|dx + \int_{2/3}^1 |-1-c|dx$ = $\text{min}_{c \in \mathbb{R}}$ $\big{(} \frac{1}{3} (|2-c|+|c|+|1+c|) \big{)}$
And now we can see 4 different cases looking to the value of $c$:
- If $c \in (-\infty,-1] \Longrightarrow \text{min}_{c \in \mathbb{R}} \ \frac{1-3c}{3}$
- If $c \in (-1,0] \Longrightarrow \text{min}_{c \in \mathbb{R}} \ \frac{3-c}{3}$
- If $c \in (0,2] \Longrightarrow \text{min}_{c \in \mathbb{R}} \ \frac{3+c}{3}$
- If $c \in (2,\infty) \Longrightarrow \text{min}_{c \in \mathbb{R}} \ \frac{-1+3c}{3}$
Well from this point I don't know how can I continue, because I have 2 options:
- Aplying the notion of minimum by derivating, but as every function is linear the derivate will be something like $a = 0$ with $a \in \mathbb{R}$, so it will be impossible to obtain $c=0$.
- Supossing that $\mathbb{E}(|X-c|)=0$ and obtaining the value $c$ for each case. But none give $c=0$ (the mean of the values of each case gives c=0, but I don't know if it is the way).
I don't know how can I continue and obtain $c=0$.
You have done the right thing so far. You don't need calculus to minimize $\big{(} \frac{1}{3} (|2-c|+|c|+|1+c|) \big{)}$, just sketch it. The minimum occurs at $c=0$. See, e.g. https://www.wolframalpha.com/input/?i=1%2F3*%28%7C2-c%7C%2B%7Cc%7C%2B%7C1%2Bc%7C%29C for a sketch.