So I understand why this is true: $$ \frac{x}{(x+2)(x+1)} = \frac{A}{x+2} + \frac{B}{x+1} $$
But there's a special rule in partial fraction that I just couldn't get it. When you have a term that is squared, I must add another fraction with the term squared in the denominator: $$ \frac{x}{(x+2)(x+1)^2} = \frac{A}{x+2} + \frac{B}{x+1} + \frac{C}{(x+1)^2} $$
Why? Shouldn't $(x+1)^2$ be treated like $(x+1)(x+1)$ and do this instead?: $$ \frac{x}{(x+2)(x+1)^2} = \frac{A}{x+2} + \frac{B}{x+1} + \frac{C}{x+1} $$
Why is the extra square needed?
To visualize it easier, I have tried to substitute terms with letters.
$$ \frac{x}{(x+2)(x+1)}\\ \text{Let x+2 be X, x+1 be Y:}\\ = \frac{A}{X} + \frac{B}{Y}\\ = \frac{AY+BX}{XY} $$
And I can do the same thing for this:
$$ \frac{x}{(x+2)(x+1)^2} = \frac{x}{(x+2)(x+1)(x+1)}\\ \text{Let x+2 be X, x+1 be Y, x+1 be Z:}\\ = \frac{A}{X} + \frac{B}{Y} + \frac{C}{Z}\\ = \frac{AYZ + BXZ + CXY}{XYZ}\\ \\ \frac{x}{(x+2)(x+1)(x+1)} = \frac{AYZ + BXZ + CXY}{XYZ}\\ x = AYZ + BXZ + CXY $$
I don't see any problem in this.