To find the equation of the regression line, we need to split the values for independent (x) and dependent (y). After, we will use linear regression model to define intercept and slope.
Using formula: \[k=\frac{\bar{x} \bar{y} - \overline{xy}}{\bar{x}^2-\overline{x^2}}, \\
b = \bar{y}-k\bar{x}\] \[\bar{x}=\frac{5.6+6.3+7+7.7+8.4}{5}=7, \\
\bar{x}^2=7^2=49, \\
\bar{x^2}=\frac{5.6^2+6.3^2+7^2+7.7^2+8.4^2}{5}=49.98, \\
\bar{y}=\frac{8.8+12.4+14.8+18.2+20.8}{5}= 15, \\
\overline{xy} = \frac{5.6\cdot8.8+6.3\cdot12.4+7\cdot14.8+7.7\cdot18.2+8.4\cdot20.8}{5} = 109.172\]
\[k=\frac{7 \cdot 15 - 109.172}{49-49.98}=4.257, \\ b = 15-4.257\cdot 7=-14.8\] The equation is \[y=4.26x -14.8\] Using R:
x = c(5.6, 6.3, 7, 7.7, 8.4)
y = c(8.8, 12.4, 14.8, 18.2, 20.8)
lm_xy = lm(y~x)
summary(lm_xy)
##
## Call:
## lm(formula = y ~ x)
##
## 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
The equation is \[y=4.26x -14.8\]
\[f(x,y) = 24x - 6xy^2 - 8y^3 \]
Critical points: \[f_x(x,y)=24-6y^2, \\ f_y(x,y)=-12xy-24y^2,\]
\[ \begin{cases} 24-6y^2=0\\ -12xy-24y^2=0 \end{cases} => \begin{cases} y=\pm2\\ x=\mp4 \end{cases} \]
\[f(4,-2)=24\cdot4 - 6\cdot4\cdot(-2)^2 - 8\cdot(-2)^3=64, \\ f(-4,2)=24\cdot(-4) - 6\cdot(-4)\cdot2^2 - 8\cdot2^3=-64\] The critical points are (-4,2,-64), (4,-2,-64)
To define maxima, minima, we need second derivative and the second derivative test: \[D=f_{xx}(x_0,y_0)f_{yy}(x_0,y_0)-f_xy^2(x_0,y_0), \\ f_{xx}(x,y)=0, \\ f_{yy}(x,y)=-12x-48y, \\ f_{xy}=-12y\] For points (-4,2,-64) and (4,-2,-64): \[D=0\cdot0-(-12\cdot2)^2=-144, \\ D=0\cdot0-(-12\cdot(-2))^2=-144, \\\] D<0, then these two points are saddle points.
Check derivatives using R:
f=expression(24*x - 6*x*y^2 - 8*y^3)
fx <- D(f,'x')
fy <- D(f,'y')
fxx <- D(fx,'x')
fyy <- D(fy,'x')
fxy <- D(fx,'y')
fx
## 24 - 6 * y^2
Simplify(fy)
## -(y * (12 * x + 24 * y))
fxx
## [1] 0
fyy
## -(6 * (2 * y))
Simplify(fxy)
## -(12 * y)
We can find the revenue function by multiplying price by brands sold. \[R(x,y)=x\cdot(81 - 21x + 17y)+y\cdot(40 + 11x - 23y)=81x-21x^2+17xy+40y+11xy-23y^2= \\ =-21x^2+81x+28xy+40y-23y^2\]
\[R(2.3,4.1)=-21\cdot2.3^2+81\cdot2.3+28\cdot2.3\cdot4.1+40\cdot4.1-23\cdot4.1^2=116.62\] The revenue is 116.62 Checking the answer using R:
x <- 2.3
y <- 4.1
f <- -21*x^2+81*x+28*x*y+40*y-23*y^2
f
## [1] 116.62
The total is \[x+y=96,y=96-x, \\ C(x) = \frac{1}{6}x^2 + \frac{1}{6}(96-x)^2 + 7x + 25(96-x) + 700=\frac{1}{3}x^2 -50x + 4,636\] To find minimum, we will need to find the derivative: \[C'(x)=\frac{2}{3}x-50=0, \\ x=75, y=96-75=21\] To minimize the total weekly cost, there should be produced x=75 units in Los Angeles, y=21 units in Denver. Check using R:
C <- expression(1/3*x^2-50*x+4636)
Cx <- fx <- D(C,'x')
Simplify(Cx)
## 0.666666666666667 * x - 50
\[\iint_R e^{8x+3y}\;dA; R:2\leq x\leq 4, 2 \leq y \leq 4\] As R is , we will first integrate by x, then by y: \[\int_2^{4} \int_2^{4} e^{8x+3y}\;dxdy=\frac{1}{8}\int_2^{4}(e^{32+3y}-e^{16+3y})\;dy=\frac{1}{24}(e^{32+12}-e^{16+12}-e^{32+6}-e^{16+6})=\frac{1}{24}(e^{44}-e^{28}-e^{38}+e^{22})\] The answer is \[\frac{1}{24}(e^{44}-e^{28}-e^{38}+e^{22})\] Approximately,
1/24 * (exp(44)-exp(28)-exp(38)+exp(22))
## [1] 5.341559e+17