The idea is just the same as "partial fractions".

Write

Multiply both sides by to get .

That must be true for all x so choosing two values for x will give you two equations to solve for x.

For example, taking x= 0 gives A- B= 2 and taking x= 1 give 2= 2A.

Or combine "like powers" to write it as . Since that is to be true for all x, you must have A+ B= 0 and A- B= 2.