Just like you did:
X+ 23 = 45
X+ 23- 23 = 45 -23
X = 22.
One quicker way is use move over:
X + 23 = 45 / You are going to solve for X , you have to keep all X's in one side.
So now, you say Move 23 to the other side and change the sign.
X = 45 -23 = 22.
This is equivalent of adding or subtracting same quantity from both sides, and from the fact that subtraction and addition are opposite of each other.
Sometimes you need to solve a variable in terms of the rests.
P = 2L +2w , solve L:
P - 2w = 2L / Keep L in one side, and move rest to the other side, change the sign when moving .
/ one quantity to the other side.
L = P- 2W
2