Partial fractions decomposition of ${\frac{2x}{(x+2)^2}}$ Express in partial fraction form: $\displaystyle{\frac{2x}{(x+2)^2}}$
I think is $\displaystyle{\frac{2x}{(x+2)^{2}} = \frac{A}{x+2}+\frac{B}{(x+2)^2}}$
However when identifying $A$ and $B$, I'm not sure how to calculate A.
E.g.  $$2x = A\cdot (x+2) + B$$
Substitute $x=-2$    
$2\cdot(-2)$ = $A\cdot (2-2) +B$
$-4 = B$
In other questions there is always another factor to multiply by at this stage.

There is a nice method for rational functions that only have one repeated factor at the denominator: let the fraction be $f(x)=\frac{N(x)}{D(x)}$ where $D(x)=d(x)^k$.
The general form of the partial fraction decomposition is 
$$\displaystyle f(x)=\frac{a_1(x)}{d(x)}+\frac{a_2(x)}{d(x)^2}+\dots+\frac{a_k(x)}{d(x)^k}$$
Then, if you perform the division of $N(x)$ by $d(x)$, you can write $f(x)$ as
$$\displaystyle f(x)=q(x)d(x)+r_1(x)$$
where $\deg(r_1)<\deg(d)$. We then got 
$$\displaystyle f(x)=\frac{q(x)d(x)+r_1(x)}{d(x)}=\frac{r_1(x)}{d(x)}+\frac{q(x)}{d(x)^{k-1}}$$
so $r_1$ is actually $a_1$. By repeating the process with $q$, we can get all the other functions $a_2$,...,$a_k$.
Example with $\frac{2x}{(x+2)^2}=\frac{A}{x+2}+\frac{B}{(x+2)^2}$: $2x=2(x+2)-4$, so $A=-4$ and $q(x)=2$. As $q(x)=0(x+2)+2$, we obviously have $B=2$. We obtain 
$$f(x)=\frac{2(x+2)-4}{(x+2)^2}=\frac{2}{(x+2)}+\frac{-4}{(x+2)^2}$$
When $d(x)$ has degree $1$, we can use Synthetic Division to perform the division, so it is very fast.
