## Question 1

##
## Call:
## lm(formula = y ~ x, data = d1)
##
## Residuals:
##     1     2     3     4     5
## -0.24  0.38 -0.20  0.22 -0.16
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept) -14.8000     1.0365  -14.28 0.000744 ***
## x             4.2571     0.1466   29.04 8.97e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3246 on 3 degrees of freedom
## Multiple R-squared:  0.9965, Adjusted R-squared:  0.9953
## F-statistic: 843.1 on 1 and 3 DF,  p-value: 8.971e-05

Equation: $y = -14.8 + 4.46x$

## Question 2

## function (x, y)
## c(x = 24 - 6 * y^2, y = -(y * (12 * x + 24 * y)))

$24 - 6y^2 = 0 \\ 6y^2 = 24 \\ y^2 = 4 \\ y = \pm2$

$-12xy - 24y^2 = 0 \\ -12xy = 24y^2 \\ x = -2y$

For y = 2, x = -4 For y = -2, x = 4

Substite in the original function to find critical points:

## [1] -64
## [1] 64
## # A tibble: 2 x 3
##       x     y     z
##   <dbl> <dbl> <dbl>
## 1    -4     2   -64
## 2     4    -2    64

There are two inflection points, one is positive at D(-4,2) and the other is negative at D(4,-2)

## Question 3

$Rev = price * units sold \\ R_1(x) = x * (81 - 21x + 17y) = (81x -21x^2 + 17xy) \\ R_2(y) = y * (40 + 11x -23y) = (40y + 11xy = 23y^2)$ Total Revenue $R(x,y) = 81x - 21x^2 + 17xy + 40y + 11xy -23y^2 \\ R(x,y) = -21x^2 + 28xy - 23y^2 + 81x +40y$

## [1] 116.62

## Question 4

$$C(x,y) = x^2 + y^2 + 7x + 25y + 700 \ x + y = 96 \ \ C(96 - y, y) = (96 - y)^2 + y^2 + 7(96 - y) + 25y + 700 \ C(96 - y, y) = y^2 - 14y + 2908$$

Minimum Value

$\frac{2}{3}y - 14 = 0 \\ y = 21 \\ x = 96 - 21 \\ x = 75$ The company needs to produce 75 units in LA and 21 in Denver to minimize cost

## Question 5

## $Q ## [1] 5.341559e+17 ## ##$error
## [1] 15214781905