Let
x = the number of tickets sold at $27 each
y = the number of tickets sold at $40 each
Because 5000 tickets were sold, therefore
x + y = 5000 (1)
Because the revenue generated was $158,400, therefore
27x + 40y = 158400 (2)
From (1),
y = 5000 - x (3)
Substitute (3) into (2).
27x + 40(5000 - x) = 158400
-13x + 200000 = 158400
-13x = -41600
x = 3200
y = 5000 - x = 5000 - 3200 = 1800
Answer:
3200 tickets at $27 each, and
1800 tickets at $40 each