Easy partial fraction decomposition with complex numbers There is an easy method to perform a partial fraction decomposition - described here, under the "Repeated Real Roots" title, for the coefficient A2.
The problem is - this method doesn't work in some cases, for example:
$$
\frac{1}{(2 + j \omega)^2 \, (4 + j \omega)}
 = \frac{A}{2 + j \omega}
 + \frac{B}{(2 + j \omega)^2}
 + \frac{C}{4 + j \omega}
$$
The coefficients B,C get their proper value:
$$
B = \frac{1}{4 + j \omega} \Big|_{\omega=2j} = \frac 12
$$
$$
C = \frac{1}{(2 + j \omega)^2} \Big|_{\omega=4j} = \frac 14
$$
But the coefficient A get a false value:
$$
A = \frac{d}{d \omega} \left( \frac{1}{4 + j \omega} \right)\Big|_{\omega=2j}
 = \frac{-j}{4}
$$
The true/proper value for A is $-\frac 14$.
I wonder what is the general formula for this kind of elegant/quick/easy trick to find the coefficients during partial fraction decomposition?
 A: The partial fraction expansion is
$$\frac{1}{(2+j\omega)^2(4+j\omega)}=\frac{A}{2+j\omega}+\frac{B}{(2+j\omega)^2}+\frac{C}{4+j\omega}\tag 1$$
To find $C$, we multiply both sides of $(1)$ by $4+j\omega$ and take the limit as $j\omega \to -4$.  Proceeding, we find 
$$\begin{align}
\lim_{j\omega \to -4}\frac{(4+j\omega)}{(2+j\omega)^2(4+j\omega)}&=\frac14\\\\
&=\lim_{j\omega \to -4}\left(\frac{A(4+j\omega)}{2+j\omega}+\frac{B(4+j\omega)}{(2+j\omega)^2}+\frac{C(4+j\omega)}{4+j\omega}\right)\\\\
&=C
\end{align}$$
To find $B$ , we multiply both sides of $(1)$ by $(2+j\omega)^2$ and  take the limit as $j\omega \to -2$.  Proceeding, we find 
$$\begin{align}
\lim_{j\omega \to -2}\frac{(2+j\omega)^2}{(2+j\omega)^2(4+j\omega)}&=\frac12\\\\
&=\lim_{j\omega \to -2}\left(\frac{A(2+j\omega)^2}{2+j\omega}+\frac{B(2+j\omega)^2}{(2+j\omega)^2}+\frac{C(2+j\omega)^2}{4+j\omega}\right)\\\\
&=B
\end{align}$$
To find $A$ , we multiply both sides of $(1)$ by $(2+j\omega)^2$, take a derivative with respect to $j\omega$, and  take the limit as $j\omega \to -2$.  Proceeding, we find 
$$\begin{align}
\lim_{j\omega \to -2}\frac{d}{d(j\omega)}\left(\frac{(2+j\omega)^2}{(2+j\omega)^2(4+j\omega)}\right)&=-\frac14\\\\
&=\lim_{j\omega \to -2}\frac{d}{d(j\omega)}\left(\frac{A(2+j\omega)^2}{2+j\omega}+\frac{B(2+j\omega)^2}{(2+j\omega)^2}+\frac{C(2+j\omega)^2}{4+j\omega}\right)\\\\
&=A
\end{align}$$
A: suppose that you want to decompose $\frac{P(x)}{Q(x) (x-\rho)^n}$, with $Q(\rho) \ne 0$ :
$$\frac{P(x)}{Q(x) (x-\rho)^n} - \frac{a}{(x-\rho)^n} = \frac{P(x)  - a Q(x) }{Q(x) (x-\rho)^n} = \frac{(x-\rho) S(x) + b }{Q(x) (x-\rho)^n} = \frac{S(x)}{Q(x) (x-\rho)^{n-1}} + \frac{b }{Q(x) (x-\rho)^n}$$
($S(x)$ and $b$ are obtained by Euclidean division of  $P(x)  - a Q(x)$ by $(x-\rho)$)
the target is to choose  $a$ such that $b= 0$ : hence choosing $a$ such that the polynomial $P(x)  - a Q(x)$ vanishes at $x = \rho$, which is always possible since $Q(\rho) \ne 0$ :
$$a = \frac{P(\rho)}{Q(\rho)}$$
hence, by induction we see that we can decompose any rational function :
$$\frac{P(x)}{\prod_i (x-\rho_i)^{e_i}} = R(x) + \sum_i \sum_{k=1}^{e_i} \frac{a_{i,k}}{(x-\rho_i)^{k}}$$
A: Here are the mechanics of the trick.  Let's multiply your equation by $4+j\omega$:
$$
\frac{1}{(2 + j \omega)^2 \, }
 = \frac{(4 + j \omega)A}{2 + j \omega}
 + \frac{(4 + j \omega)B}{(2 + j \omega)^2}
 + C.
$$
Now things nicely fall out if we look at $\omega = 4j$:
$$\frac{1}{(2-4)^2} = C.$$
But ... the left side is just the original expression with the $(4+j\omega)$ "covered up" (since we multiplied everything by $4+j\omega$).  Evaluating this covered-up expression at the root we covered up gives the coefficient.
Things don't all cancel away with a repeated root.  Multiply by $2 + j\omega$:
$$
\frac{1}{(2 + j \omega) \, (4 + j \omega)}
 = A
 + \frac{B}{(2 + j \omega)}
 + \frac{(2 + j \omega)C}{4 + j \omega}.
$$
There's still the $2 + j \omega$ in the denominator under $B$ so the "trick" fails and we have to find it some other way.
A: Suppose $f(z)$ is a rational function with poles at $z = z_n$ in the complex plane. Then consider the Laurent expansion of $f(z)$ around each pole (a Laurent expansion is the generalization of the Taylor expansion where you now include negative powers). Let $g_n(z)$ denote the sum of all the singular terms of the expansion of $f(z)$ around $z = z_n$. Then consider the function $h(z)$ defined as:
$$h(z) = f(z) - \sum_n g_n(z)$$
Clearly $h(z)$ is then also a rational function, but since we've subtracted all the singularities from f(z), the function $h(z)$ only has removable singularities, so, it is in fact a polynomial. If $f(z)$ has a numerator with a lower degree than its denominator, then we see that $h(z)$ tends t zero at infinity, which means that $h(z)$ is actually zero everywhere. In that case we thus have:
$$f(z) = \sum_n g_n(z)$$
If the degree of the numerator is not smaller than the degree of the denominator, then you can still use this formula if you interpret the point at infinity as a singularity. You then include the expansion around infinity where you regard singular terms as terms with positive powers of $z$.
In this particular case we may cut some corners and obtain the partial fraction expansion with hardly any computations. We have:
$$f(z) = \frac{1}{(2+z)^2 (4+z)}$$
Obviously, the coefficient of $\frac{1}{z+4}$ is $\lim_{z\to -4}(z+4)f(z) = \frac{1}{4}$. To find the part of the partial fraction expansion involving powers of $\frac{1}{z+2}$, observe that $f(z)$ for large $z$ tends to zero as $\frac{1}{z^3}$. This means that the $\frac{1}{z+2}$ term must have a coefficient of $-\frac{1}{4}$. And the coefficient of $\frac{1}{(z+2)^2}$ is obviously given by $\lim_{z\to -2}(z+2)^2f(z) = \frac{1}{2}$
So. without having had to do much work, we have obtained the result:
$$f(z) = \frac{1}{2} \frac{1}{(z+2)^2} - \frac{1}{4} \frac{1}{z+2} + \frac{1}{4}\frac{1}{z+4}$$
