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)

x <- c(5.6, 6.3, 7, 7.7, 8.4)
y <- c(8.8, 12.4, 14.8, 18.2, 20.8)

model <- lm(y ~ x)

coefficients <- coef(model)

print(round(coefficients, 2))
## (Intercept)           x 
##      -14.80        4.26

The regression line \(y = 4.26x - 14.80\) shows a strong positive correlation between \(x\) and \(y\), predicting that as \(x\) increases, \(y\) increases by about 4.26 units.

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

# function and its partial derivatives
f <- function(x, y) 24*x - 6*x*y^2 - 8*y^3
fx <- function(x, y) 24 - 6*y^2  # df/dx
fy <- function(x, y) -12*x*y - 24*y^2  # df/dy

# we anually identified critical points from setting fx and fy to zero
# from fx = 0 -> y = ±2
# from fy = 0 and y ≠ 0 -> x = -2y
critical_points <- matrix(c(0, 0, -4, 2, -4, -2), ncol = 2, byrow = TRUE)
colnames(critical_points) <- c("x", "y")

# we evaluate the original function at given points
evaluate_f <- function(points) {
  sapply(1:nrow(points), function(i) f(points[i, "x"], points[i, "y"]))
}

f_values <- evaluate_f(critical_points)

results <- cbind(critical_points, f_values)
colnames(results) <- c("x", "y", "f(x, y)")

results
##    x  y f(x, y)
## x  0  0       0
## x -4  2     -64
## x -4 -2      64

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 )

revenue_function <- function(x, y) {
  
  house_units = 81 - 21 * x + 17 * y
  name_units = 40 + 11 * x - 23 * y
  
  revenue = x * house_units + y * name_units
  return(revenue)
}

Step 2. What is the revenue if she sells the “house” brand for 2.30 dollars and the “name” brand for 4.10 dollars?

revenue_at_given_prices <- revenue_function(2.30, 4.10)

print(revenue_at_given_prices)
## [1] 116.62

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) = 1/6 x^2 + 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?

# total cost function with substitution of y = 96 - x
cost_function <- function(x) {
  y = 96 - x
  cost = 1/6 * x^2 + 1/6 * y^2 + 7 * x + 25 * y + 700
  return(cost)
}

result <- optim(par = 50, fn = cost_function, method = "L-BFGS-B", lower = 0, upper = 96)

x_optimal <- result$par
y_optimal <- 96 - x_optimal
cat(sprintf("Optimal units in Los Angeles (x): %.2f\n", x_optimal))
## Optimal units in Los Angeles (x): 75.00
cat(sprintf("Optimal units in Denver (y): %.2f\n", y_optimal))
## Optimal units in Denver (y): 21.00

5. Evaluate the double integral over the specified region. Write your answer in exact form without decimals.

\[ \iint_R e^{8x + 3y} \, dA ; \quad R: 2 \leq x \leq 4 \text{ and } 2 \leq y \leq 4 \]

Answer:
To give the answer in exact form we need to show the derivation of the antiderivatives and their evaluations.

  1. Inner Integral (over \(y\)): \[ \int_{2}^{4} e^{3y} \, dy = \left. \frac{1}{3} e^{3y} \right|_{2}^{4} = \frac{1}{3} (e^{12} - e^{6}) \]

  2. Outer Integral (over \(x\), incorporating the result from the inner integral): \[ \int_{2}^{4} e^{8x} \cdot \left(\frac{1}{3} (e^{12} - e^{6})\right) \, dx = \frac{1}{3} (e^{12} - e^{6}) \cdot \left. \frac{1}{8} e^{8x} \right|_{2}^{4} = \frac{1}{24} (e^{12} - e^{6}) (e^{32} - e^{16}) \]

  3. Simplifying further: \[ \frac{1}{24} (e^{44} - e^{28} - e^{38} + e^{22}) \]