i have the follwoing values
$\sum_{i=1}^{n} x_{i} = 34$
$\sum_{i=1}^{n} x_{i}^{2} = 262.22$
$a = 3.78$
$n = 9$
and i want to calculate
$$ \sum_{i=1}^{n} (x_{i}-a)^2 $$
i thought this may work
$$ \sum_{i=1}^{n} (x_{i}-a)^2 = \sum_{i=1}^{n} x_{i}^{2} - (2a \sum_{i=1}^{n} x_{i}) + n*a^2$$
the result should be equal to 133,8 but my result was 19,46
Your last term is incorrect, you should be $a^2$ adding each time. So you don't have $a^2$ but rather $$ \sum_{i=1}^n a^2=\cdots $$ which should be simple for you to solve.