I was reading a document , where I stucked in figuring out this equation.
$f(k)= k^2-nk+\frac{n^2 - n}{2}$. This is a quadratic function of $k$. It is minimized when $k=\frac{n}{2}$ (the $k$ coordinate of the vertex of the parabola that is the graph of this function) and maximized at the endpoints of the domain, namely $k=1$ and $k=n-1$.
please explain how it is ??
Hint: $$f(k) = \left(k-\frac{n}2\right)^2+\frac{n^2-2n}4$$ So as the distance of $k$ from $\dfrac{n}2$ increases, the function increases.