What you need to learn is more general concepts so that each new equation is not totally a puzzle.
To "solve" an equation, for x, say, means to change the equation to the form "x= a number". And you do that by "undoing" whatever is done to x so that it is not by itself on one side of the equation. In this example, -5x= -40, x is not by itself because it is multiplied by -5. The opposite of "multiplication" is "division", so you need to divide by -5. And, of course, anything you do to one side of the equation, you have to do to the other side.
If the problem were x+ 7= 10, x is not "by itself" because it has 7 added to it. The opposite of "add seven" is "subtract 7". Subtract 7 from both sides: x+7- 7= 10- 7 so x= 3.
A little more complicated is when those are combined: 3x- 4= 14. You have to be a little careful here: If you were evaluating the left side, for some x, you would first multiply by 3, then subtract 4. In order to "undo" that we have to do the opposite in the opposite order. That is, we first add 4 to both sides, to get 3x= 18, then divide both sides by 3 to get x= 6.
That's a general property of "inversion". Since we are nearing Christmas, think of it this way. When you wrap a present you (1) put it in a box, (2) seal the box, (3)wrap it with "Christmasy" paper, and (4) tie a bow. To open the present, you have to do the opposite: take it out of the box, unseal the box, unwrap the paper, untie the bow. But, of course, you can't take it out of the box until after you have done the other things: (1) untie the bow, (2)n unwrap the paper, (3) unseal the box, and (4) take it out of the box. That is, do the opposite of each step, in the opposite order.