Let x represent the number of advanced tickets
Let y represnet the number of same-day tickets
Sum of the tickets is 40, i.e
For the total amount made for ticket sold
Where
One advanced tickets, x, cost $30
One same-day tickets, x, cost $20
Solving simultaneously to find the number of advanced and same-day tickets sold
Substitute 40-y for x into equation (2)
Substitute 25 for y into equation (3)
Hence, the number of advanced tcikets, x, sold is 15
And the number of same-day tickets, y, sold is 25