Let a = adult tickets, s = student tickets. We are going to use these to set up a system of equations.
a + s = 642
a - s = 58
Now we combine like terms. The s variables cancel out:
2a = 700
a = 350
Now we plug back in.
350 + s = 642
Subtract 350 from both sides.
s = 292
There were 350 adult tickets sold and 292 student tickets sold.