Ok so to solve for x you need to isolate the variable. Usually, when solving an equation the first step would be to get all of the variables of x on the same side but this equation is already set up that way. Since 3x and 8x are both of the variable x you can simply subtract them and you would be left with:
-5x=-40
Now what you want to do is completely isolate x to get it by itself in which you would divide both sides by -5. Remember *When solving an equation you must do the same math to both sides.
-5x/-5=-40/-5
x=8
So the answer would then be 8. Also remember you can always check to see if your equation is correct by plugging your answer into the original equation