Congratulations! You’ve just been hired as an operations consultant for Gamma Airlines. The reason? You wrote this letter to the Gamma president, and she thought you might be a good person to work through the issues:

Dear Gamma Airlines:

I have been flying on your airline for many years, typically on the route from MSP to DCA. You offer a good amount of service and your prices are reasonable ... sometimes.

I do not understand why the price of a ticket varies so much from month to month. Sometimes I have flown for the very reasonable price of $150 round-trip. But other times, for no clear reason, I’ve had to pay $750 for the same flight. Sometimes the fares change dramatically depending on the exact time of the flight (6:30am is half the cost of the 8:30am flight). I have even noticed that the prices for the same flight differ depending on when I look at your web site.

Often, I have to stop in DTW on my way to DCA. That’s inconvenient, but it does reduce the fair a lot. Why? Doesn’t it cost you more to stop in DTW? And, I notice, that on the rare occasions when I want to end up in DTW, the fares are much higher than it would cost me to stop in DTW on the way to DCA. This makes no sense.

Why should the price vary so much? Wouldn’t it be simpler just to charge everyone the same amount for every flight? I bet you would save money on administrative costs.

Sincerely,

A loyal, but frustrated customer.

What particularly motivated the Gamma Airlines president to hire you is that she faces an investigation from a Senator who thinks that charging different prices is unethical and a conspiracy to lower service quality while increasing prices. The Gamma president thinks you might be able to respond to the Senator in simple terms.

You accept the job, but are worried because you don’t know anything about economics. It’s too late to take a proper course in economics, but your roommate is an econ major and you’ve talked about it from time to time. You crack open your roommate’s micro-economics textbook to the section on revenue optimization.

There, you see an equation P(Q) = 500 - 0.5Q and a corresponding graph:

You read that the graph shows how many widgets will be bought by consumers — that’s Q. Of course, the demand Q is related to the price, P. The graph says that at high prices, Q will be very small. At low prices, Q is high.

The book goes on to explain that the revenue collected by the widget corporation is Q × P — the quantity sold times the price of each widget. The thing to keep in mind is that everyone buying a widget is paying the same price, even those who would have been willing to pay more. (And that’s what you are asking Gamma Airlines to do: charge everybody the same price.)

That’s easy enough to sort through: the total revenue is therefore

You know that a sensible company will set the quantity that they make to maximize their profits. If it cost nothing to make widgets, then the revenue would be maximized at Q = 500 — corresponding to the top of the curve.

You’re surprised to read that it’s not quite so simple. It costs something to make a widget: the book example gives the cost at $200 per widget. So the profit is not the same as revenue. Instead, it’s

It looks like the maximum profit comes when Q is about 300 widgets.

Exercise 1. Find out exactly the Q that maximizes profit. To do this, find the derivative of profit with respect to Q. At the value of Q that maximizes profit, this derivative will be zero, for the obvious reason that the profit curve is flat — that is, the value of the slope is zero — at the maximum. So, set up and solve for Q the relationship Profit = 0.

What value did you get for the Q that maximizes profit?

294.3 298.7 300.0 301.5

Now, do much the same thing using the computer. You should get the same answer. The point of doing it is to see how the computer works. Eventually, you’ll move on to a problem where you need the computer to do it.

- 1.
- Define price and profit functions, thus:
- 2.
- Make a graph of profit.deriv and look for the q at which it goes to zero. You may need to zoom in around the zero crossing to find it precisely — do that by setting the lower and upper limits of the plotting x scale as needed.
- 3.
- When you find the Q at which profit.deriv goes to zero, plug in that
optimal Q into the profit.fun in order to find out what the profit will
be.
Enter the commands you used to graph the profit.deriv and also the command to evaluate profit.fun at the optimal Q that you found.

The economics textbook goes on. It says that managers look at the “marginal revenue” in order to determine the most profitable amount Q to produce. The technique — which is mathematically equivalent to what you just did, but more flexible for dealing with different production costs — goes like this:

- 1.
- Find the “marginal revenue” function. This is just the derivative with respect to Q of the total revenue function.
- 2.
- Then find the value of Q where the marginal revenue equals the cost of production.

Exercise 2. Try this out. You can do it for this simple example using algebra. In this exercise, you will do that. But then you’ll solve the problem again using the computer D operator. Again, you should get the same answer. The point of doing it with the computer is to see how the computer works. Eventually, you’ll move on to a problem where you need the computer to do it.

- 1.
- Which of these is the algebraic formula for the derivative of total revenue with
respect to quantity Q? Remember, total revenue is R(Q) = 500Q - 0.5Q
^{2}AMR(Q) = 500Q - 0.5Q

^{2}BMR(Q) = 500 - 0.5Q

CMR(Q) = 500 - Q

DMR(Q) = 500 - Q

^{2} - 2.
- Find the quantity Q at which MR(Q) = 200, that is, where marginal revenue equals the cost of production.
- 3.
- Now do it on the computer. Define a revenue function (in much the same way
that profit.fun was defined above). Then use the D to construct a new
function that gives marginal revenue. By graphing out the marginal revenue
function, find the value Q at which marginal revenue equals the cost of
production: $200.
Enter the computer commands that you used to define the functions, along the last graphing command that you use to find the Q that gives a marginal revenue equal to $200. ALSO, enter the commands and the resulting output where you evaluate the marginal revenue function at the Q you found, and evaluate the revenue function itself at that Q.

You get to work on the first day. You’re asked to figure out how many seats Gamma should schedule each day on the MSP to DCA route.

To guide your analysis, you are given the most recent report from the marketing department. This report shows the results of the research undertaken last month to study how much people are willing to pay for the airline tickets on Gamma Airlines on the route from MSP to DCA.

It’s a good thing you did your reading before starting the job. The marketing department has reported their results in the same form as described in the economic textbook: a linear relationship between price P and the quantity of seats demanded Q.

Even better (and here the story gets a bit fantastic), it’s exactly the same function as in the textbook — quite a coincidence. Still better, the cost of providing the flights is $200 per seat — it seems like exactly the same problem as in the textbook.

Whoa! You’re pretty good at this job! You jump up and run to the president’s office to tell her the news. You already know the answer. Profit will be maximized by selling 300 tickets.

The president smiles and gestures for you to sit down. She patiently explains some things to you about how the airline business works. First of all, they fly airplanes, not seats. Each plane has 120 seats. The cost does indeed work out to $200 per seat, but this is really $24,000 per flight. If there is only one passenger in the plane, it’s costing $24,000 per seat!

Your proposal to fly 300 seats per day amounts to 2 and one-half airplanes per day. They don’t do half airplanes!

Second, Gamma Airlines has cleverly arranged things so that people who are willing to pay a lot for the flight do so, even if some people are paying less. This technique is called “price discrimination.”

In order to get people to pay different prices, Gamma makes the tickets somewhat different. First, some fares apply only in the very early morning or late evening. Some are refundable (in the event that the passenger decides not to travel), others aren’t. There’s business class and first class. If you want to plan your trip well in advance, or do it on very short notice, it will cost you more. There are only so many tickets available at the low prices. And so on.

The marketing people have sorted this all out, using historical data, surveys, and experiments in which they vary the price at random on the web site to see when people buy or defer their purchase. It’s all very sophisticated, but that’s their job, the president tells you. You just have to work with the price-quantity curve, which the marketing people update from time to time.

Since there’s no price that everyone pays, to figure out the total revenue, you need to add up the amount that each person pays. So rather than multiplying P ×Q, you have to do an integral of P as a function of Q.

The value of that integral tells you the total revenue at any level of Q.

Exercise 3. At this point, ignore the important fact that the airline flies planes of 120 seats, not individual seats. Pretend that the cost per seat is $200 and analyze the gamma.revenue curve to find the point where marginal revenue equals $200. To do this, take the derivative of gamma.revenue with respect to Q. Then find the Q that makes the derivative function equal to $200.

Here’s a start:

- 1.
- Make a plot of marginal.gamma.revenue versus Q and find the Q at
which marginal revenue is $200. That’s the optimal number of seats (if
you could fly individual seats).
What is the optimal Q (if you could fly individual seats)? (Pick the closest answer.)

450 500 550 600 650 700 - 2.
- Notice that you constructed gamma.revenue by integrating price.fun, then
found marginal.gamma.revenue by differentiating gamma.revenue. This
implies a relationship between price.fun and gamma.revenue. Think
about what this relationship might be. Then plot both price.fun and
marginal.gamma.revenue to compare them. Describe what you observe about
the relationship between the two functions (it’s a very simple relationship!) and
express it in terms of a general theory about integrals and derivatives.

Now, back to the real world ...

As for the total cost, at today’s fuel prices, salaries, and airplane costs, it’s currently $24,000 per flight, with each flight holding 120 seats. The director of operations shows you the computer function that calculates this:

- 1.
- Make a plot of the gamma.revenue function and describe how it looks
different from the total revenue done in the P × Q approach of
the textbook (where everybody pays the same price, regardless
of willingness to pay). Describe your findings, briefly, in words:
- 2.
- Plot out the gamma.cost function and describe what about it makes it a
plausible model of the total cost of running the service from MSP to
DCA.
- 3.
- The total profit will be the difference between gamma.revenue and gamma.cost.
Plot this out. Find the value of Q that maximizes the total profit. Give a report
in terms of the number of flights that Gamma Airlines should run in
order to maximize profit, and how many seats on those flights will be
filled.

You wrote up a memo to the Gamma president summarizing your findings. Two weeks later, you get scheduled for a meeting with your president, the operations planners, Gamma’s legal staff, and the marketing people. You’re nervous. Why the legal staff? Have you done something wrong?

The president calls the meeting to order. “You’ve done a good job with the training data. It’s time to move on to real planning.”

“Training data?” you ask. “What do you mean?”

“Oh?” the president responds, “You didn’t think that demand curve was real, did you? I just got it from an old economics textbook.”

The marketing chief speaks up. “Our demand curve is one of our most closely guarded secrets. You can’t just pull these things out of the air.” He goes on to explain that the willingness of passengers to pay is complicated, and depends strongly on what the alternatives are. Since Gamma itself sells the same services for different prices, the trick is to find ways to get people to pay more.

“Keep in mind,” says the marketing chief, “someone who might ordinarily be willing to pay $500 for a flight, might refuse to do so if he or she knew that fares of $250 could be had.” Marketing has complicated experiments and data analysis to do. And rather than just setting price, they have to set price and the various conditions (e.g., no refund, requiring a stop-over in DTW, etc.).

The chief puts a briefcase on the conference table, clicks through the dials on a combination lock, opens the case and takes out a black binder. Leafing through the binder, he stops and extracts a single piece of paper. He slides it across the table to you. “Don’t let this out of your hands. Shred it when you’re done with it.”

The sheet has just a single table:

MSP to DCA | |

Price | Demand |

1250 | 40 |

700 | 90 |

550 | 160 |

450 | 250 |

350 | 400 |

250 | 600 |

150 | 850 |

50 | 1200 |

“What’s this?” you ask.

“That’s the end result of all our work. It’s the basis of a demand curve. The table tells how many passengers we expect at each pricing level. It’s got our 8 different categories of tickets, and it shows the highest demand for each price category, even when passengers know about the lower-price categories. Isn’t it beautiful?"

“I don’t understand."

“Let me explain. If our lowest price category were $550, then according to our research we would sell 40 high priced tickets at $1250 each, 50 tickets at $700 each, and 70 tickets at $550 each. That’s a total of 160 tickets and would bring in revenue of $134,000. Or, think of it the other way. Suppose you tell us that it’s optimal to fly just 100 passengers. If we are going to sell just 100 tickets, we’ll offer 40 premium tickets at $1250 each, another 50 business class tickets at $700 each, and offer just 10 last-minute, back-of-the-plane tickets at $550 each.

“OK. But it’s not a curve,” you observe.

The president steps in. “That’s your job,” she says. “You’ll need to turn it into a curve. Then run with it.”

She outlines what she needs in your report:

- 1.
- The optimal level of service to provide, that is, how many flights (of 120 seats) to make each day at $24,000 per flight.
- 2.
- How the result would change if fuel costs double. Currently, fuel is 30% of the total cost.
- 3.
- Whether it makes sense to switch to larger or smaller aircraft. The smaller aircraft seats 40 and costs $10,000 per flight. The larger aircraft seats 180 and costs $30,000 per flight. For logistics reasons, it’s feasible only to have one type of aircraft on each route. You can’t mix and match different types of planes.
- 4.
- “Finally, I need a way to respond to Senator Blowhard.” With the legal people nodding vigorously, the president explains that she wants to be able to show that price discrimination leads to better service (more flights per day) at a lower price (for the cheapest tickets sold) than would a policy that fixed the fare at the same price for everybody and set that price and quantity to maximize profit.

You can create the demand curve by specifying a set of points, like this:

demand.points = c(0,40,90,160,250,400,600,850,1200)

price.points = c(1250,1250,700,550,450,350,250,150,50)

price.points = c(1250,1250,700,550,450,350,250,150,50)

Note that a point was added with demand of zero at price $1250. The idea is that $1250 is the highest price on the Gamma Airlines fare schedule. So even the single passenger willing to pay the most will never pay more than $1250.

To turn these points into a function, you can use the approxfun operator. There are, of course, many different functions that can be constructed to go through the data points. Here are three different possible choices:

f1 = approxfun( demand.points, price.points,method="linear")

f2 = approxfun( demand.points, price.points,method="constant",f=0)

f3 = approxfun( demand.points, price.points,method="constant",f=1)

f2 = approxfun( demand.points, price.points,method="constant",f=0)

f3 = approxfun( demand.points, price.points,method="constant",f=1)

It’s up to you to decide which of these three choices is the best to use in answering the president’s questions. Here is what they look like. (Of course, you could have plotted them for yourself, just like any other function, using curve.)