I found this homework in an old paper written
Let $n\in \mathbb{N}^*$ and $x_1,x_2,\ldots,x_n \in \mathbb{R}$ such that $ \sum_{i=1}^{n}\left|x_{i}\right|=1$ and $\sum_{i=1}^{n}x_{i}=0$
Show that : $\forall i \in [1;n] \quad \left|\dfrac{2}{i}-1-\dfrac{1}{n}\right|\leq 1-\dfrac{1}{n}$
Deduce that : $\left|\sum\limits_{i=1}^n\dfrac{x_i}{i}\right|\leq\dfrac{1}{2}\left(1-\dfrac{1}{n}\right)$
I tried,
we've $ \forall i \in [1,n],$ \begin{align*} 1&\leq i\leq n \\ \dfrac{1}{n}&\leq \dfrac{1}{i}\leq 1\\ \dfrac{2}{n}&\leq \dfrac{2}{i}\leq 2\\ \dfrac{2}{n}-1&\leq \dfrac{2}{i}-1\leq 1\\ \dfrac{2}{n}-1-\dfrac{1}{n}&\leq \dfrac{2}{i}-1-\dfrac{1}{n}\leq 1-\dfrac{1}{n}\\ \dfrac{1}{n}-1&\leq \dfrac{2}{i}-1-\dfrac{1}{n}\leq 1-\dfrac{1}{n}\\ \end{align*}
Could you help me please! More if possible someone tell me which book contains this kind of exercise? any help would be apperciated!
The sequence of inequalities you got is correct. Just observe that $\left | a \right| \le b \iff -b \le a \le b$. So, what you showed is exactly the first part of the exercise.
So, using the first part and multiplying by $|x_i|$ we have that
$$\left| 2\frac{x_i}{i} - x_i\left(1-\frac{1}{n}\right)\right|\le|x_i|\left(1-\frac{1}{n}\right)$$
Summing in $i$ and using that $\sum_{i=1}^n|x_i|=1$
$$\sum_{i=1}^n\left| 2\frac{x_i}{i} - x_i\left(1-\frac{1}{n}\right)\right|\le\sum_{i=1}^n|x_i|\left(1-\frac{1}{n}\right)=\left(1-\frac{1}{n}\right)$$
Now, using the triangle inequality you can pass the sum inside the absolute value preserving the inequality and then use that $\sum x_i =0$ to get
$$\left|\sum_{i=1}^n 2\frac{x_i}{i} - \left(1-\frac{1}{n}\right)\sum_{i=1}^nx_i\right|=2\left|\sum_{i=1}^n \frac{x_i}{i}\right|\le \left(1-\frac{1}{n}\right)$$
Dividing by two you have the answer!