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

  To solve this, we can simply create a linear regression line with R, and pull the intercept and slope.
x <- c(5.6,6.3,7,7.7,8.4)
y <- c(8.8,12.4,14.8,18.2,20.8)

coefficients <- coef(lm(y~x))
intercept <- coefficients[[1]]
slope <- coefficients[[2]]

print(paste("y = ", slope,"x ",intercept))
## [1] "y =  4.25714285714285 x  -14.8"



Question 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\)
  This can be accomplished by finding the critical points of the equation. This is done by taking the derivative with respect to both x and y, and setting them equal to zero.

\[\begin{align} f(x,y) = 24x - 6xy^2 - 8y^3 \\ \frac{d}{dy} = -12xy - 24y^2 \\ \frac{d}{dx} = 24 - 6y^2 \\ 24 - 6y^2 = 0 \\ -6y^2 = -24 \\ y^2 = -24/-6 \\ y = \sqrt{4} = \pm 2 \end{align}\]

  From here, we plug our root for 2 into the derivative with both x and y.

\[\begin{align} -12xy - 24y^2 \\ -12x(2) - 24(2)^2 \\ (2)(-12x - 24(2) \\ (2)(12)(-x - 4) = 0 \\ x = \pm 4 \end{align}\]

  Our points critical points would be at (4,-2) and (-4,2). To find the local maxima, minima, and saddle points, these need to be plugged into the original equation.
# Define the function
f <- function(x, y) {
  return(24 * x - 6 * x * y^2 - 8 * y^3)
}

# Pass values of x and y
x_value <- 4
y_value <- -2

x_value_2 <- -4
y_value_2 <- 2

# Calculate the result by calling the function with the given values
result <- f(x_value, y_value)
result_2 <- f(x_value_2, y_value_2)
print(paste("(",x_value,",",y_value,",",result,")","  ,  ","(",x_value_2,",",y_value_2,",",result_2,")"))
## [1] "( 4 , -2 , 64 )   ,   ( -4 , 2 , -64 )"
  To confirm whether these are maximums/minimums/saddle points we need to use the second partial derivative test. Although it seems to be clear, things are not always as it seems!

\[\begin{align} H = f_{xx}(x,y)f_{yy}(x,y) - f_{xy}(x,y)^2 \\ f_{x}(x,y) = 24 - 6y^2 \\ f_{xx}(x,y) = 0 \\ f_{y}(x,y) = -12xy - 24y^2 \\ f_{yy}(x,y) = -12x -48y \\ f_{xy}(x,y) = -12y \\ H = (0)(-12x-48y) - (-12y)^2 \\ H = -144y^2 \end{align}\]

  The resulting expression always evaluates to a negative value, which means these are both saddle points. The rule states that if H < 0, the point is a saddle. If H > 0, and \(f_{xx} >0\), then it is a minimum. If H > 0, and \(f_{xx} <0\), then it is a maximum.



# Question 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{align} R(x,y) = (81−21x+17y)x + (40+11x−23y)y \\ R(x,y) = 81x-21x^2+17xy + 40y + 11xy -23y^2 \\ R(x,y) = 81x + 40y + 28xy - 21x^2 - 23y^2 \\ \end{align}\]

Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10? | $116.62. You can manually plug the values in, but it’s easier to just use R.

x <- 2.3
y <- 4.1
rev <- function(x,y) {
  (81-21*x+17*y)*x + (40+11*x-23*y)*y
}   

rev(x, y)
## [1] 116.62



Question 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, the problem can be simplified by converting it to be in one term.

\[\begin{align} x + y = 96 \\ y = 96 - x \end{align}\]

  We can plug this value into our cost function to replace all the y’s.

\[\begin{align} C(x) = \frac{1}{6}x^2 + \frac{1}{6}(96-x)^2 + 7x + 25(96-x) + 700 \\ C(x) = \frac{1}{6}x^2 + x^2/6-32x+1536 + 7x + 25(96-x) + 700 \\ C(x) = \frac{1}{3}x^2 -50x + 4636 \\ C'(x) = \frac{2}{3}x + -50 = 0 \\ C'(x) = \frac{2}{3}x = 50 \\ C'(x) = x = 50(3/2) = 75\\ y = 96 - 75 = 21 \end{align}\]

  Thus, LA should make 75 units, and Denver should make 21.



Question 5

Evaluate the double integral on the given region. \[\int_2^4 \int_2^4 e^{8x + 3y} dx dy\] Write your answer in exact form without decimals.

\[\begin{align} \int_2^4 \int_2^4 e^{8x + 3y} dy dx \\ u = 8x +3y; du = 3 dy; dy = 1/3 du \\ \frac{1}{3}\int e^u du \\ 8x + 3(2) = 8x + 6 \\ 8x + 3(4) = 8x + 12 \\ \frac{1}{3}\int_{8x + 6}^{8x + 12} e^u du \\ \frac{1}{3}(e^{8x + 12} - e^{8x + 6}) \\ \frac{1}{3}e^{8x + 6}(e^6-1) \\ \int_2^4 \frac{1}{3}e^{8x + 6}(e^6-1) dx \\ u = 8x + 6; du = 8d x; dx = 1/8 du \\ \int_2^4 \frac{1}{3} \frac{1}{8}e^{u}(e^6-1) du \\ 8(4) + 6 = 38 \\ 8(2) + 6 = 22 \frac{1}{24}e^{u}(e^6-1) du \biggr\vert_{22}^{38} \\ \frac{1}{24}e^{38}(e^6-1) - \frac{1}{24}e^{22}(e^6-1_)\\ \frac{1}{24}(e^6-1)(e^{38} -e^{22})\\ \frac{1}{24}(e^{44} - e^{38} - e^{28} + e^{22})\\ \end{align}\]

(1/24)*(exp(44) - exp(38) + exp(22))
## [1] 5.34156e+17