Finding partial fractions involving complex numbers: express $h(z) = \frac{2z + 4i}{z^2 + 2z + 2}$ as partial fractions I'm attempting the following problem in the context of complex analysis:

Express $h(z) = \dfrac{2z + 4i}{z^2 + 2z + 2}$ as partial fractions.

I got $\dfrac{2z + 4i}{z^2 + 2z + 2} = \dfrac{2z + 4i}{(z + 1 + i)(z + 1 - i)}$
$= \dfrac{A}{z + 1 + I} + \dfrac{B}{z + 1 - I}$
$\implies 2z + 4i = (A+B)z + (A + B) + i(B - A)$
$\therefore A + B = 2$ AND $B - A = 4$ (AND $A + B = 0$????)
$\therefore$ (If we exclude $A + B = 0$) $B = 3$ AND $A = -1$
But we also had that $A + B = 0$ above, which is where my confusion comes from.
If I then proceed with what I've done, I get $\dfrac{2z + 4i}{(z + 1 + i)(z + 1 - i)} = \dfrac{-1}{z + 1 + i} + \dfrac{3}{z + 1 - I}$
$= \dfrac{2z + 2 + 4i}{(z + 1 + i)(z + 1 - i)}$, which is obviously false.
I've only just started doing partial fraction decomposition with complex numbers, so I'm unfamiliar with the subtleties relative to partial fraction decomposition with real numbers. As I flagged above, we cannot have both $A + B = 2$ and $A + B = 0$, so I'm unsure of why my reasoning is erroneous and what the correct reasoning is?
I would greatly appreciate it if people could please take the time to clarify this by explaining why my reasoning is erroneous and what the correct reasoning/procedure is.
 A: Write $Ai+B$ (where you wrote $A$) and $Ci + D$ (where you wrote $B$) solve for this in the same way. You should obtain $A = 1$; $B = 3$; $C = -1$; $D = -1$.
And the final form should be $\frac{i+3}{z+1-i} + \frac{-i-1}{z+1+i}$  
A: I upvoted the previous answer (because it was good), but I am presenting my own answer to illustrate two different methods of doing it.
The first: solving simultaneous equations. Note that you don't have to put everything in the form $C+ Di$, etc. You can solve it by leaving just two variables as you started out doing.
Note that $A$ and $B$ (denoted as per the original question) are complex.
After expansion (by cross multiplying) and equating numerators, you get:
$Az + A - Ai + Bz + B + Bi = 2z + 4i$.
Now, note the terms with $z$ dependence. These are the terms you must equate of the LHS and RHS. They have to be equal because if they weren't then the equality wouldn't hold for all possible values of $z$.
So $Az + Bz = 2z$ or $A + B = 2$, which is what you got (correctly) for your first equation.
Now consider the $z$ independent terms. You have $A - Ai + B + Bi = 4i$ or, equivalently, $(A+B) + (B-A)i = 4i$.
You cannot equate real and imaginary parts at this stage (as you had originally attempted) as $A$ and $B$ are both complex numbers.
Instead, substitute the first equation into the second to eliminate the $(A+B)$ term to get:
$2 + (B-A)i = 4i$.
Solving for $(B-A)$,
$(B-A)i = -2 + 4i$
$(B-A) = 4 + 2i$
Now you can solve simultaneously:
$A + B = 2$
and
$B - A = 4 + 2i$
the usual way.
Add them to get: $2B = 6 + 2i$, which gives $B = 3 + i$. By back substitution, you immediately get $A = - (1+i)$.
The second method I will present uses the Heaviside Cover-Up Method.
You have:
$$\frac{2z + 4i}{(z-(-1-i))(z - (-1 + i)} = \frac{A}{(z-(-1-i))} + \frac{B}{(z - (-1 + i))}$$
You can use the rule immediately. Or you can consider what happens when you multiply both sides by each of the denominators on the RHS.
As an illustration, multiply throughout by $(z-(-1-i))$.
You will get:
$$\frac{2z + 4i}{z - (-1 + i)} = A + \frac{B(z-(-1-i))}{(z - (-1 + i))}$$
Setting $z = (-1-i)$ will immediately cause the second term on the RHS to vanish and get you:
$$A = \frac{2(-1-i) + 4i}{(-1-i) - (-1 + i)} = \frac{-2 + 2i}{-2i} = -(1+i)$$
You can similarly solve for $B$.
