How find this maximum of $f(n)$ let $x_{i}\in (0,1),i=1,2,\cdots,n,x_{n+1}=x_{1}$,give for any positive integer numbets $n$, find 
$$f(n)=\max{\sum_{i=1}^{n}x_{i}(1-x_{i+1})}$$
find the $f(n)$
it is easy find when $n=1$, then 
$$f(1)=\max{x_{1}(1-x_{1})}=\dfrac{1}{4}$$
when $n=2$
$$f(2)=\max{\left(x_{1}(1-x_{2}),x_{2}(1-x_{1})\right)}\le\dfrac{1}{4}?$$
$$\cdots\cdots\cdots\cdots\cdots\cdots$$
so I can't any work,Thank you everyone
 A: Hint: Let 
$$g(x_1,\dots,x_n):=\sum_{i=1}^{n} x_{i} (1-x_{i+1} ). $$
We want to compute the gradient $\nabla g$ of $g$ at $(x_1,\dots,x_n)\in (0,1)^n$ to find the extrema of $g$.
To do so, we start by summarizing the following facts:


*

*the variable $x_1$ appears in $g$ only in the monomials $x_1(1-x_2)$ and $x_n(1-x_1)$.

*the variable $x_n$ appears in $g$ only in the monomials $x_{n-1}(1-x_n)$ and $x_n(1-x_1)$.

*Any other variable $x_i$, with $2\leq i \leq n-1$ appears in $g$ only in the monomials
$x_{i-1}(1-x_i)$ and $x_i(1-x_{i+1})$.


From this it follows that
$$\frac{\partial g}{\partial x_1}=1-x_2-x_n, $$
$$\frac{\partial g}{\partial x_n}=-x_{n-1}+(1-x_1), $$
and
$$ \frac{\partial g}{\partial x_i}=-x_{i-1}+(1-x_{i+1}), $$
for all $2\leq i \leq n-1$. 
A: If you want "analytic approach" then the fastest way is to note that the function
$f(x_1,x_2,.....x_n)=\sum_{i=1}^nx_i-\sum_{i=1}^nx_ix_{i+1}$ is linear with respect to each variable $x_i$ for $n\ge 2.$ Since for linear function the maximum is always attained at the end point of the interval, then all your $x_i'$ are either $0$ or $1.$ 
