In order to be able to find an antiderivative, I have been taught to decompose fractions by first observing an identity, like $$\frac{2x+1}{(3x-2)(x+1)} \equiv \frac{A}{3x-2}+\frac{B}{x+1}$$ wherever the function is defined.
Then I would expand and substitute, like so: $$A(x+1)+B(3x-2) \equiv 2x+1$$ letting $x=-1$: $$-5B=-1 \implies B=\frac{1}{5}$$ and then letting $x=\frac{2}{3}$: $$\frac{5}{3}A=\frac{7}{3} \implies A= \frac{7}{5}$$
Why are these substitutions justified? In both cases the original function is undefined for these $x$ values as the denominator would be zero - does this mean my claim "wherever the function is defined" is unnecessary? I can't see why this gives the right answer, but it does (as I can verify by matching coefficients instead of substituting)!