The answer is: The mathematical operation that you are trying to undo when you factor a polynomial is called "Distributive property".
An example of the Distributive property is shown below:
(x-1)(x+2)=0
x²+2x-x-2=0
x²+x-2=0
If you have the polynomial x²+x=2 and you want to factor it, you obtain:
x²+x=2
x²+x-2=0
(x-1)(x+2)=0
x1=1
x2=-2
This is how you undo the distributive property and it is a perfect method to simplifying equations.