HW15 - Calculus 3

1. Find the equation of the regression line for the given points.

Round any final values to the nearest hundredth, if necessary.

##      [,1] [,2] [,3] [,4] [,5]
## [1,]  5.6  6.3  7.0  7.7  8.4
## [2,]  8.8 12.4 14.8 18.2 20.8
## [1] 5.6 6.3 7.0 7.7 8.4
## [1]  8.8 12.4 14.8 18.2 20.8
## 
## Call:
## lm(formula = y ~ x)
## 
## Coefficients:
## (Intercept)            x  
##   -14.80000      4.25714
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     1     2     3     4     5 
## -0.24  0.38 -0.20  0.22 -0.16 
## 
## Coefficients:
##               Estimate Std. Error  t value    Pr(>|t|)    
## (Intercept) -14.800000   1.036533 -14.2784  0.00074442 ***
## x             4.257143   0.146617  29.0358 0.000089706 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.324551 on 3 degrees of freedom
## Multiple R-squared:  0.996454,   Adjusted R-squared:  0.995272 
## F-statistic: 843.076 on 1 and 3 DF,  p-value: 0.0000897056
##  (Intercept)            x 
## -14.80000000   4.25714286
## [1] "Regression line: y =  -14.8 + 4.26 x"

The formula for the regression line is \(\boxed{y = -14.8 + 4.26 x}\) .


2. Find all local maxima, local minima, and saddle points for the function given below.

Write your answer(s) in the form ( x, y, z ).

Separate multiple points with a comma.

\(f ( x, y ) = 24x - 6xy^2 - 8y^3\)

To find the critical points, compute the first derivatives and set equal to zero:

\(f_x = \frac{\partial}{\partial x}(24x - 6xy^2 -8y^3) = 24-6y^2 = 0 \implies4 = y^2 \implies y \in \{-2,2\}\) .

\(f_y = \frac{\partial}{\partial y}(24x - 6xy^2 -8y^3) = -12xy-24y^2 = 0\) .

\(xy =-2y^2 \implies (y=0) \vee (x=-2y)\) .

From above, we know that \(y \in \{-2,2\}\) so we can disregard the case that \(y=0\).

Therefore, \(x \in \{4,-4\}\), i.e., \((x,y) \in \{(-4,2),(4,-2)\}\) .

Evaluating the function at these points, we obtain:

\(f(-4,2) = 24\cdot(-4) - 6\cdot(-4)\cdot(2)^2 - 8\cdot(2)^3=-96+96-64=-64\)
\(f(4,-2) = 24\cdot(4) - 6\cdot(4)\cdot(-2)^2 - 8\cdot(-2)^3=96-96+64=64\)

Therefore, the critical points are \(\boxed{(x,y,z) \in \{(-4,2,-64),(4,-2,64)\}}\) .

To determine whether these critical values are maxima, minima, or saddle points, we need to use the second partial derivative test:

\(f_{xx} = \frac{\partial(f_{x})}{\partial x} = \frac{\partial}{\partial x}(24-6y^2) = 0\) .

\(f_{yy} = \frac{\partial(f_{y})}{\partial y} = \frac{\partial}{\partial y}(-12xy-24y^2) = -12x-48y\) .

\(f_{xy} = \frac{\partial(f_{x})}{\partial y} = \frac{\partial}{\partial y} (24-6y^2) = -12y\) \(f_{yx} = \frac{\partial(f_{y})}{\partial x} = \frac{\partial}{\partial x} (-12xy-24y^2) = -12y = f_{xy}\) , as expected.

The discriminant \(D(f(x,y)) = f_{xx}f_{yy} - f_{xy}f_{yx} = (0)(-12x-48y)-(-12y)^2=-144y^2\).
At both critical points, \(D(f(-4,2)) = D(f(4,-2)) = -144\cdot(\pm2)^2 = -576 < 0\) .

By the second partial derivative test, each of the two points \((x,y,z) \in \{(-4,2,-64),(4,-2,64)\}\) is a saddle point – there are no maxima nor minima.


3. A grocery store sells two brands of a product, the “house” brand and a “name” brand.

The manager estimates that if she sells the “house” brand for \(x\) dollars and the “name” brand for \(y\) dollars, she will be able to sell

  • \(81 - 21x + 17y\) units of the “house” brand and
  • \(40 + 11x - 23y\) units of the “name” brand.

Step 1. Find the revenue function \(R ( x, y )\) .

\[\begin{aligned} R(x,y) &= (81- 21x + 17y)x + (40 + 11x - 23y)y \\ &=81x - 21x^2 + 17xy + 40y +11xy- 23y^2 \\ &= -21x^2 -23y^2 + 28xy + 81x + 40y \\ \end{aligned}\]

Calculate revenue without requiring that the quantity of each item sold be an integer

## [1] "Units of House brand sold:  102.4 at price of  2.3  each  --> revenue =  235.52"
## [1] "Units of name brand sold:  -29 at price of  4.1  each  --> revenue =  -118.9"
## [1] "Total revenue:  116.62"
## [1] "Double-check :  116.62"

Re-calculate revenue, adding a requirement that the quantity of each item sold be an integer

## [1] "Units of House brand sold:  102 at price of  2.3  each  --> revenue =  234.6"
## [1] "Units of name brand sold:  -29 at price of  4.1  each  --> revenue =  -118.9"
## [1] "Total revenue:  115.7"
## [1] "Double-check :  115.7"

There is a problem with these figures – because it is expecting that we would sell

  • 102 units of the “house” brand, but
  • -29 units of the “name” brand.

The latter figure is negative. This is not possible.

So, let’s restrict the quantities to be non-negative:

Calculate results with non-negative restrictions:

## [1] "Units of House brand sold:  102 at price of  2.3  each  --> revenue =  234.6"
## [1] "Units of name brand sold:  0 at price of  4.1  each  --> revenue =  0"
## [1] "Total revenue:  234.6"
## [1] "Double-check :  234.6"

Still there is a problem here:
Allowing us to override an otherwise negative quantity-sold with zero, while still setting a high nominal price for such item, would allow us to sell an arbitrary (i.e., infinite) quantity of the other item simply by making the price of the non-salable item arbitrarily high.

Under such model, the result would be an arbitrarily large amount of sales from from the house brand with zero sales of (expensive) name brand.

This indicates that this problem is not well-formulated.

Revenue maximization?

The question doesn’t ask about maximization of revenue (which one would have expected it to ask…)

So, let’s compute it anyhow…

  • \(R_x = -42x +28y +81 = 0\)
  • \(R_y = 28x -46y +40 = 0\)

So, we have a system of 2 simultaneous equations in 2 unknowns:

\[\begin{cases} \begin{aligned} -42x +28y +81 &=0 \\ 28x -46y +40 &= 0 \end{aligned} \end{cases}\]

Multiplying the second equation by \(\frac{3}{2}\) gives us
\[\begin{cases} \begin{aligned} -42x +28y +81 &=0 \\ 42x -69y +60 &= 0 \end{aligned} \end{cases}\]

Adding together gives us

\(-41y+141=0\) , so \(y = \frac{141}{41}\approx 3.43902439\) .

From the above equations, \(x = \frac{28y+81}{42}=\frac{28 \cdot\frac{141}{41}+81}{42} =\frac{7269}{1722}\approx 4.22125436\) .

So, the critical point (which we assume will be a maximum) is (housePrice,namePrice)=\((x^*,y^*)=\left(\frac{7269}{1722},\frac{141}{41}\right)\approx(4.22125436,3.43902439)\)

Of course, we could use R to perform the above calculations for us:
\[\begin{aligned} R_x&: -42x +28y &= -81 \\ R_y&: \quad 28x -46y &= -41 \end{aligned}\]

Solve system of 2 equations using rref from pracma

##    [,1] [,2] [,3]
## Rx  -42   28  -81
## Ry   28  -46  -40
##    [,1] [,2]       [,3]
## Rx    1    0 4.22125436
## Ry    0    1 3.43902439
##         Rx         Ry 
## 4.22125436 3.43902439

Perform calculations on \((x^{*},y^{*}) =(4.221254355 , 3.43902439)\)

## [1] "Units of House brand sold:  50.8170731707317 at price of  4.2212543554007  each  --> revenue =  214.511791450667"
## [1] "Units of name brand sold:  7.33623693379792 at price of  3.4390243902439  each  --> revenue =  25.2294977479392"
## [1] "Total revenue:  239.741289198606"
##         Rx 
## 239.741289
The above indicates that we generate revenue of $\(239.741289199\).

Of course, we should assume that

  • we can’t sell fractional units, and
  • each unit price should be rounded to cents.

This introduces an “integer programming” problem, which can be considerably more difficult than a linear programming problem, because the result obtained from rounding the quantities to the closest integer may be inferior to rounding to the more distant integer.

Ignoring such issue, we obtain a slightly smaller result:

Confirm maximum

To verify that this critical point is in fact a maximum, consider the second derivative test:

\(R_x = -42x +28y +81 = 0\) \(R_y = 28x -46y +40 = 0\)

\(R_{xx} = \frac{\partial(R_{x})}{\partial x} = \frac{\partial}{\partial x}(-42x +28y +81) = -42\) .

\(R_{yy} = \frac{\partial(R_{y})}{\partial y} = \frac{\partial}{\partial y}(28x -46y +40) = -46\) .

\(R_{xy} = \frac{\partial(R_{x})}{\partial y} = \frac{\partial}{\partial y} ( -42x +28y +81) = 28\) \(R_{yx} = \frac{\partial(R_{y})}{\partial x} = \frac{\partial}{\partial x} (28x -46y +40) = 28 = f_{xy}\) , as expected.

The discriminant \[\begin{aligned} D(f(x,y)) = R_{xx}R_{yy} - R_{xy}R_{yx} &= (-42)(-46)-(28)^2\\ &=1932-784\\ &=1148\\ &>0 \end{aligned}\].

Because

  • \(D(R(x,y))>0 \quad\forall (x,y)\) , and
  • \(R_{xx}(x,y)<0 \quad\forall(x,y)\),

the critical point (4.22,3.44) is a maximum .

However, there is still one problem here:

Generally a “house” brand is less expensive than a “name” brand.

The result of this optimization is to select

  • a higher price (4.22) for the house brand and
  • a lower price (3.44) for the name brand.

This does not make sense, and further suggests that the model is not well-formulated.


4. A company has a plant in Los Angeles and a plant in Denver.

The firm is committed to produce a total of 96 units of a product each week.

The total weekly cost is given by \(C(x, y) = \frac{1}{6}x^2 + \frac{1}{6}y^2 + 7x + 25y + 700\) , where

  • \(x\) is the number of units produced in Los Angeles and
  • \(y\) is the number of units produced in Denver.

How many units should be produced in each plant to minimize the total weekly cost?

First, note that \(x+y=96\), so \(y=96-x\) .

Substituting,

\[\begin{aligned} C(x, y) &= \frac{1}{6}x^2 + \frac{1}{6}y^2 + 7x + 25y + 700 \\ C(x, 96-x)&= \frac{1}{6}x^2 + \frac{1}{6}(96-x)^2 + 7x + 25(96-x) + 700 \\ &= \frac{1}{6}x^2 + \frac{1}{6}(96^2-192x+x^2) + 7x + (2400-25x) + 700 \\ &= \frac{1}{6}x^2 + 1536 -32x + \frac{1}{6}x^2 + 7x + (2400-25x) + 700 \\ &= \frac{1}{3}x^2 -50x +4636 \\ &= \frac{x^2-150x+5625}{3} +2721 \\ &= \frac{(x-75)^2}{3}+2761 \end{aligned}\]

Next, compute the derivative \(\frac{dC}{dx}\) and set equal to zero:

\(C' = \frac{dC}{dx} = \frac{2(x-75)}{3}=\frac{2}{3}x-50=0 \\ \implies x=75 \\ \implies y=96-x=96-75=21\).

To confirm that this is a minimum, we look at the second derivative test:

\(C'' = \frac{d^2C}{dx^2} = \frac{2}{3} > 0\).

Because the second derivative is positive, this confirms that the critical point is a minimum.

This means that:

  • 75 units should be produced in Los Angeles
  • 21 units should be produced in Denver

Under the above allocation, the total weekly cost is minimized at \(C(75,21) = \$2,761\) .


5. Evaluate the double integral \({\iint\limits_R {e^{8x + 3y} dA}}\) on the given region .

R: \(2 \le x \le 4\) and \(2 \le y \le 4\)

Write your answer in exact form without decimals.

\[\begin{aligned} \int\limits_{2}^4 \left[\int\limits_{2}^4 {e^{8x + 3y} dx}\right] dy &=\int\limits_{2}^4 \left[e^{3y}\int\limits_{2}^4 {e^{8x} dx}\right] dy \\ &=\int\limits_{2}^{4} e^{3y}\left[ \frac{e^{8x}}{8} \right]_{x=2}^{x=4} dy \\ &=\int\limits_{2}^{4} e^{3y}\left[ \frac{e^{32}-e^{16}}{8} \right] dy \\ &=\left[ \frac{e^{32}-e^{16}}{8} \right]\int\limits_{2}^{4} e^{3y} dy \\ &=\left[ \frac{e^{32}-e^{16}}{8} \right]\left[ \frac{e^{3y}}{3} \right]_{y=2}^{y=4} \\ &=\left[ \frac{e^{32}-e^{16}}{8} \right]\left[ \frac{e^{12}-e^{6}}{3} \right] \\ &=\left[ \frac{e^{32}e^{12}-e^{32}e^{6}-e^{16}e^{12}+e^{16}e^{6}}{24} \right] \\ &=\left[ \frac{e^{44}-e^{38}-e^{28}+e^{22}}{24} \right] \\ \\ &=\boxed{\frac{e^{22}}{24}\left[ {e^{22}-e^{16}-e^{6}+1} \right]} \\ \end{aligned}\]