What is the sum of the roots of $x^2-2x+1=0$? 
Find the sum of the roots of below equation $$x^2-2x+1=0$$

I know this a very straightforward problem, but I wanted to clarify a point here.
So my textbook has a formula for finding the sum of the roots of quadratic equations: $$x_1+x_2=\frac{-b}{a}$$
From the formula the answer is $2$. 
But I know that $x^2-2x+1=(x-1)^2=0\Rightarrow x=1$. Then the sum is $1$.
Which one is the answer? Do we count the same root twice?
 A: The question has two possible answers, either $1$ or $2$. That's because it hasn't been clearly specified whether roots are to be counted with multiplicity.
At this stage, you have to start reading the mind of whoever wrote the exercise. The best case is if they have an example with this exact thing happening, and you can extrapolate from there what they would expect you to answer. Second best is to read very carefully at the point where the formula $\frac{-b}a$ is introduced to see whether it's commented on there.
If you can't find any clear evidence one way or the other, the standard way to handle this on a test or homework assignment would be to clearly state your interpretation, and then give your answer (with proper justification, of course).
A: The formula for the sum of roots is achieved using the Quadratic Formula. Notice: $$\frac{-b}{2a}+\frac{\sqrt{b^2-4ac}}{2a}+\frac{-b}{2a}-\frac{\sqrt{b^2-4ac}}{2a}=-\frac{2b}{2a}=-\frac ba$$
Duplicate roots happen because the discriminant is $0$ (and thus, the $\pm$ doesn't come into play). However, the formula still outs them seperately, so both must be incorporated for the sum of roots.
A: Yes: in this formula, you always consider that the equations has two solutions, but they can be the same one (your solution has multiplicity 2). So you have the solutions $x_1 = 1$ and $x_2 = 1$. The sum is then 2.
A: In general, one has $x^2+ax+b = (x-\alpha)(x-\beta)$, where $\alpha,\beta$ are the zeros in some extension field.
By comparing coefficients, $a= -(\alpha+\beta)$ and $b = \alpha\beta$.
A: 
So my textbook has a formula for finding the sum of the roots of quadratic equations: $$x_1+x_2=\frac{-b}{a}$$
  From the formula the answer is $2$. 

This formula for the sum of the roots of a quadratic equation doesn't require that the roots are distinct. I agree that it is a bit ambiguous because I would say that the equation
$$x^2-2x+1= 0 \iff (x-1)^2 = 0$$has one root, namely $x=1$. The multiplicity however is 2 and it is sometimes called a double root. In the formula above, you have $x_1=x_2=1$, and that explains the sum being 2.
A: Yes, you count the same root twice since it repeats:
$$(x-1)^2 = 0 \iff (x-1)(x-1) = 0$$
$$x_1 = 1; \quad x_2 = 1$$
$$x_1+x_2 = 2$$
In other words, $x = 1$ is a zero of multiplicity $2$, meaning it occurs twice.
A: 
Firstly, you need to add an equality sign in your quadratic expression to make it an equation i.e
$x^2+1-2x=0$
As you know it can be written as,
$(x-1)^2=0$
Which is,
$(x-1)(x-1)=0$
Which means x has two roots, $x=1$ and $x=1$. On summation of roots, i.e $1+1=2$, which is same as that you found from formula.
Hope this helps.

A: The proof of the Vieta coefficient identities does not require that the roots are distinct. So the identities remain true even for multiple roots, e.g. the extreme case
$\ \ \ (x-r)^{\large n} =\, x^{\large n} - \color{#c00}{nr}\, x^{\large n-1} + \cdots + (-r)^{\large n}$ 
which has root sum $\,\color{#c00}{nr}$ because the root $r$ has multiplicty $n$. 
So applying the Vieta formulas automatically accounts for root multiplicity, and one must keep that in mind when applying them.
