I was Reading a book about generating functions, and it said me to do this:
$$\frac{1 - 2x + 2x^2}{(1-x)^2(1-2x)} = \frac{A}{(1-x^2)} + \frac{B}{1-x}+\frac{C}{1-2x}$$
It says:
Multiply both sides by$(1-x^2)$ so:
$$\frac{(1 - 2x + 2x^2)(1-x^2)}{(1-x)^2(1-2x)} = \frac{A(1-x^2)}{(1-x^2)} + \frac{B(1-x^2)}{1-x}+\frac{C(1-x^2)}{1-2x}$$
Then, it says to consider $x=1$, then $A = -1$. Well, I don't know why, since it will result in division by zero.
I’m sure that it said to multiply both sides by $(1-x)^2$, not by $1-x^2$. When you do, you should have
$$\frac{1-2x+2x^2}{1-2x}=A+B(1-x)+\frac{C(1-x^2)}{1-2x}\;.$$
Now let $x=1$ and read off the value of $A$, since the last two terms on the righthand side are $0$.
Added: This is just a shortcut. What you’re really doing is finding the values of $A,B$, and $C$ that make the original equation an identity. After you put everything over the least common denominator, that equation is
$$\frac{1-2x+2x^2}{(1-x)^2(1-2x)}=\frac{A(1-2x)+B(1-x)(1-2x)+C(1-x)^2}{(1-x)^2(1-2x)}\;.\tag{1}$$
Two fractions with the same denominator are identically equal if and only if their numerators are identically equal:
$$1-2x+2x^2=A(1-2x)+B(1-x)(1-2x)+C(1-x)^2\;.\tag{2}$$
Substitute $x=1$ into $(1)$, and you immediately find that $-1=A$, or $A=-1$, and the suggested calculation is essentially the same thing.
Now it’s true that the fractions in $(1)$ are undefined at $x=1$ and $x=\frac12$, while the polynomials in $(2)$ are defined on all of $\Bbb R$. But making the polynomials in $(2)$ identically equal ensures that the fractions in $(1)$ will be equal wherever they are both defined, which is what we want, and making the polynomials identically easy is straightforward. If all else fails, we simply multiply out the righthand side of $(2)$ and equate coefficients to get a linear system of $3$ equations in the unknowns $A,B$, and $C$. Sometimes, however, as in this example, we can shortcut the process a bit by evaluating the polynomials at a point that knocks out all but one of the unknowns.