A baseball team plays in a stadium that holds 52000 spectators. With the ticket price at $9 the average attendance has been 21000. When the price dropped to $6, the average attendance rose to 26000.

a) Find the demand function p(x), where x is the number of the spectators. (Assume p(x) is linear.)
b) How should ticket prices be set to maximize revenue?

To find the demand function, we can use the given information that the average attendance changes when the ticket price changes. Since we are assuming the demand function is linear, we can use the formula for a linear equation, y = mx + b.

Let's break down the given information:
Price when average attendance is 21000: $9
Price when average attendance is 26000: $6
Capacity of the stadium: 52000 spectators

Step 1: Find the slope (m) of the demand function:
Using the formula for the slope (m) of a linear equation: m = (y2 - y1) / (x2 - x1)
Substituting the values:
m = (26000 - 21000) / (6 - 9)
m = 5000 / -3
m = -1667

Step 2: Find the y-intercept (b) of the demand function:
Using the point-slope form of a linear equation: y - y1 = m(x - x1)
Substituting one of the given points:
21000 - (-1667)(9) = 21000 + 15003 = 36003

Thus, the demand function p(x) is given by:
p(x) = -1667x + 36003

Moving on to part (b), to maximize revenue, we need to determine the ticket price that will make the product between the ticket price and attendance the highest.

Step 3: Calculate the revenue formula:
Revenue = Ticket Price × Attendance
R = px

Step 4: Substitute the demand function into the revenue formula:
R = (-1667x + 36003)x
R = -1667x^2 + 36003x

Step 5: Find the x-value that maximizes the revenue by finding the vertex of the quadratic equation:
The x-value that maximizes the revenue can be found using the formula: x = -b / (2a)
a = -1667, b = 36003
x = -36003 / (2*(-1667))
x ≈ 10.801

Step 6: Calculate the ticket price at the maximum revenue:
Substitute the x-value back into the demand function:
p(x) = -1667(10.801) + 36003
p ≈ $18.43 (rounded to two decimal places)

Thus, to maximize revenue, the ticket price should be set at approximately $18.43.