I have a problem with Mathematica's symbolic manipulations. As an example, consider the following expression:
$$\sum _{i=1}^n -2 x_i \left(-a x_i-b+y_i\right)=0$$
How do I get Mathematica to expand it into this form:
$$-\sum _{i=1}^n x_i y_i +a \sum _{i=1}^n x_i^2+b \sum _{i=1}^n x_i=0$$
What I mean is: what functions do I apply to get the product to expand and the summation operator to distribute?

Expandthe products in the summation and second toDistributethe action ofSumover the addition. Consulting the help pages forExpandandDistributewill answer your question. – whuber Dec 26 '12 at 18:15