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 )\] ### Solution
Define the points
mypoints <- 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))
mypoints#> x y
#> 1 5.6 8.8
#> 2 6.3 12.4
#> 3 7.0 14.8
#> 4 7.7 18.2
#> 5 8.4 20.8
Calculate the correlation coefficient between the two variables
cor_coef <- cor(mypoints$x, mypoints$y)
cor_coef#> [1] 0.9982255
Calculate mean and standard deviation for X and y variables.
x_mean <- mean(mypoints$x)
y_mean <- mean(mypoints$y)
x_std <- sd(mypoints$x)
y_std <- sd(mypoints$y)To find the regression equation we use the formula
\[\hat y = m x + b\] where \(m = r \frac {S_y}{S_x}\) and \(b = \bar y - m \bar x\)
Calculate \(m\) and \(b\)
m <- y_std / x_std
m#> [1] 4.26471
b <- y_mean - m * x_mean
b#> [1] -14.85297
Therefore, the equation of the regression line for the given points is:
\[\hat y = 4.26 x -14.85\]
To verify our equation, we use R’s built-in “lm” function
my_lm <- lm(mypoints$y ~ mypoints$x)
coeffs <- coefficients(my_lm)
coeffs#> (Intercept) mypoints$x
#> -14.800000 4.257143
Using the results of the “lm” function, the resulting equation of the regression line for the given points is:
\[\hat y = 4.26 x -14.8\] The two resulting equations using different approaches are very close to each other.
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\]
Define the function f
f <- expression(24 * x - 6 * x * y ^ 2 - 8 * y ^ 3)
f#> expression(24 * x - 6 * x * y^2 - 8 * y^3)
Calculate partial derivatives \(f_x\) and \(f_{xx}\)
fx <- D(f, 'x')
fxx <- D(fx, 'x')
fx#> 24 - 6 * y^2
fxx#> [1] 0
Calculate partial derivatives \(f_y\) and \(f_{yy}\)
fy <- D(f, 'y')
fyy <- D(fy, 'y')
fy#> -(6 * x * (2 * y) + 8 * (3 * y^2))
fyy#> -(6 * x * 2 + 8 * (3 * (2 * y)))
Calculate partial derivative \(f_{xy}\)
fxy <- D(fx, 'y')
fxy#> -(6 * (2 * y))
To find the critical points, solve the following system of equations
\[\begin{cases} f_{x} = 0 \\ f_{y} = 0 \end{cases}\] \[\begin{cases} -6y^2 + 24 = 0 ; (Eq 1)\\ -24y^2 - 12xy = 0 ; (Eq 2) \end{cases}\]From (Eq 1) we get:
\(-6y^2 + 24 = 0 => y = -2 \lor y = 2\) (Eq 3)
Substitute (Eq 3) in (Eq 2)
When y = -2:
\(-24(-2)^2 - 12x(-2) = 0 => x = 4\)
When y = 2:
\(-24(2)^2 - 12x(2) = 0 => x = -4\)
Using the solutions to the equation system we get two critical points:
\(P_1 = (x, y) = (4, -2)\)
\(P_2 = (x, y) = (-4, 2)\)
Calculate the value of open disk D
\[\begin{align*} D &= f_{xx} f_{yy} - (f_{xy})^2 \\ D &= (0) (12x-48y) - (-12y) \\ D &= -144 y^2 \end{align*}\]
Perform the second derivative test by evaluating the critical points in \(f_{xx}\), \(f_{yy}\), and \(D\)
For \(P_1 = (4, -2)\):
\(f_{xx}(4, -2) = 0\) \(f_{yy}(4, -2) = 12(4) - 48(-2) = 144\) \(D(4, -2) = -144 (-2)^2 = -576\)
For \(P_2 = (-4, 2)\)
\(f_{xx}(-4, 2) = 0\) \(f_{yy}(-4, 2) = 12(-4) - 48(2) = -144\) \(D(-4, 2) = -144 (2)^2 = 576\)
Therefore, since \(D(4, -2) = -576 < 0\) there is a saddle at point \((4, -2, 64)\).
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.
Find the revenue function \(R(x, y)\).
The revenue function will comprise the the total sale of x dollars times the units of the “house” brand plus y dollars times the units of the “name” brand.
\[\begin{align*} R(x, y) &= (81 - 21x + 17y) x + (40 + 11x - 23y) y \\ &= 81x - 21 x^2 + 17xy + 40y + 11xy - 23 y^2 \\ &= 81x - 21 x^2 + 28xy + 40y - 23 y^2 \end{align*}\]
What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?
To calculate the revenue, evaluate the given values in the revenue function
revenue <- function(x, y) {
81 * x - 21 * x^2 + 28 * x * y + 40 * y - 23 * y^2
}
total_revenue <- revenue(2.30, 4.10)
total_revenue#> [1] 116.62
If she sells the “house” brand for $2.30 and the “name” brand for $4.10, then the revenue will be \(116.62\) dollars.
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?
Since the firm is committed to produce a total of 96 units of a product each week, we can
Let x = Units produced by LA plant
Let y = Units produced by Denver plant
Total Weekly Units = Units produced by LA plant + Units produced by Denver plant
\(96 = x + y\)
Thus,
\(x = 96 - y ; (Eq. 1)\)
\(y = 96 - x ; (Eq. 2)\)
Replacing (Eq. 2) in the total weekly cost equation
\(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, y) = \frac {1}{6}x^2 + 1536 - 32x + \frac{1}{6}x^2 + 7x + 2400 - 25x + 700\)
\(C(x, y) = \frac{1}{3}x^2 - 50x + 4936\)
Derive the total weekly cost equation with respect to x
\(\frac{dc}{dx} = \frac{2}{3}x - 50\)
Solve the equation \(\frac{2}{3}x - 50 = 0\)
\(\frac{2}{3}x - 50 = 0\)
\(\frac{2}{3}x = 50\)
\(x = 50 \frac{3}{2}\)
\(x = 75\)
Replacing the value of x in (Eq. 1)
\(y = 96 - x\)
\(y = 96 - 75\)
\(y = 21\)
Therefore, in order to minimize the total weekly cost, the LA plan should produce 75 units and the Denver plant should produce 21 units.
Evaluate the double integral on the given region.
\[\int\int (e^{8x + 3y}) dA ; R: 2 \leq x \leq 4 \land 2 \leq y \leq 4\] Write your answer in exact form without decimals
\(\int\limits_2^4\int\limits_2^4 (e^{8x + 3y}) dx dy = \int\limits_2^4 [\int\limits_2^4 (e^{8x + 3y}) dx] dy\)
Using substitution
Let \(u = 8x + 3y => \frac{du}{dx}=8 => dx = \frac{1}{8} du\)
Adjust integral boundaries
\(if x=2 => u = 8(2) + 3y = 16 + 3y\)
\(if x = 4 => u = 8(4) + 3y = 32 + 3y\)
Replace the new variable
\(= \int\limits_2^4 [\int\limits_2^4 (e^{8x + 3y}) dx] dy\)
\(= \int\limits_2^4 [ \frac{1}{8} \int\limits_{16+3y}^{32+3y} (e^{u}) \frac{1}{8} du] dy\)
\(= \int\limits_2^4 [\frac{1}{8} (e^{u} \Big|_{16+3y}^{32+3y}) ] dy\)
\(= \int\limits_2^4 [\frac{1}{8} (e^{32+3y} - e^{16+3y}) ] dy\)
\(= \frac{1}{8} [\int\limits_2^4 e^{32+3y} dy - \int\limits_2^4 e^{16+3y}) ] dy]\)
Apply u substitution
\(= \frac{1}{3} \int\limits_{38}^{44} e^{u} du - \frac{1}{3} \int\limits_{22}^{28} e^{u}) du\)
\(= \frac{1}{8} ( = \frac{1}{3} e^u \Big|_{38}^{44} - \frac{1}{3} e^u \Big|_{22}^{28} )\)
\(= \frac{1}{8} ( = \frac{e^{44}-e^{38}}{3} - \frac{e^{28}-e^{22}}{3} )\)
\(= \frac{ e^{44} - e^{38} - e^{28} - e^{22} }{24}\)