A town obtains its water supply from two wells, W1 and W2. The cost of securing water from each well is defined as follows:
CostW1 = 13 + 4Q1 + (Q1)2
CostW2 = 26 + 8Q2 + 4(Q2)2
Where Q1 and Q2 are the amount of water in million gallons per day (mgd) from each well.
The town needs a total of 2 mgd. The capacity of well 1 is 5 million gallons per day, and that of well 2 is 10 mgd. Using calculus (hint: calculus with substitution), determine the optimal amount of water that will be drawn from each well if the town wants to minimize total costs.