Partial fraction decomposition $\frac{1}{(x-y)^2}\frac{1}{x^2}$ I want to integrate $$\frac{1}{(x-y)^2}\frac{1}{x^2}$$ with respect to $x$.
I know that I have to apply partial fraction decomposition but which ansatz do I have to make to arrive at
$$\frac{1}{(x-y)^2}\frac{1}{x^2}=-\frac{2}{y^3(x-y)}+\frac{1}{y^2(x-y)^2}+\frac{2}{y^3x}+\frac{1}{y^2x^2}$$
 A: Here is the (comparatively) fast way to determine the partial fraction decomposition, using the poles of the fraction. To make the computation clearer, I'll denote  temporarily $y$ as  the constant $a$.
The decomposition has the form
$$\frac 1{x^2(x-a)^2}=\frac Ax+\frac B{x^2}+\frac C{x-a}+\frac D{(x-a)^2}.\tag 1$$
Multiplying both sides by $x^2(x-a)^2$, you obtain
$$1=Ax(x-a)^2+B(x-a)^2+Cx^2(x-a)+Dx^2.$$
Setting $x=0$ yields instantly $\;B=\dfrac1{a^2}$. Similarly, setting $x=a$ yields $D=\dfrac1{a^2}$.
To obtain the last two coefficients, multiply both sides of $(1)$ by $x$ and let $x\to\infty$: you obtain the relation $\:A+C=0$.
We need a last equation to determine $A$ & $C$. The best way seems to let $x=\frac a2$ (the arithmetic mean of the poles), which yields the relation
$$A-C=\frac 4{a^3},\quad\text{whence}\quad A=\frac 2{a^3},\enspace C=-\frac 2{a^3}.$$
Note:
If the fraction has a pole of higher order, it is generaly still faster to use division of polynomials by increasing degrees.
A: Treat $y$ as a constant. So in the denominator we have $2$ terms  $x$ and $(x-y)$, both raised to the power $2$.
So, let $$\frac{1}{(x-y)^2x^2} = \left(\frac{a}{x}  + \frac{b}{x^2}\right) + \left(\frac{c}{x-y}+\frac{d}{(x-y)^2}\right)$$
By method of inspection, we can easily get $b$ and $d$.
$x= 0 \Rightarrow b = \frac{1}{(0-y)^2} = \frac{1}{y^2}$
$x =y \Rightarrow d = \frac{1}{y^2}$
Now you have,
$\frac{1}{(x-y)^2x^2} = \left(\frac{a}{x}  + \frac{1}{y^2x^2}\right) + \left(\frac{c}{x-y}+\frac{1}{y^2(x-y)^2}\right)$
$\Rightarrow1 = ax(x-y)^2 + c(x-y)x^2 + \frac{(x-y)^2+x^2}{y^2}$
Let us consider only coefficients of $x^2$ and $x^3$
$ (a+c) = 0 $ and $(-2ay-cy+\frac{2}{y^2}) = 0$
Using $c = -a , -ay + \frac{2}{y^2} = 0 \Rightarrow a= \frac{2}{y^3}$ and $c= -\frac{2}{y^3}$
Thus,

$$\frac{1}{(x-y)^2x^2} = \left(\frac{2}{y^3x}  + \frac{1}{y^2x^2}\right) + \left(\frac{-2}{y^3(x-y)}+\frac{1}{y^2(x-y)^2}\right)$$

