Noori Selina

Assignment 15 - Data 605

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
  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 ) \]

\[\begin{align*} Y &= mX + b \\ m &= \frac{n\sum(xy) - \sum(x)\sum(y)}{n\sum(x^2) - (\sum x)^2} \\ b &= \frac{\sum(y)\sum(x^2) - \sum(x)\sum(xy)}{n\sum(x^2) - \sum(x)^2} \end{align*}\]

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

lm(y ~ x)
## 
## Call:
## lm(formula = y ~ x)
## 
## Coefficients:
## (Intercept)            x  
##     -14.800        4.257

\[ Y = -14.8 + 4.26x \]

ggplot(data.frame(x,y), aes(x, y)) +
  geom_point() +
  geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

  1. 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 \]

\(f_x = 24 - 6y^2\)   \(f_y = -12xy - 24y^2\)

\(24 - 6y^2 = 0 \ \to \ y^2 = 4 \ \to \ y = \pm 2\)

When \(y = 2\):  \(-12xy -24y^2 = 0 \ \to \ -24x = 96 \ \to \ x = -4\).

When \(y = -2\):  \(-12xy -24y^2 = 0 \ \to \ 24x = 96 \ \to \ x = 4\).

Third coordinate:

\(f(-4,2) = 24(-4) - 6(-4)(2^2) - 8(2^3) =\) -64.

\(f(4,-2) = 24(4) - 6(4)(-2^2) - 8(-2^3) =\) 64.

two critical points = \((-4,2,-64)\) and \((4,-2,64)\).

second derivative test:

\(D(x,y) = f_{xx}f_{yy} - f_{xy}^2\).

\(f_{xx} = 0\).

\(f_{yy} = -12x - 48y\).

\(f_{xy} = f_{yx} = -12y\).

\(D = 0 - (-12y)^2 = -144y^2\).

\(D(x,y) < 0 \ \forall (x,y)\),

  1. 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: number of units sold multipled by price

\(R(x,y) = (81 - 21x + 17y)x + (40 + 11x - 23y)y\).

Step 2: Plug in \(x = 2.30\) and \(y = 4.10\).

\(R(2.30, 4.10) = \Big[81 - 21(2.30) + 17(4.10)\Big]\times 2.30 + \Big[40 + 11(2.30) - 23(4.10)\Big]\times 4.10\)

\(R(2.30, 4.10) =\) 116.62.

  1. 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?

\(x + y = 96\). find the critical points of \(C(x,y)\), next we must find the local minimum.

Solving for either of the variables

\(x = y - 96, \ \ y = 96 - x\).

\[\begin{align*} 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 + 1536 - 32x + \frac{1}{6}x^2 + 7x + 2400 - 25x + 700 \\ &= \frac{1}{3}x^2 - 50x + 4636 \\ C_x &= \frac{2}{3}x - 50 = 0 \\ x &= 75 \\ C_{xx} &= \frac{2}{3} \end{align*}\]

We are able to see that the second derivative is > 0, then, and there is a local minimum at 75.

the Los Angeles = 75 units, and the Denver plant = 21 units.

  1. Evaluate the double integral on the given region. Write your answer in exact form without decimals.

\[ \iint \limits_R (e^{8x + 3y})dA; \ \ R: 2 \leq x \leq 4 \ \ \text{and } \ 2 \leq y \leq 4 \]

\[\begin{align*} &\int\limits_{2}^{4} \int\limits_{2}^{4} (e^{8x + 3y}) \ dx \ dy \\ &\int\limits_{2}^{4} e^{8x} \ dx \int\limits_{2}^{4} e^{3y} \ dy \\ &\frac{1}{8}e^{8x}\Big|_{2}^{4} \cdot \frac{1}{3}e^{3y}\Big|_{2}^{4} \\ &\frac{1}{24}(e^{32} - e^{16})(e^{12} - e^{6}) \end{align*}\]

(1/24)*((exp(32) - exp(16))*(exp(12) - exp(6)))
## [1] 5.341559e+17