what are the rules for having variables on both sides of the equation?

-2y+5=-4y+7

I know the answer..i just cant understand why?

thx