Sigma sign issue
In the answer key to one of the problems, the following step takes place
$f(x)=\sum_{k=1}^n\left(a_kx^2-2x+\frac{1}{a_k}\right)=(a_1+a_2+...+a_n)x^2-2nx+\left(\frac{1}{a_1}+\frac{1}{a_2}+...+\frac{1}{a_n}\right)$
Why does $\sum_{k=1}^n2x=2nx$ not just $2x$ because isn't there no $k$ to apply the sign onto?
$$ \sum_{k=1}^n2x = \underbrace{2x + 2x + 2x + \cdots + 2x}_{\text{$n$ times}}. $$