The resulting number after a squence of replacing numbers Write the sequence $\frac{1}{2012},\frac{2}{2012},...,\frac{2011}{2012}$ on blackboard. For each arbitrary pair of numbers $x, y$ in that sequence, we cancel it out and replace them by $x+y-4xy$.
What is the number after the 2010th step?
I feel that we could solve this problem by using invariant principle, but still couldn't solve it.
Please help me.
Thanks.
 A: The invariant you are looking for is
$$P = \prod_{i=1}^n (1-4x_i)$$
if the numbers on the blackboard at a given moment are $x_i, i=1,\ldots,n$.
It's a product of factors that each depend only on one $x_i$, so if you replace $x,y$ on the blackboard with $x+y-4xy$, you replace the original product of 2 factors
$$(1-4x)(1-4y) = 1-4x-4y+16xy$$
by
$$(1-4(x+y-4xy)) = 1-4x-4y+16xy,$$
anything else doesn't change, so the whole product doesn't change.
As has been mentioned in Misha Lavrov's answer, since $\frac14=\frac{503}{2012}$ is  initially on the blackboard, we have $P=0$ and that means the last element remaining will be $\frac14$ as well.

To solve such a problem and find the invariant term, you need to look at the "replacement formula", in this case $(x,y) \mapsto x+y-4xy$. It's commutative and involves the product of $x$ and $y$ as the "highest order term", so the invariant is likely a product. Trying a linear transformation for each term seems appropriate, as $(a+bx)(a+by)=a^2+abx+aby +b^2xy$ leads to the kind if formula we need.
I started with $(4x-1)(4y-1)$, but that lead to a change in the the sign when compared to $4(4x+4y-4xy)-1$, so I reversed the sign for each factor and that got the result.
A: If $x = \frac14$ and $y$ is anything, then $x + y - 4xy = \frac14$. Since $\frac14 = \frac{503}{2012}$ is a number on the blackboard, it will always stay on the blackboard, and so it will be the last number left.
