1. Find the equation of the regression line for the given points. Round any final values to the nearest hundredth, if necessary.

(5.6, 8.8), (6.3, 12.4), (7, 14.8), (7.7, 18.2), (8.4, 20.8)

Our first step is to calculate the means of \(x\) and \(y\), respectively.

p1 <- c(5.6, 8.8)
p2 <- c(6.3, 12.4)
p3 <- c(7, 14.8)
p4 <- c(7.7, 18.2)
p5 <- c(8.4, 20.8)

points <- list(p1,p2,p3,p4,p5)

x_vals <- c()
y_vals <- c()

for (point in points) {
  x_vals <- c(x_vals, point[1])
  y_vals <- c(y_vals, point[2])
}

x_mean <- mean(x_vals)
y_mean <- mean(y_vals)

Looks like our means are nice whole numbers!

We can now calculate the slope of the regression equation with the following formula:

\[ m = \frac{\sum_{i=4}^4(x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=4}^4(x_i-\bar{x})^2} \]

#numerator

numerator_total <- 0

for (i in 1:5) {
  num_exp1 <- x_vals[i] - x_mean
  num_exp2 <- y_vals[i] - y_mean
  
  numerator_total <- numerator_total + num_exp1 * num_exp2
}

#denominator

denominator_total <- 0

for (i in 1:5) {
  denom_exp <- (x_vals[i] - x_mean)^2
  
  denominator_total <- denominator_total + denom_exp
}

m <- numerator_total / denominator_total

Given that a standard linear equation is given by \(y=mx+b\), we can solve for \(b\) by plugging in our \(\bar{y}\) and \(\bar{x}\) values into that equation. Rearranging the equation to leave \(b\) alone, we get

\[ b = \bar{y}-m\bar{x} \]

y_mean - m*x_mean
## [1] -14.8

Therefore, our final equation is:

\[ y = 4.26x -14.8 \]

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 \] In order to find our critical points, we first need to take partial derivatives of the function with respect to \(x\) and \(y\).

\[ f_x = 24-6y^2 \] \[ f_y = -12xy-24y^2 \] We then set our two partial derivatives equal to \(0\) and solve for \(x\) and \(y\) to find our critical points.

\[ 0 = 24-6y^2 \\ -24 = -6y^2 4 = y^2 \\ y = 2, -2 \] \[ 0 = -12xy - 24y^2 \] Plugging in our recently found \(y\) values:

\[ 0 = -12x(2) - 24(2)^2 \\ 0 = -24x - 96 \\ 96 = -24x \\ x = -4 \] And:

\[ 0 = -12x(-2) - 24(-2)^2 \\ 0 = 24x - 96 \\ 96 = 24x \\ x = 4 \] Therefore, our critical points in terms of \(x\) and \(y\) are \((-4,2)\) and \((4, -2)\)

In order to get these points in terms of \((x,y,z)\), we can simply solve for the functions at our \(x\) and \(y\) values and solve to get \(z\).

\[ z_1=f(x_1,y_1)=24x_1-6x_1y_1^2-8y_1^3 \\ = 24(-4) -6(-4)(2)^2-8(2)^3 \\ = -96+96-64 \\ = -64 \] \[ z_2=f(x_2,y_2)=24x_2-6x_2y_2^2-8y_2^3 \\ = 24(4) -6(4)(-2)^2-8(-2)^3 \\ = 96-96+64 \\ = 64 \] So, our critical points are \((-4,2,-64)\) and \((4,-2,64)\).

Next, we need to find our second partial derivatives to construct a Hessian matrix.

\[ f_{xx} = \frac{d}{dx}(24-6y^2) = 0 \] \[ f_{yy} = \frac{d}{dy}(-12xy-24y^2) = -12x - 48y \] \[ f_{xy} = \frac{d}{dx}(-12xy-24y^2) = -12y \]

Our Hessian matrix is therefore:

\[ H = \begin{bmatrix} 0&-12y\\ -12y&-12x-48y \end{bmatrix} \] Now, we can evaluate the determinant of the matrix where \(x\) and \(y\) correspond to our calculated critical values.

At \((-4,2)\):

\[ H = \begin{bmatrix} 0&-12(2)\\ -12(2)&-12(-4)-48(2) \end{bmatrix} \] \[ H = \begin{bmatrix} 0&-24\\ -24&-48 \end{bmatrix} \]

H1 = matrix(c(0, -24,
         -24, -48),
          nrow = 2)

det(H1)
## [1] -576

At \((4,-2)\):

\[ H = \begin{bmatrix} 0&-12(-2)\\ -12(-2)&-12(4)-48(-2) \end{bmatrix} \] \[ H = \begin{bmatrix} 0&24\\ 24&48 \end{bmatrix} \]

H2 = matrix(c(0, 24,
         24, 48),
          nrow = 2)

det(H2)
## [1] -576

Both determinants equal out to \(-576\). These negative determinants confirm both our critical points are saddle points.

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).

If the amount of “house” products is \(81 - 21x + 17y\), and the price of each house product is \(x\), the total revenue for the house brand should be given by:

\[ x (81 - 21x + 17y) \\ 81x -21x^2 + 17xy \] By the same token, \(y\) (the price of the name-brand product) times \(40 + 11x - 23y\) (the total amount of name-brand products sold) should give the revenue from the name brand.

\[ y(40 + 11x - 23y) \\ 40y + 11xy - 23y^2 \] Finally, we can get revenue \(R(x,y)\) by adding these two revenue equations together:

\[ (81x -21x^2 + 17xy) + (40y + 11xy - 23y^2) \\ \] \[ R(x,y) = -23y^2 - 21x^2 + 28xy + 81x + 40y \] Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?

Now that we have a revenue formula with \(x\) (price of house brand) and \(y\) (price of name brand) as variables, this should simply be a matter of plugging the given values in to our formula.

\[ R(2.30,4.10) = -23(4.1)^2 - 21(2.3)^2 + 28(2.3)(4.1) + 81(2.3) + 40(4.1) \]

x = 2.3
y = 4.1

R = -23*y^2 - 21*x^2 + 28*x*y + 81*x + 40*y

R
## [1] 116.62

The total revenue generated when selling at those prices is \(\$116.62\)

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 \(\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?

This problem is essentially asking us to find the point \((x,y)\) where the provided function is at its lowest. That will involve finding its critical points (minima and maxima), then determining which if any are minima.

As in problem 2, the critical points of the function occur where it is “flat,” or where its derivatives equal 0. So the next step is to find the first derivatives of the function with respect to each variable, then set them \(=0\).

\[ f_x = \frac{1}{3}x + 7 \] \[ 0 = \frac{1}{3}x + 7 \\ -7 = \frac{1}{3}x \\ x = -21 \] \[ f_y = \frac{1}{3}y + 25 \]

\[ 0 = \frac{1}{3}y + 25 \\ -25 = \frac{1}{3}y \\ y = -75 \] So, we have only one critical points, sitting at ()


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 \(\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?

This problem is essentially asking us to find the point \((x,y)\) where the provided function is at its lowest. That will involve finding its critical points (minima and maxima), then determining which if any are minima.

Because we have an additional equation, \(y + x = 96\), constraining the results, we can plug \(96-x\) in for \(y\) and treat this as a single variable problem.

\[ C = \frac{1}{6}x^2 + \frac{1}{6}y^2 + 7x + 25y + 700 \] \[ \frac{1}{6}x^2 + \frac{1}{6}(96-x)^2 + 7x + 25(96-x) + 700 \] \[ \frac{1}{6}x^2 + \frac{1}{6}(9216 -192x + x^2) + 7x + 2400 - 25x + 700 \] \[ \frac{1}{6}x^2 + 1536 -32x + \frac{1}{6}x^2 + 7x + 2400 - 25x + 700 \] \[ C = \frac{1}{3}x^2 -50x + 4636 \] Now we can figure out our derivative, set it equal to \(0\) and solve for \(x\):

\[ C' = \frac{2}{3}x -50 \]

$$ 0 = x -50 \

50 = x \

x = 75 $$ Because we know the constraint \(x+y=96\), if \(x = 75\), \(y\) must equal \(21\).

Since this is our only critical point, we can quickly check to ensure it is indeed a minimum by checking the second derivative at \(x=0\):

\[ C'' = \frac{2}{3} \] Because the second derivative is a positive constant, we know the critical point is a minimum. Therefore, the amount of units that minimize cost are \(75\) in LA and \(21\) in Denver.

5. Evaluate the double integral on the given region.

\[ \int\int_R(e^{8x+3y})dA \; ; \; R: 2 \leq x \leq 4 \:and \: 2 \leq y \leq 4 \] Write your answer in exact form without decimals.

If we first integrate with respect to \(y\), we can treat \(e^{8x}\) as a constant and pull it out of the integral.

\[ \int_2^4(e^{8x+3y})dy \] \[ \int_2^4e^{8x}e^{3y}dy \] \[ e^{8x}\int_2^4e^{3y}dy \] \[ e^{8x} (\frac{1}{3}e^{3(4)}-\frac{1}{3}e^{3(2)}) \\ \frac{1}{3}e^{8x}(e^{12}-e^{6}) \\ \]

Next, we can take the integral with respect to \(x\):

\[ \int_2^4(\frac{1}{3}e^{8x}(e^{12}-e^{6}))dx \] \[ \frac{1}{3}(e^{12}-e^{6})\int_2^4e^{8x}dx \] \[ \frac{1}{3}(e^{12}-e^{6})*(\frac{1}{8}e^{8(4)}-\frac{1}{8}e^{8(2)}) \] \[ \frac{1}{24}(e^{12}-e^{6})*(e^{32}-e^{16}) \] \[ \frac{1}{24}(e^{44}-e^{28}-e^{38}+e^{22}) \]