determine the constants A and B so that the similarity becomes an identity

12=A(x-1)+B(5+x)

The answers are

A=-2

B=2

My friend tried to explain it to me but i did not understand!!

Ax - A + 5B + Bx = 12

For this to be true for any value of x, the x's must cancel each other out, so:

A + B = 0

A = -B

That will leave us with:

-A + 5B = 12

B + 5B = 12

6B = 12

B = 12/6

B = 2

A = -2