how do you figure out what x is?

5x+1=2x+7

5x+1=2x+7

5x - 2x + 1 - 1 = 2x - 2x + 7 -1

3x = 6
3x/3 = 6/3
x = 2