The 'brute force' method of trying every number in turn works eventually, but you don't get through enough questions in the exam time available that way. Always better to understand how to do sonmething & why it works.
The general rule is to multiply one equation by whatever it needs so that it either has the same number of x as the other equation, or the same number of y.
Once you have done that you can subtract the other original equation from the one you just calculated, to get an equation with just a single unknown variable, which is trivial to solve.
Having worked out one variable you just substitue for it in one of the equations and solving for the other unknown becomes trivial.
If I remember correctly that is one method (the easier) called elimination. We were taught how to do that after we had mastered the harder method, called substitution, whereby in one of the equations y would be expressed in terms of x then substituted into the other equation.
Conceptually it's a little harder to see why it works, but mathematically it's always easier to use Cramer's rule (method of determinants) to solve these: