x <- c(5.6, 6.3, 7, 7.7, 8.4)
y <- c(8.8, 12.4, 14.8, 18.2, 20.8)
lm_model <- lm(y ~ x)
print(lm_model)
##
## Call:
## lm(formula = y ~ x)
##
## Coefficients:
## (Intercept) x
## -14.800 4.257
print(summary(lm_model))
##
## 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
plot(x,y, main = "X vs. Y", xlab = "X", ylab = "Y")
abline(lm_model, col = 'blue', lty = 2)
The linear regression model is \(\text{Linear Regression } y = -14.80 + 4.26x\)
Take the partial derivative with respect to x: \(\frac{\partial z}{\partial x} = 24 - 6y^2\)
Take the partial derivative with respect to y: \(\frac{\partial z}{\partial y} = -12xy - 24y^2\)
Now let’s find the critical points, which is when \(\nabla z = \vec{0}\)
\(w.r.t. x\)
\(\frac{\partial z}{\partial x} = 24 - 6y^2 = 0\)
\(4 - y^2 = 0\)
\(y^2 = 4\)
\(y= 2 and -2\)
\(w.r.t. y\)
\(\frac{\partial z}{\partial y} = -12xy - 24y^2 = 0\)
\(xy + 2y^2 = 0\)
with y = -2, \(x(-2) + 2(-2)^2 = 0\) , \(-2x + 8 = 0\) , \(x=4\)
with y=2, \(x(2) + 2(2)^2 = 0\), \(2x + 8 = 0\), \(x=-4\)
Hence, the critical points to this equation is: \((-4,2) and (4,-2).\)
\(D = f_{xx}(x,y) f_{yy}(x,y) - f_{xy}(x,y)^2 \text{ where D > 0: max or min; D < 0: saddle point}\)
\(D = 0 * (-12x - 48y^2) - (-12y)^2 = 12y^2\)
\(D = 12(2)^2 > 0 \text{ and } \frac{\partial^2 z}{\partial y^2}(-4,2) = -12(-4) - 48(2)^2 = -144\)
At critical point (x,y)=(4,???2): \[D = 12(-2)^2 > 0 \text{ and } \frac{\partial^2 z}{\partial y^2}(4,-2) = -12(4) - 48(-2)^2 = -240\]
Step 1. Find the revenue function \(R ( x, y )\).
\(\text{Revenue = (Units Sold) x (Sales Price)}\)
\(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 - 23y^2 + 81x + 40y + 28xy\)
Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?
revenue <- function(x,y){
return(-21*(x^2) - 23*(y^2) + 81*x + 40*y + 28*x*y)
}
rev_return <- revenue(2.30, 4.10)
print(round(rev_return, 2))
## [1] 116.62
Total number of units produced is 96, x from Los Angeles and y from Denver.
\[x + y = 96\]
\[y = 96 - x\]
Now, \(C(x,y) = \frac{1}{6} x^2 + \frac{1}{6} y^2 + 7x + 25y + 700\)
\(C(x,y) = \frac{1}{6} x^2 + \frac{1}{6} (96 - x)^2 + 7x + 25(96-x) + 700\)
\(C(x) = \frac{1}{6} x^2 + \frac{9216 -192x + x^2}{6} + 7x + 2400 - 25x + 700\)
\(C(x) = \frac{1}{6} x^2 + 1536 - 32x + \frac{x^2}{6} + 7x + 2400 - 25x + 700\)
\(C(x) = \frac{1}{3} x^2 - 50x + 4636\)
critical points in function \(C(x)\):
\(C'(x) = \frac{2}{3} x - 50\)
\(\frac{2}{3} x - 50 = 0\)
\(x = 75\)
After, plugging in values \(75 + y = 96\)
\(y = 21\)
\(\text{Let u } = 8x\)
\(\frac{du}{dx} = 8 \text{ which translates to } du = 8 \text{ }dx\)
\(\int_{y = 2}^{y = 4} \int_{u = 16}^{u = 32} e^{ey}e^u * \frac{1}{8} du \text{ } dy = \int_{y = 2}^{y = 4} \frac{e^{ey}}{8} \int_{u = 16}^{u = 32} e^u du \text{ }dy\)
\(\int_{u = 16}^{u = 32} e^u du = e^u|_{16}^{32} = e^{32} - e^{16}\)
\(\int_{y=2}^{y=4} \frac{e^{32} - e^{16}}{8} e^{ey} \text{ }dy = \frac{e^{32} - e^{16}}{8} \int_{y=2}^{y=4} e^{ey} \text{ } dy\)
\(\frac{e^{32} - e^{16}}{8} \int_{u=2e}^{u=4e} \frac{1}{e}e^{u} \text{ } du = \frac{e^{32} - e^{16}}{8e} \int_{u=2e}^{u=4e} e^{u} \text{ } du\)
\(= (\frac{e^{31} - e^{15}}{8}) e^u|_{2e}^{4e} = (\frac{e^{31} - e^{15}}{8}) (e^{4e}-e^{2e}) + c\)
Hence, \((\frac{e^{31} - e^{15}}{8}) (e^{4e}-e^{2e}) + c\)