Problem Statement 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 )

Calculations

Extract Coordinates

We define the \(x\) and \(y\) coordinates separately:

\[ x = [5.6, 6.3, 7, 7.7, 8.4] \] \[ y = [8.8, 12.4, 14.8, 18.2, 20.8] \]

Calculate Sums

We calculate the necessary sums for the formulas:

\[ \text{sum of } x = 5.6 + 6.3 + 7 + 7.7 + 8.4 \] \[ \text{sum of } y = 8.8 + 12.4 + 14.8 + 18.2 + 20.8 \] \[ \text{sum of } xy = 5.6 \times 8.8 + 6.3 \times 12.4 + 7 \times 14.8 + 7.7 \times 18.2 + 8.4 \times 20.8 \] \[ \text{sum of } x^2 = 5.6^2 + 6.3^2 + 7^2 + 7.7^2 + 8.4^2 \]

Apply Formulas

With \(n = 5\) (number of points), we calculate the slope \(m\) and intercept \(b\):

Slope \(m\) \[ m = \frac{n(\sum xy) - (\sum x)(\sum y)}{n(\sum x^2) - (\sum x)^2} \] \[ m = \frac{5 \times \text{sum of } xy - (\text{sum of } x) \times (\text{sum of } y)}{5 \times \text{sum of } x^2 - (\text{sum of } x)^2} \]

Intercept \(b\) \[ b = \frac{(\sum y) - m(\sum x)}{n} \] \[ b = \frac{\text{sum of } y - m \times \text{sum of } x}{5} \]

Round and Conclude

Rounding \(m\) and \(b\) to the nearest hundredth:

\[ m \approx 4.26 \] \[ b \approx -14.80 \]

Final Equation

Thus, the regression line equation is: \[ y = 4.26x - 14.80 \]

Below is the r code:

# Define the data
data <- data.frame(
  x = c(5.6, 6.3, 7, 7.7, 8.4),
  y = c(8.8, 12.4, 14.8, 18.2, 20.8)
)

# Perform linear regression
model <- lm(y ~ x, data = data)

# Extract coefficients
coefficients <- coef(model)

# Display the coefficients
print(coefficients)
## (Intercept)           x 
##  -14.800000    4.257143

Problem Statement 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)\), where \(z\) is the value of the function at \((x, y)\). Separate multiple points with a comma.

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

Analysis

To find the critical points and classify them:

  1. Calculate the first derivatives: \[ f_x = \frac{\partial}{\partial x}(24x - 6xy^2 - 8y^3) = 24 - 6y^2 \] \[ f_y = \frac{\partial}{\partial y}(24x - 6xy^2 - 8y^3) = -12xy - 24y^2 \]

  2. Set the derivatives to zero to find critical points: \[ 24 - 6y^2 = 0 \] \[ -12xy - 24y^2 = 0 \]

  3. Solve the system of equations to find the critical points.

R Code for Finding Critical Points

library(rootSolve)
# Define the function for system of equations
system_eqn <- function(variables) {
  x <- variables[1]
  y <- variables[2]
  
  # f_x and f_y
  fx <- 24 - 6 * y^2
  fy <- -12 * x * y - 24 * y^2
  
  # Return both derivatives
  c(fx, fy)
}

# Use multiroot to find roots
critical_points <- multiroot(system_eqn, start = c(x = 1, y = 1))
print(critical_points$root)
##  x  y 
## -4  2

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

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

Given

Step 1: Revenue Function

The revenue function \(R(x, y)\) can be calculated as: \[ R(x, y) = x \cdot q_h + y \cdot q_n \] \[ R(x, y) = x(81 - 21x + 17y) + y(40 + 11x - 23y) \] \[ R(x, y) = 81x - 21x^2 + 17xy + 40y + 11xy - 23y^2 \] \[ R(x, y) = -21x^2 + 28xy + 81x - 23y^2 + 40y \]

Step 2: Revenue Calculation

Calculate the revenue when the “house” brand is sold for $2.30 and the “name” brand for $4.10.

R Code for Revenue Calculation

# Define the revenue function
revenue_function <- function(x, y) {
  -21 * x^2 + 28 * x * y + 81 * x - 23 * y^2 + 40 * y
}

# Calculate revenue for given prices
x_price <- 2.30
y_price <- 4.10
revenue <- revenue_function(x_price, y_price)
revenue
## [1] 116.62

Problem Statement 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?

Cost Function

The cost of production is modeled by the function: \[ C(x, y) = \frac{1}{6}x^2 + \frac{1}{6}y^2 + 7x + 25y + 700 \] where: - \(x\) is the number of units produced at the Los Angeles plant. - \(y\) is the number of units produced at the Denver plant.

Production Constraint

The total production from both plants must sum up to 96 units each week: \[ x + y = 96 \]

Objective

The objective is to determine how many units should be produced at each plant (Los Angeles and Denver) to minimize the total weekly cost.

Solution Approach

  1. Substitute \(y = 96 - x\) into the cost function to express \(C\) as a function of \(x\) only.
  2. Differentiate \(C(x)\) with respect to \(x\), set the derivative equal to zero, and solve for \(x\) to find the critical points.
  3. Evaluate the cost function at the critical points and boundaries to find the minimum cost.

Implementation

The problem will be solved using both analytical methods (for the calculus part) and numerical methods (using R for verification and computation). The optimal numbers of units to produce at each location will be determined to achieve the minimum cost.

Using the method of Lagrange multipliers, we set up the Lagrangian as follows:

\[ L(x, y, \lambda) = 16x^2 + 16y^2 + 7x + 25y + 700 + \lambda (96 - x - y) \]

Calculating the Derivatives

Derivatives of the Lagrangian are set to zero to solve for \(x\), \(y\), and \(\lambda\):

\[ \frac{\partial L}{\partial x} = 32x + 7 - \lambda = 0 \] \[ \frac{\partial L}{\partial y} = 32y + 25 - \lambda = 0 \] \[ \frac{\partial L}{\partial \lambda} = 96 - x - y = 0 \]

Solving the System of Equations

library(nleqslv)

# System of equations based on the Lagrangian derivatives
system_eq <- function(z) {
  x <- z[1]
  y <- z[2]
  lambda <- z[3]

  # System of equations
  eq1 <- 32*x + 7 - lambda
  eq2 <- 32*y + 25 - lambda
  eq3 <- 96 - x - y

  c(eq1, eq2, eq3)
}

# Initial guesses for x, y, and lambda
z_start <- c(x = 48, y = 48, lambda = 100)

# Solving the system
solution <- nleqslv(x = z_start, fn = system_eq)

# Extracting solutions
x_opt <- solution$x[1]
y_opt <- solution$x[2]

# Output the results
c("Units to produce in Los Angeles" = x_opt, "Units to produce in Denver" = y_opt)
## Units to produce in Los Angeles.x      Units to produce in Denver.y 
##                          48.28125                          47.71875

Problem Statement 5

Evaluate the double integral on the given region. \[ \iint_R e^{x + 3y} \, dA, \quad R: 2 \leq x \leq 4 \quad \text{and} \quad 2 \leq y \leq 4 \] Write your answer in exact form without decimals.

Solution:

The double integral is set up as follows: \[ \int_{2}^{4} \int_{2}^{4} e^{x + 3y} \, dx \, dy \]

Step 1: Integrate with respect to \(x\): \[ \int_{2}^{4} e^{x + 3y} \, dx = e^{3y} \int_{2}^{4} e^x \, dx \] Since \(e^{3y}\) is constant with respect to \(x\), the integral simplifies to: \[ e^{3y} [e^x]_{2}^{4} = e^{3y} (e^4 - e^2) \]

Step 2: Integrate with respect to \(y\): \[ \int_{2}^{4} e^{3y} (e^4 - e^2) \, dy = (e^4 - e^2) \int_{2}^{4} e^{3y} \, dy \] Calculating the integral of \(e^{3y}\): \[ (e^4 - e^2) \left[ \frac{1}{3}e^{3y} \right]_{2}^{4} = (e^4 - e^2) \left( \frac{1}{3}(e^{12} - e^{6}) \right) \]

Final Result: \[ \text{The evaluated double integral is } \frac{1}{3}(e^4 - e^2)(e^{12} - e^6). \]

# Load necessary library
library(pracma)
## Warning: package 'pracma' was built under R version 4.3.3
## 
## Attaching package: 'pracma'
## The following objects are masked from 'package:rootSolve':
## 
##     gradient, hessian
# Define the function to integrate
integrand <- function(x, y) {
  exp(x + 3 * y)
}

# Define the limits for x and y
x_lower <- 2
x_upper <- 4
y_lower <- 2
y_upper <- 4

# Use the 'integral2' function from pracma to compute the double integral
result <- integral2(integrand, x_lower, x_upper, y_lower, y_upper)

# Print the result
print(result)
## $Q
## [1] 2554820
## 
## $error
## [1] 1.731926e-08