I know that partial fraction of this can be written as: $$\frac{3x}{(1+x)(2+x)}=\frac{-3}{1+x}+\frac{6}{2+x}$$ Which can be done in these ways: $$\frac{3x}{(1+x)(2+x)}=\frac{A}{1+x}+\frac{B}{2+x}\implies3x=A(2+x)+B(1+x),\forall\;x$$ And now solving it to get A and B.Also someone told me that write the fraction without that denominator whose coeffecient you want to know and put root of denominator, for e.g.: $$\text{coefficient of $1/(1+x)$ i.e. A}=\frac{3x}{2+x}|_{x+1=0\implies x=-1}=\frac{-3}{1}$$ I know that this is just the first way disguised in an easy form, now what when I need to decompose: $$\frac1{(x-3)(x^2-1)}\text{ or }\frac1{(x-3)(x^2+1)}$$ There exist multiple root of first and root to second doesn't exist.
Now what to do, adopt the first method? Is there any easy method for these?
These are two different beasts, at least on the reals. First, $$\frac1{(x-3)(x^2-1)}=\frac{a}{x-3}+\frac{b}{x-1}+\frac{c}{x+1},$$ for some suitable real numbers $(a,b,c)$. Second, on the reals, $$\frac1{(x-3)(x^2+1)}=\frac{A}{x-3}+\frac{Bx+C}{x^2+1},$$ for some suitable real numbers $(A,B,C)$. But, on the complex numbers, $$\frac1{(x-3)(x^2+1)}=\frac{D}{x-3}+\frac{E}{x+\mathrm i}+\frac{F}{x-\mathrm i}.$$ for some suitable complex numbers $(D,E,F)$. Naturally, $(D,E,F)$ is related to $(A,B,C)$ since $$D=A,\quad E+F=B,\quad \mathrm i\,(F-E)=C,$$ which is enough to show that $D$ is real and that $F=\bar E$ with $E=\frac12(B+\mathrm i\,C)$ and $F=\frac12(B-\mathrm i\,C)$.
Recall that, in full generality, every polynomial on the reals is the product of some factors $(x-a)^n$ and $(x^2+bx+c)^m$ with $b^2\lt4c$ hence every rational fraction with denominator $$\prod_{k}(x-a_k)^{n_k}\cdot\prod_\ell(x^2+b_\ell x+c_\ell)^{m_\ell}$$ is the sum of a polynomial and of some terms $$\frac{A_{k,p}}{(x-a_k)^p}\qquad\text{and}\qquad\frac{B_{\ell,q}x+C_{\ell,q}}{(x^2+b_kx+c_k)^q},$$ for each $k$ and $\ell$, with $1\leqslant p\leqslant n_k$ and $1\leqslant q\leqslant m_\ell$, respectively.