Navigation

Optimization of multivariable functions

16.1 Local maximum and minimum values

17 problems · hints, answers and solutions shown beside each one

Stage 1 · Conceptual

Q1Stage 1Past exam · M200 2016D
  1. Some level curves of a function f(x,y)f(x,y) are plotted in the xyxy–plane below.

    Figure from prac_s2.3, line 19

    Figure from prac_s2.3, line 19

    For each of the four statements below, circle the letters of all points in the diagram where the situation applies. For example, if the statement were “These points are on the yy–axis”, you would circle both PP and UU, but none of the other letters. You may assume that a local maximum occurs at point TT.

    (i) f is zeroP R S T U(ii) f has a saddle pointP R S T U(iii)  the partial derivative fy is positiveP R S T U\begin{align*} \text{(i) }& \vnabla f\text{ is zero} & &\text{P R S T U} \\ \text{(ii) }& f\text{ has a saddle point} & &\text{P R S T U} \\ \text{(iii) }& \text{ the partial derivative }f_y\text{ is positive} & &\text{P R S T U} \\ \end{align*}
  2. The diagram below shows three “yy traces” of a graph z=F(x,y)z=F(x,y) plotted on xzxz–axes. (Namely, the intersections of the surface z=F(x,y)z=F(x,y) with the three planes y=1.9y=1.9, y=2y=2, and y=2.1y=2.1.) For each statement below, circle the correct word.

    (i)  the first order partial derivative Fx(1,2) ispositive/negative/zero (circle one)(ii) F has a critical point at (2,2)true/false (circle one)(iii)  the second order partial derivative Fxy(1,2) ispositive/negative/zero (circle one)\begin{align*} \text{(i) }& \text{ the first order partial derivative }F_x(1,2)\text{ is} & &\text{positive/negative/zero (circle one)} \\ \text{(ii) }& F\text{ has a critical point at }(2,2) & &\text{true/false (circle one)} \\ \text{(iii) }& \text{ the second order partial derivative }F_{xy}(1,2)\text{ is} & &\text{positive/negative/zero (circle one)} \end{align*}

    Figure from prac_s2.3, line 19

    Figure from prac_s2.3, line 19

Answer

(a) (i) TT, UU

(a) (ii) UU

(a) (iii) SS

(b) (i) Fx(1,2)>0F_x(1,2)>0

(b) (ii) FF does not have a critical point at (2,2)(2,2).

(b) (iii) Fxy(1,2)<0F_{xy}(1,2)<0

Full solution

a) (i) f\vnabla f is zero or does not exist at critical points. The point TT is a local maximum and the point UU is a saddle point. The remaining points PP, RR, SS, are not critical points.

(a) (ii) Only UU is a saddle point.

(a) (iii) We have fy(x,y)>0f_y(x,y)>0 if ff increases as you move vertically upward through (x,y)(x,y). Looking at the diagram, we see

fy(P)<0fy(Q)<0fy(R)=0fy(S)>0fy(T)=0fy(U)=0\begin{align*} f_y(P) <0\qquad f_y(Q) <0\qquad f_y(R) =0\qquad f_y(S) >0\qquad f_y(T) =0\qquad f_y(U) =0 \end{align*}

So only SS works.

(b) (i) The function z=F(x,2)z=F(x,2) is increasing at x=1x=1, because the y=2.0y=2.0 graph in the diagram has positive slope at x=1x=1. So Fx(1,2)>0F_x(1,2)>0.

(b) (ii) The function z=F(x,2)z=F(x,2) is also increasing (though slowly) at x=2x=2, because the y=2.0y=2.0 graph in the diagram has positive slope at x=2x=2. So Fx(2,2)>0F_x(2,2)>0. So FF does not have a critical point at (2,2)(2,2).

(b) (iii) From the diagram the looks like Fx(1,1.9)>Fx(1,2.0)>Fx(1,2.1)F_x(1,1.9) > F_x(1,2.0) > F_x(1,2.1). That is, it looks like the slope of the y=1.9y=1.9 graph at x=1x=1 is larger than the slope of the y=2.0y=2.0 graph at x=1x=1, which in turn is larger than the slope of the y=2.1y=2.1 graph at x=1x=1. So it looks like Fx(1,y)F_x(1,y) decreases as yy increases through y=2y=2, and consequently Fxy(1,2)<0F_{xy}(1,2)<0.

Stage 2 · Procedural

Q2Stage 2Past exam · M200 2005D

Let z=f(x,y)=(y2x2)2z = f(x,y) = {(y^2 - x^2)}^2.

  1. Make a reasonably accurate sketch of the level curves in the xyxy–plane of z=f(x,y)z = f(x,y) for z=0z = 0, 11 and 1616. Be sure to show the scales on the coordinate axes.

  2. Verify that (0,0)(0,0) is a critical point for z=f(x,y)z = f(x,y), and determine from part (a) or directly from the formula for f(x,y)f(x,y) whether (0,0)(0, 0) is a local minimum, a local maximum or a saddle point.

  3. Can you use the Second Derivative Test to determine whether the critical point (0,0)(0, 0) is a local minimum, a local maximum or a saddle point? Give reasons for your answer.

Hint

Write down the equations of specified level curves.

Answer

(a)

Figure from prac_s2.3, line 205

Figure from prac_s2.3, line 205

(b) (0,0)(0,0) is a local (and also absolute) minimum.

(c) No. See the solutions.

Full solution

(a)

  • The level curve z=0z=0 is y2x2=0y^2-x^2=0, which is the pair of 4545^\circ lines y=±xy=\pm x.

  • When C>0C>0, the level curve
    z=C4z=C^4 is (y2x2)2=C4{(y^2-x^2)}^2=C^4, which is the pair of hyperbolae y2x2=C2y^2-x^2=C^2, y2x2=C2y^2-x^2=-C^2 or

    y=±x2+C2x=±y2+C2\begin{equation*} y=\pm\sqrt{x^2+C^2}\qquad x=\pm\sqrt{y^2+C^2} \end{equation*}

    The hyperbola y2x2=C2y^2-x^2=C^2 crosses the yy–axis (i.e. the line x=0x=0) at (0,±C)(0,\pm C). The hyperbola y2x2=C2y^2-x^2=-C^2 crosses the xx–axis (i.e. the line y=0y=0) at (±C,0)(\pm C,0).

Here is a sketch showing the level curves z=0z=0, z=1z=1 (i.e. C=1C=1), and z=16z=16 (i.e. C=2C=2).

Figure from prac_s2.3, line 216

Figure from prac_s2.3, line 216

(b) As fx(x,y)=4x(y2x2)f_x(x,y)=-4x(y^2-x^2) and fy(x,y)=4y(y2x2)f_y(x,y)=4y(y^2-x^2), we have fx(0,0)=fy(0,0)=0f_x(0,0) = f_y(0,0) = 0 so that (0,0)(0,0) is a critical point. Note that

  • f(0,0)=0f(0,0)=0,

  • f(x,y)0f(x,y)\ge 0 for all xx and yy.

So (0,0)(0,0) is a local (and also absolute) minimum.

(c) Note that

fxx(x,y)=4y2+12x2fxx(x,y)=0fyy(x,y)=12y24x2fyy(x,y)=0fxy(x,y)=8xyfxx(x,y)=0\begin{alignat*}{3} f_{xx}(x,y) &=-4y^2+12x^2\qquad& f_{xx}(x,y)&=0 \\ f_{yy}(x,y) &= 12y^2-4x^2\qquad& f_{yy}(x,y)&=0 \\ f_{xy}(x,y) &=-8xy\qquad& f_{xx}(x,y)&=0 \\ \end{alignat*}

As fxx(0,0)fyy(0,0)fxy(0,0)2=0f_{xx}(0,0)f_{yy}(0,0)-f_{xy}(0,0)^2=0, the Second Derivative Test (Theorem 16.1.14 in the text) tells us absolutely nothing.

Q3Stage 2Past exam · M200 2006A

Use the Second Derivative Test to find all values of the constant cc for which the function z=x2+cxy+y2z = x^2 + cxy + y^2 has a saddle point at (0,0)(0,0).

Hint

Remember a2<1a^2<1 means a<1|a|<1, i.e. 1<a<1-1<a<1.

Answer

c>2|c|>2

Full solution

Write f(x,y)=x2+cxy+y2f(x,y) = x^2 +cxy +y^2. Then

fx(x,y)=2x+cyfx(0,0)=0fy(x,y)=cx+2yfy(0,0)=0fxx(x,y)=2fxy(x,y)=cfyy(x,y)=2\begin{align*} f_x(x,y)&= 2x+cy & f_x(0,0) = 0 \\ f_y(x,y)&= cx+2y & f_y(0,0) = 0 \\ f_{xx}(x,y) &= 2 \\ f_{xy}(x,y) &= c \\ f_{yy}(x,y) &= 2 \end{align*}

As fx(0,0)=fy(0,0)=0f_x(0,0)=f_y(0,0)=0, we have that (0,0)(0,0) is always a critical point for ff. According to the Second Derivative Test, (0,0)(0,0) is also a saddle point for ff if

fxx(0,0)fyy(0,0)fxy(0,0)2<0    4c2<0    c>2\begin{align*} f_{xx}(0,0) f_{yy}(0,0) - f_{xy}(0,0)^2 <0 \iff{} 4-c^2 <0 \iff{} |c|>2 \end{align*}

As a remark, the Second Derivative Test provides no information when the expression fxx(0,0)fyy(0,0)fxy(0,0)2=0f_{xx}(0,0) f_{yy}(0,0) - f_{xy}(0,0)^2 =0, i.e. when c=±2c=\pm 2. But when c=±2c=\pm 2,

f(x,y)=x2±2xy+y2=(x±y)2\begin{equation*} f(x,y) = x^2 \pm 2xy + y^2 =(x\pm y)^2 \end{equation*}

and ff has a local minimum, not a saddle point, at (0,0)(0,0).

Q4Stage 2Past exam · M200 2006D

Find and classify all critical points of the function

f(x,y)=x3y32xy+6.\begin{equation*} f(x, y) = x^3 - y^3 - 2xy + 6. \end{equation*}
Hint

Use the Second Derivative Test

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)saddle point
(23,23)\left(-\frac{2}{3},\frac{2}{3}\right)local max
Full solution

To find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3y32xy+6fx=3x22yfxx=6xfxy=2fy=3y22xfyy=6yfyx=2\begin{alignat*}{3} f&=x^3 - y^3 - 2xy + 6 \\ f_x&=3x^2-2y & f_{xx}&=6x \qquad & f_{xy}&= -2\\ f_y&=-3y^2-2x \qquad & f_{yy}&=-6y\qquad & f_{yx}&= -2 \end{alignat*}

The first order partial derivatives are defined everywhere so the critical points are the solutions of

fx=3x22y=0fy=3y22x=0\begin{equation*} f_x=3x^2-2y=0 \qquad f_y=-3y^2-2x = 0 \end{equation*}

Substituting y=32x2y=\frac{3}{2}x^2, from the first equation, into the second equation gives

3(32x2)22x=0    2x(3323x3+1)=0    x=0, 23\begin{align*} -3\left(\frac{3}{2}x^2\right)^2-2x =0 &\iff{} -2x\left(\frac{3^3}{2^3}x^3+1\right)=0 \\ &\iff{} x=0,\ -\frac{2}{3} \end{align*}

So there are two critical points: (0,0)(0,0), (23,23)\left(-\frac{2}{3},\frac{2}{3}\right).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)0×0(2)2<00\times 0 -(-2)^2 < 0saddle point
(23,23)\left(-\frac{2}{3},\frac{2}{3}\right)(4)×(4)(2)2>0(-4)\times (-4)-(-2)^2>04-4local max
Q5Stage 2Past exam · M200 2007A

Find all critical points for f(x,y)=x(x2+xy+y29)f(x,y) = x(x^2 + xy + y^2 - 9). Also find out which of these points give local maximum values for f(x,y)f(x,y), which give local minimum values, and which give saddle points.

Hint

Use the Second Derivative Test

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,3)(0,3)saddle point
(0,3)(0,-3)saddle point
(2,1)(-2,1)local max
(2,1)(2,-1)local min
Full solution

To find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3+x2y+xy29xfx=3x2+2xy+y29fxx=6x+2yfxy=2x+2yfy=x2+2xyfyy=2xfyx=2x+2y\begin{alignat*}{3} f&=x^3 + x^2y + xy^2 - 9x \\ f_x&=3x^2+2xy+y^2-9 \qquad & f_{xx}&=6x+2y \qquad & f_{xy}&= 2x+2y\\ f_y&=x^2+2xy & f_{yy}&=2x\qquad & f_{yx}&= 2x+2y \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

fxf_x and fyf_y are polynomials (in two variables) and so they are defined everywhere. Therefore the critical points are the solutions of

fx=3x2+2xy+y29=0fy=x(x+2y)=0\begin{alignat*}{3} f_x&=3x^2+2xy+y^2-9&&=0 \tag{E1} \\ f_y&=x(x+2y) &&= 0 \tag{E2} \end{alignat*}

Equation (E2) is satisfied if at least one of x=0x=0, x=2yx=-2y.

  • If x=0x=0, equation (E1) reduces to y29=0y^2-9=0, which is satisfied if y=±3y=\pm 3.

  • If x=2yx=-2y, equation (E1) reduces to

    0=3(2y)2+2(2y)y+y29=9y29\begin{align*} 0=3(-2y)^2+2(-2y)y+y^2-9=9y^2-9 \end{align*}

    which is satisfied if y=±1y=\pm 1.

So there are four critical points: (0,3)(0,3), (0,3)(0,-3), (2,1)(-2,1) and (2,1)(2,-1). The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,3)(0,3)(6)×(0)(6)2<0(6)\times (0)-(6)^2< 0saddle point
(0,3)(0,-3)(6)×(0)(6)2<0(-6)\times (0)-(-6)^2<0saddle point
(2,1)(-2,1)(10)×(4)(2)2>0(-10)\times (-4)-(-2)^2>010-10local max
(2,1)(2,-1)(10)×(4)(2)2>0(10)\times (4)-(2)^2>01010local min
Q6Stage 2

Find and classify all the critical points of f(x,y)=x2+y2+x2y+4f(x,y)=x^2+y^2+x^2y+4.

Hint

Use the Second Derivative Test

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)local min
(2,1)(\sqrt{2},-1)saddle point
(2,1)(-\sqrt{2},-1)saddle point
Full solution

To find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x2+y2+x2y+4fx=2x+2xyfxx=2+2yfxy=2xfy=2y+x2fyy=2\begin{alignat*}{5} f&=x^2+y^2+x^2y+4 \\ f_x&=2x+2xy\qquad & f_{xx}&=2+2y\qquad & f_{xy}&= 2x\\ f_y&=2y+x^2 & f_{yy}&=2 \end{alignat*}

The first partial derivatives are defined everywhere so the critical points are the solutions of

fx=0fy=0    2x(1+y)=02y+x2=0    x=0 or y=12y+x2=0\begin{alignat*}{5} & & &f_x=0 & &f_y=0 \\ &\iff{}\quad & &2x(1+y)=0 & &2y+x^2=0 \\ &\iff{} & &x=0\text{ or }y=-1\qquad & &2y+x^2=0 \end{alignat*}

When x=0x=0, yy must be 00. When y=1y=-1, x2x^2 must be 22. So, there are three critical points: (0,0)(0,0), (±2,1)\big(\pm\sqrt{2},-1\big).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)2×202>02\times 2-0^2>02>02>0local min
(2,1)(\sqrt{2},-1)0×2(22)2<00\times 2-(2\sqrt{2})^2<0saddle point
(2,1)(-\sqrt{2},-1)0×2(22)2<00\times 2-(-2\sqrt{2})^2<0saddle point
Q7Stage 2Past exam · M200 2008D

Find all saddle points, local minima and local maxima of the function

f(x,y)=x3+x22xy+y2x.\begin{equation*} f(x,y) = x^3 + x^2 - 2xy + y^2 - x. \end{equation*}
Hint

Use the second derivative test

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(13,13)\big(\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\big)local min
(13,13)-\big(\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\big)saddle point
Full solution

To find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3+x22xy+y2xfx=3x2+2x2y1fxx=6x+2fxy=2fy=2x+2yfyy=2fyx=2\begin{alignat*}{3} f&=x^3 + x^2 - 2xy + y^2 - x \\ f_x&=3x^2+2x-2y-1 \qquad & f_{xx}&=6x+2 \qquad & f_{xy}&= -2\\ f_y&=-2x+2y & f_{yy}&=2\qquad & f_{yx}&= -2 \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

The first order partial derivatives exist everywhere so the critical points are the solutions of

fx=3x2+2x2y1=0fy=2x+2y=0\begin{alignat*}{3} f_x&=3x^2+2x-2y-1&&=0 \tag{E1} \\ f_y&=-2x+2y &&= 0 \tag{E2} \end{alignat*}

Substituting y=xy=x, from (E2), into (E1) gives

3x21=0    x=±13=0\begin{align*} 3x^2-1=0 \iff{} x=\pm\frac{1}{\sqrt{3}}=0 \end{align*}

So there are two critical points: ±(13,13)\pm\big(\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\big).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(13,13)\big(\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\big)(23+2)×(2)(2)2>0(2\sqrt{3}+2)\times (2)-(-2)^2> 023+2>02\sqrt{3}+2>0local min
(13,13)-\big(\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\big)(23+2)×(2)(2)2<0(-2\sqrt{3}+2)\times (2)-(-2)^2<0saddle point
Q8Stage 2Past exam · M200 2009D

For the surface

z=f(x,y)=x3+xy23x24y2+4\begin{equation*} z = f (x, y) = x^3 + xy^2 - 3x^2 - 4y^2 + 4 \end{equation*}

Find and classify [as local maxima, local minima, or saddle points] all critical points of f(x,y)f(x,y).

Hint

Use the Second Derivative Test

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)local max
(2,0)(2,0)saddle point
Full solution

To find the critical points we will need the first order partial derivatives of ff and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3+xy23x24y2+4fx=3x2+y26xfxx=6x6fxy=2yfy=2xy8yfyy=2x8fyx=2y\begin{alignat*}{3} f&=x^3 + xy^2 - 3x^2 - 4y^2 + 4 \\ f_x&=3x^2+y^2-6x\qquad & f_{xx}&=6x-6 \qquad & f_{xy}&= 2y\\ f_y&=2xy -8y & f_{yy}&=2x-8\qquad & f_{yx}&= 2y \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

The first partial derivatives exist everywhere so the critical points are the solutions of

fx=3x2+y26x=0fy=2(x4)y=0\begin{equation*} f_x=3x^2+y^2-6x=0 \qquad f_y=2(x-4)y = 0 \end{equation*}

The second equation is satisfied if at least one of x=4x=4, y=0y=0 are satisfied.

  • If x=4x=4, the first equation reduces to y2=24y^2=-24, which has no real solutions.

  • If y=0y=0, the first equation reduces to 3x(x2)=03x(x-2)=0, which is satisfied if either x=0x=0 or x=2x=2.

So there are two critical points: (0,0)(0,0), (2,0)(2,0).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(8)(0)2>0(-6)\times(-8)-(0)^2> 06-6local max
(2,0)(2,0)6×(4)(0)2<06\times(-4)-(0)^2<0saddle point
Q9Stage 2Past exam · M200 2010A
  1. For the function z=f(x,y)=x3+3xy+3y26x3y6z = f (x, y) = x^3 + 3xy + 3y^2 - 6x - 3y - 6. Find and classify as [local maxima, local minima, or saddle points] all critical points of f(x,y)f(x, y).

  2. The images below depict level sets f(x,y)=cf (x, y) = c of the functions in the list at heights c=0,0.1,0.2,,1.9,2c = 0, 0.1, 0.2, \ldots , 1.9, 2. Label the pictures with the corresponding function and mark the critical points in each picture. (Note that in some cases, the critical points might not be drawn on the images already. In those cases you should add them to the picture.)

    1. f(x,y)=(x2+y21)(xy)+1f(x, y) = (x^2 + y^2 - 1)(x - y) + 1

    2. f(x,y)=y(x+y)(xy)+1f(x, y) = y(x + y)(x - y) + 1

Figure from prac_s2.3, line 674

Figure from prac_s2.3, line 674

Figure from prac_s2.3, line 674

Figure from prac_s2.3, line 674

Hint

When you're looking for critical points, remember you need both fx=0f_x=0 and fy=0f_y=0. So if it's hard to solve (say) fx=0f_x=0, then first solve fy=0f_y=0; then you can narrow your search of fx=0f_x=0.

Answer

(a)

criticalpoint\Atop{\text{critical}}{\text{point}}type
(32,14)(\frac{3}{2},-\frac{1}{4})local min
(1,1)(-1,1)saddle point

(b)

(i)

Figure from prac_s2.3, line 707

Figure from prac_s2.3, line 707

(ii)

Figure from prac_s2.3, line 707

Figure from prac_s2.3, line 707

Full solution

(a) To find the critical points we will need the first order partial derivatives of ff and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3+3xy+3y26x3y6fx=3x2+3y6fxx=6xfxy=3fy=3x+6y3fyy=6fyx=3\begin{alignat*}{3} f&=x^3 + 3xy + 3y^2 - 6x - 3y - 6 \\ f_x&=3x^2+3y-6 & f_{xx}&=6x \qquad & f_{xy}&= 3\\ f_y&=3x+6y-3 \qquad & f_{yy}&=6\qquad & f_{yx}&= 3 \end{alignat*}

The first partial derivatives exists everywhere (as they are polynomials with two variables) and so the first order partial derivatives exist everywhere. So the critical points are the solutions of

fx=3x2+3y6=0fy=3x+6y3=0\begin{equation*} f_x=3x^2+3y-6=0 \qquad f_y=3x+6y-3 = 0 \end{equation*}

Subtracting the second equation from 22 times the first equation gives

6x23x9=0    3(2x3)(x+1)=0    x=32, 1\begin{equation*} 6x^2-3x-9=0 \iff{} 3(2x-3)(x+1)=0 \iff{} x=\frac{3}{2},\ -1 \end{equation*}

Since y=1x2y=\frac{1-x}{2} (from the second equation), the critical points are (32,14)(\frac{3}{2},-\frac{1}{4}), (1,1)(-1,1) and the classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(32,14)(\frac{3}{2},-\frac{1}{4})(9)×(6)(3)2>0(9)\times(6)-(3)^2> 099local min
(1,1)(-1,1)(6)×(6)(3)2<0(-6)\times (6)-(3)^2<0saddle point

(b) Notice that the lines x=yx=y, x=yx=-y and y=0y=0 are all level curves of the function f(x,y)=y(x+y)(xy)+1f(x, y) = y(x + y)(x - y) + 1 (i.e. of (iii)) with f=1f=1. So the first picture goes with (iii). And the second picture goes with (i).

Here are the pictures with critical points marked on them. There are saddle points where level curves cross and there are local max's or min's at “bull's eyes”.

(i)

Figure from prac_s2.3, line 707

Figure from prac_s2.3, line 707

(ii)

Figure from prac_s2.3, line 707

Figure from prac_s2.3, line 707

Q10Stage 2Past exam · M200 2010D

Define the function

f(x,y)=x3+3xy+3y26x3y6\begin{equation*} f(x,y) = x^3+3xy+3y^2-6x-3y-6 \end{equation*}

Classify all critical points of f(x,y)f(x,y) as local maxima, local minima, or saddle points.

Answer
criticalpoint\Atop{\text{critical}}{\text{point}}type
(32,14)\big(\frac{3}{2},-\frac{1}{4}\big)local min
(1,1)(-1,1)saddle point
Full solution

To find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=x3+3xy+3y26x3y6fx=3x2+3y6fxx=6xfxy=3fy=3x+6y3fyy=6fyx=3\begin{alignat*}{3} f&=x^3+3xy+3y^2-6x-3y-6 \\ f_x&=3x^2+3y-6 & f_{xx}&=6x \qquad & f_{xy}&= 3\\ f_y&=3x+6y-3 \qquad & f_{yy}&=6\qquad & f_{yx}&= 3 \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

The first order partial derivatives are defined everywhere and so the critical points are the solutions of

fx=3x2+3y6=0fy=3x +6y3=0\begin{alignat*}{3} f_x&=3x^2+3y-6&&=0 \tag{E1} \\ f_y&=3x\ +6y-3 &&= 0 \tag{E2} \end{alignat*}

Subtracting equation (E2) from twice equation (E1) gives

6x23x9=0    (2x3)(3x+3)=0\begin{align*} 6x^2-3x-9=0 \iff{} (2x-3)(3x+3)=0 \end{align*}

So we must have either x=32x=\frac{3}{2} or x=1x=-1.

  • If x=32x=\frac{3}{2}, (E2) reduces to 92+6y3=0\frac{9}{2}+6y-3=0 so y=14y=-\frac{1}{4}.

  • If x=1x=-1, (E2) reduces to 3+6y3=0-3+6y-3=0 so y=1y=1.

So there are two critical points: (32,14)\big(\frac{3}{2},-\frac{1}{4}\big) and (1,1)(-1,1).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(32,14)\big(\frac{3}{2},-\frac{1}{4}\big)(9)×(6)(3)2>0(9)\times (6)-(3)^2> 099local min
(1,1)(-1,1)(6)×(6)(3)2<0(-6)\times (6)-(3)^2<0saddle point
Q11Stage 2Past exam · M200 2015D

Find and classify the critical points of f(x,y)=3x2y+y33x23y2+4f(x,y) = 3x^2 y + y^3 - 3x^2 - 3y^2 + 4.

Answer

(0,0) is a local max

(0,2) is a local min

(1,1) and (-1,1) are saddle points

Full solution

Thinking a little way ahead, to find the critical points we will need the first order partial derivatives of ff, and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=3x2y+y33x23y2+4fx=6xy6xfxx=6y6fxy=6xfy=3x2+3y26yfyy=6y6fyx=6x\begin{alignat*}{3} f&=3x^2 y + y^3 - 3x^2 - 3y^2 + 4 \\ f_x&=6xy-6x & f_{xx}&=6y-6 \qquad & f_{xy}&= 6x\\ f_y&=3x^2+3y^2-6y \qquad & f_{yy}&=6y-6\qquad & f_{yx}&= 6x \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

The first partial derivatives are defined everywhere and so the critical points are the solutions of

fx=6x(y1)=0fy=3x2+3y26y=0\begin{equation*} f_x=6x(y-1)=0 \qquad f_y=3x^2+3y^2-6y = 0 \end{equation*}

The first equation is satisfied if at least one of x=0x=0, y=1y=1 are satisfied.

  • If x=0x=0, the second equation reduces to 3y26y=03y^2-6y=0, which is satisfied if either y=0y=0 or y=2y=2.

  • If y=1y=1, the second equation reduces to 3x23=03x^2 -3=0 which is satisfied if x=±1x=\pm 1.

So there are four critical points: (0,0)(0,0), (0,2)(0,2), (1,1)(1,1), (1,1)(-1,1).

The classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(6)(0)2>0(-6)\times (-6)-(0)^2> 06-6local max
(0,2)(0,2)6×6(0)2>06\times 6-(0)^2>06local min
(1,1)(1,1)0×0(6)2<00\times 0-(6)^2<0saddle point
(1,1)(-1,1)0×0(6)2<00\times 0-(-6)^2<0saddle point
Q12Stage 2Past exam · M200 2003D

Find all critical points of the function f(x,y)=x4+y44xy+2f(x,y)=x^4+y^4-4xy+2, and for each determine whether it is a local minimum, maximum or saddle point.

Answer

(0,0)(0,0) is a saddle point and ±(1,1)\pm(1,1) are local mins

Full solution

We have

f(x,y)=x4+y44xy+2fx(x,y)=4x34yfxx(x,y)=12x2fy(x,y)=4y34xfyy(x,y)=12y2fxy(x,y)=4\begin{alignat*}{5} f(x,y)&=x^4+y^4-4xy+2\quad & f_x(x,y)&=4x^3-4y\quad & f_{xx}(x,y)&=12x^2 \\ & & f_y(x,y)&=4y^3-4x & f_{yy}(x,y)&=12y^2 \\ & & & &f_{xy}(x,y)&=-4 \end{alignat*}

The partial first derivatives are defined everywhere. So the critical point are the solutions of

fx(x,y)=fy(x,y)=0    y=x3 and x=y3    x=x9 and y=x3    x(x81)=0, y=x3    (x,y)=(0,0) or (1,1) or (1,1)\begin{align*} f_x(x,y)=f_y(x,y)=0 &\iff{} y=x^3\text{ and }x=y^3 \\ &\iff{} x=x^9\text{ and }y=x^3 \\ &\iff{} x(x^8-1)=0,\ y=x^3 \\ &\iff{} (x,y)=(0,0)\text{ or }(1,1)\text{ or }(-1,-1) \end{align*}

Here is a table giving the classification of each of the three critical points.

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)0×0(4)2<00\times 0-(-4)^2<0saddle point
(1,1)(1,1)12×12(4)2>012\times 12-(-4)^2>012local min
(1,1)(-1,-1)12×12(4)2>012\times 12-(-4)^2>012local min
Q13Stage 2Past exam · M200 2002D

Find all the critical points of the function

f(x,y)=x4+y44xy\begin{equation*} f(x,y)=x^4+y^4-4xy \end{equation*}

defined in the xyxy-plane. Classify each critical point as a local minimum, maximum or saddle point.

Answer

(0,0)(0,0) is a saddle point and ±(1,1)\pm(1,1) are local mins

Full solution

We have

f(x,y)=x4+y44xyfx(x,y)=4x34yfxx(x,y)=12x2fy(x,y)=4y34xfyy(x,y)=12y2fxy(x,y)=4\begin{alignat*}{3} f(x,y)&=x^4+y^4-4xy\qquad & f_x(x,y)&=4x^3-4y\qquad & f_{xx}(x,y)&=12x^2\\ & & f_y(x,y)&=4y^3-4x & f_{yy}(x,y)&=12y^2 \\ & & & &f_{xy}(x,y)&=-4 \end{alignat*}

The first partial derivatives are defined everywhere. So the critical points are the solution of

fx(x,y)=fy(x,y)=0    y=x3 and x=y3    x=x9 and y=x3    x(x81)=0, y=x3    (x,y)=(0,0) or (1,1) or (1,1)\begin{align*} f_x(x,y)=f_y(x,y)=0 &\iff{} y=x^3\text{ and }x=y^3 \iff{} x=x^9\text{ and }y=x^3 \\ &\iff{} x(x^8-1)=0,\ y=x^3\\ &\iff{} (x,y)=(0,0)\text{ or }(1,1)\text{ or }(-1,-1) \end{align*}

Here is a table giving the classification of each of the three critical points.

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)0×0(4)2<00\times 0-(-4)^2<0saddle point
(1,1)(1,1)12×12(4)2>012\times 12-(-4)^2>012local min
(1,1)(-1,-1)12×12(4)2>012\times 12-(-4)^2>012local min
Q14Stage 2Past exam · M200 2001D

Find all the critical points of the function

f(x,y)=x3+xy2x\begin{equation*} f(x,y)=x^3+xy^2-x \end{equation*}

defined in the xyxy-plane. Classify each critical point as a local minimum, maximum or saddle point. Explain your reasoning.

Hint

“Explain your reasoning" is test-speak for “show your work."

Answer

(0,±1)(0,\pm 1) are saddle points, (13,0)\big(\frac{1}{\sqrt{3}},0\big) is a local min and (13,0)\big(-\frac{1}{\sqrt{3}},0\big) is a local max

Full solution

We have

f(x,y)=x3+xy2xfx(x,y)=3x2+y21fxx(x,y)=6xfy(x,y)=2xyfyy(x,y)=2xfxy(x,y)=2y\begin{alignat*}{3} f(x,y)&=x^3+xy^2-x\qquad & f_x(x,y)&=3x^2+y^2-1\qquad & f_{xx}(x,y)&=6x \\ & & f_y(x,y)&=2xy & f_{yy}(x,y)&=2x \\ & & & & f_{xy}(x,y)&=2y \end{alignat*}

The first partial derivatives are defined everywhere. So the critical points are the solution of

fx(x,y)=fy(x,y)=0    xy=0 and 3x2+y2=1    {x=0 or y=0} and 3x2+y2=1    (x,y)=(0,1) or (0,1) or (13,0) or (13,0)\begin{align*} f_x(x,y)=f_y(x,y)=0 &\iff{} xy=0\text{ and }3x^2+y^2=1 \\ &\iff{} \{x=0\text{ or }y=0\}\text{ and }3x^2+y^2=1 \\ &\iff{} (x,y)=(0,1)\text{ or }(0,-1)\text{ or }\left(\frac{1}{\sqrt{3}},0\right) \text{ or }\left(-\frac{1}{\sqrt{3}},0\right) \end{align*}

Here is a table giving the classification of each of the four critical points.

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,1)(0,1)0×022<00\times 0-2^2<0saddle point
(0,1)(0,-1)0×0(2)2<00\times 0-(-2)^2<0saddle point
(13,0)\big(\frac{1}{\sqrt{3}},0\big)23×2302>02\sqrt{3}\times\frac{2}{\sqrt{3}}-0^2>0232\sqrt{3}local min
(13,0)\big(-\frac{1}{\sqrt{3}},0\big)23×(23)02>0-2\sqrt{3}\times \big(-\frac{2}{\sqrt{3}}\big)-0^2>023-2\sqrt{3}local max
Q15Stage 2Past exam · M200 2000D

Find and classify all critical points of

f(x,y)=x33xy23x23y2f(x,y)=x^3-3xy^2-3x^2-3y^2
Answer

(1,±3)(-1,\pm\sqrt{3}) and (2,0)(2,0) are saddle points and (0,0)(0,0) is a local max.

Full solution

We have

f(x,y)=x33xy23x23y2fx(x,y)=3x23y26xfxx(x,y)=6x6fy(x,y)=6xy6yfyy(x,y)=6x6fxy(x,y)=6y\begin{alignat*}{5} f(x,y)&=x^3-3xy^2-3x^2-3y^2\qquad & f_x(x,y)&=3x^2-3y^2-6x\qquad & f_{xx}(x,y)&=6x-6 \\ & & f_y(x,y)&=-6xy-6y & f_{yy}(x,y)&=-6x-6 \\ & & & &f_{xy}(x,y)&=-6y \end{alignat*}

The first partial derivatives are defined everywhere. So the critical points are the solution of

fx(x,y)=fy(x,y)=0    3(x2y22x)=0 and 6y(x+1)=0    {x=1 or y=0} and x2y22x=0    (x,y)=(1,3) or (1,3) or (0,0) or (2,0)\begin{align*} f_x(x,y)=f_y(x,y)=0 &\iff{} 3(x^2-y^2-2x)=0\text{ and }-6y(x+1)=0 \\ &\iff{} \{x=-1\text{ or }y=0\}\text{ and }x^2-y^2-2x=0 \\ &\iff{} (x,y)=(-1,\sqrt{3})\text{ or }(-1,-\sqrt{3})\text{ or }(0,0) \text{ or }(2,0) \end{align*}

Here is a table giving the classification of each of the four critical points.

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(6)02>0(-6)\times(-6)-0^2>06-6local max
(2,0)(2,0)6×(18)02<06\times(-18)-0^2<0saddle point
(1,3)(-1,\sqrt{3})(12)×0(63)2<0(-12)\times0-(-6\sqrt{3})^2<0saddle point
(1,3)(-1,-\sqrt{3})(12)×0(63)2<0(-12)\times 0-(6\sqrt{3})^2<0saddle point

Stage 3 · Application

Q16Stage 3Past exam · M200 2014A

Consider the function

f(x,y)=3kx2y+y33x23y2+4\begin{equation*} f (x,y) = 3kx^2 y + y^3 - 3x^2 - 3y^2 + 4 \end{equation*}

where k>0k > 0 is a constant. Find and classify all critical points of f(x,y)f(x,y) as local minima, local maxima, saddle points or points of indeterminate type. Carefully distinguish the cases k<12k < \frac{1}{2}, k=12k = \frac{1}{2} and k>12k > \frac{1}{2}.

Answer

*Case k<12k<\frac{1}{2}: *

criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)local max
(0,2)(0,2)saddle point

*Case k=12k=\frac{1}{2}: *

criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)local max
(0,2)(0,2)unknown

*Case k>12k>\frac{1}{2}: *

criticalpoint\Atop{\text{critical}}{\text{point}}type
(0,0)(0,0)local max
(0,2)(0,2)local min
(1k3(2k1),1k)\left(\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right)saddle point
(1k3(2k1),1k)\left(-\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right)saddle point
Full solution

To find the critical points we will need the first order partial derivatives of ff and to apply the second derivative test of Theorem 16.1.14 in the text we will need all second order partial derivatives. So we need all partial derivatives of ff up to order two. Here they are.

f=3kx2y+y33x23y2+4fx=6kxy6xfxx=6ky6fxy=6kxfy=3kx2+3y26yfyy=6y6fyx=6kx\begin{alignat*}{3} f&=3kx^2 y + y^3 - 3x^2 - 3y^2 + 4 \\ f_x&=6kxy-6x & f_{xx}&=6ky-6 \qquad & f_{xy}&= 6kx\\ f_y&=3kx^2+3y^2-6y \qquad & f_{yy}&=6y-6\qquad & f_{yx}&= 6kx \end{alignat*}

(Of course, fxyf_{xy} and fyxf_{yx} have to be the same. It is still useful to compute both, as a way to catch some mechanical errors.)

The first partial derivatives are defined everywhere. So the critical points are the solution of

fx=6x(ky1)=0fy=3kx2+3y26y=0\begin{equation*} f_x=6x(ky-1)=0 \qquad f_y=3kx^2+3y^2-6y = 0 \end{equation*}

The first equation is satisfied if at least one of x=0x=0, y=1 ⁣/ky=\nicefrac{1}{k} are satisfied. (Recall that k>0k>0.)

  • If x=0x=0, the second equation reduces to 3y(y2)=03y(y-2)=0, which is satisfied if either y=0y=0 or y=2y=2.

  • If y=1 ⁣/ky=\nicefrac{1}{k}, the second equation reduces to 3kx2+3k26k=3kx2+3k2(12k)=03kx^2+\frac{3}{k^2}-\frac{6}{k}=3kx^2+\frac{3}{k^2}(1-2k)=0.

*Case k<12k<\frac{1}{2}: * If k<12k<\frac{1}{2}, then 3k2(12k)>0\frac{3}{k^2}(1-2k)>0 and the equation 3kx2+3k2(12k)=03kx^2+\frac{3}{k^2}(1-2k)=0 has no real solutions. In this case there are two critical points: (0,0)(0,0), (0,2)(0,2) and the classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(6)(0)2>0(-6)\times(-6)-(0)^2> 06-6local max
(0,2)(0,2)(12k6)×6(0)2<0(12k-6)\times 6-(0)^2<0saddle point

*Case k=12k=\frac{1}{2}: * If k=12k=\frac{1}{2}, then 3k2(12k)=0\frac{3}{k^2}(1-2k)=0 and the equation 3kx2+3k2(12k)=03kx^2+\frac{3}{k^2}(1-2k)=0 reduces to 3kx2=03kx^2=0 which has as its only solution x=0x=0. We have already seen this third critical point, x=0x=0, y=1 ⁣/k=2y=\nicefrac{1}{k}=2. So there are again two critical points: (0,0)(0,0), (0,2)(0,2) and the classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(6)(0)2>0(-6)\times(-6)-(0)^2> 06-6local max
(0,2)(0,2)(12k6)×6(0)2=0(12k-6)\times 6-(0)^2=0unknown

*Case k>12k>\frac{1}{2}: * If k>12k>\frac{1}{2}, then 3k2(12k)<0\frac{3}{k^2}(1-2k)<0 and the equation 3kx2+3k2(12k)=03kx^2+\frac{3}{k^2}(1-2k)=0 reduces to 3kx2=3k2(2k1)3kx^2=\frac{3}{k^2}(2k-1) which has two solutions, namely x=±1k3(2k1)x=\pm\sqrt{\frac{1}{k^3}(2k-1)}.
So there are four critical points: (0,0)(0,0), (0,2)(0,2), (1k3(2k1),1k)\left(\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right) and (1k3(2k1),1k)\left(-\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right) and the classification is

criticalpoint\Atop{\text{critical}}{\text{point}}fxxfyyfxy2f_{xx}f_{yy}-f_{xy}^2fxxf_{xx}type
(0,0)(0,0)(6)×(6)(0)2>0(-6)\times(-6)-(0)^2> 06-6local max
(0,2)(0,2)(12k6)×6(0)2>0(12k-6)\times 6-(0)^2>012k6>012k-6>0local min
(1k3(2k1),1k)\left(\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right)(66)×(6k6)(>0)2<0(6-6)\times (\frac{6}{k}-6)-(> 0)^2<0saddle point
(1k3(2k1),1k)\left(-\sqrt{\frac{1}{k^3}(2k-1)}\,,\,\frac{1}{k}\right)(66)×(6k6)(<0)2<0(6-6)\times (\frac{6}{k}-6)-(< 0)^2<0saddle point
Q17Stage 3

An experiment yields data points (xi,yi), i=1,2,,n.(x_i,y_i),\ i=1,2,\cdots,n. We wish to find the straight line y=mx+by=mx+b which “best" fits the data. The definition of “best" is “minimizes the root mean square error", i.e. minimizes i=1n(mxi+byi)2\sum_{i=1}^n (mx_i+b-y_i)^2. Find mm and bb.

Hint

Check Example 16.1.11 in the text.

Answer

m=nSxySxSynSx2Sx2m=\frac{nS_{xy}-S_xS_y}{nS_{x^2} -S_x^2} and b=SySx2SxSxynSx2Sx2b=\frac{S_yS_{x^2}-S_xS_{xy}}{nS_{x^2} -S_x^2} where Sy=i=1nyiS_y=\smsum\limits_{i=1}^n y_i, Sx2=i=1nxi2S_{x^2}=\smsum\limits_{i=1}^n x^2_i and Sxy=i=1nxiyiS_{xy}=\smsum\limits_{i=1}^n x_iy_i.

Full solution

We wish to choose mm and bb so as to minimize the (square of the) rms error E(m,b)=i=1n(mxi+byi)2E(m,b)=\sum\limits_{i=1}^n (mx_i+b-y_i)^2.

0=Em=i=1n2(mxi+byi)xi=m[i=1n2xi2]+b[i=1n2xi][i=1n2xiyi]0=Eb=i=1n2(mxi+byi)=m[i=1n2xi]+b[i=1n2][i=1n2yi]\begin{alignat*}{5} 0&=\pdiff{E}{m}&&=\smsum_{i=1}^n 2(mx_i+b-y_i)x_i &&=m\Big[\smsum_{i=1}^n 2x^2_i\Big]+b\Big[\smsum_{i=1}^n 2x_i\Big] -\Big[\smsum_{i=1}^n 2x_iy_i\Big]\\ 0&=\pdiff{E}{b}&&=\smsum_{i=1}^n 2(mx_i+b-y_i) &&=m\Big[\smsum_{i=1}^n 2x_i\Big]+b\Big[\smsum_{i=1}^n 2\Big] -\Big[\smsum_{i=1}^n 2y_i\Big] \end{alignat*}

Here, the first partial derivatives Em\pdiff{E}{m} and =Eb=\pdiff{E}{b} are defined everywhere and the critical points are the solution of

0=Em=i=1n2(mxi+byi)xi=m[i=1n2xi2]+b[i=1n2xi][i=1n2xiyi]0=Eb=i=1n2(mxi+byi)=m[i=1n2xi]+b[i=1n2][i=1n2yi]\begin{alignat*}{5} 0&=\pdiff{E}{m}&&=\smsum_{i=1}^n 2(mx_i+b-y_i)x_i &&=m\Big[\smsum_{i=1}^n 2x^2_i\Big]+b\Big[\smsum_{i=1}^n 2x_i\Big] -\Big[\smsum_{i=1}^n 2x_iy_i\Big]\\ 0&=\pdiff{E}{b}&&=\smsum_{i=1}^n 2(mx_i+b-y_i) &&=m\Big[\smsum_{i=1}^n 2x_i\Big]+b\Big[\smsum_{i=1}^n 2\Big] -\Big[\smsum_{i=1}^n 2y_i\Big] \end{alignat*}

There are a lot of symbols in those two equations. But remember that only two of them, namely mm and bb, are unknowns. All of the xix_i's and yiy_i's are given data. We can make the equations look a lot less imposing if we define Sx=i=1nxiS_x=\smsum_{i=1}^n x_i, Sy=i=1nyiS_y=\smsum_{i=1}^n y_i, Sx2=i=1nxi2S_{x^2}=\smsum_{i=1}^n x^2_i and Sxy=i=1nxiyiS_{xy}=\smsum_{i=1}^n x_iy_i. In terms of this notation, the two equations are (after dividing by two)

Sx2m+Sxb=SxySxm+nb=Sy\begin{align*} S_{x^2}\, m+S_x\, b&=S_{xy} \tag{\rm 1}\\ S_{x}\,m+n\,b&=S_{y} \tag{\rm 2} \end{align*}

This is a system of two linear equations in two unknowns. One way (This procedure is probably not the most efficient one. But it has the advantage that it always works, it does not require any ingenuity on the part of the solver, and it generalizes easily to larger linear systems of equations.) to solve them, is to use one of the two equations to solve for one of the two unknowns in terms of the other unknown. For example, equation (2) gives that

b=1n(SySxm)\begin{equation*} b=\frac{1}{n}\big(S_y-S_x\,m\big) \end{equation*}

If we now substitute this into equation (1) we get

Sx2m+Sxn(SySxm)=Sxy    (Sx2Sx2n)m=SxySxSyn\begin{equation*} S_{x^2}\, m+\frac{S_x}{n}\big(S_y-S_x\,m\big)=S_{xy} \implies{} \left(S_{x^2}-\frac{S_x^2}{n}\right)m = S_{xy} -\frac{S_xS_y}{n} \end{equation*}

which is a single equation in the single unkown mm. We can easily solve it for mm. It tells us that

m=nSxySxSynSx2Sx2\begin{equation*} m=\frac{nS_{xy}-S_xS_y}{nS_{x^2} -S_x^2} \end{equation*}

Then substituting this back into b=1n(SySxm)b=\frac{1}{n}\big(S_y-S_x\,m\big) gives us

b=SynSxn(nSxySxSynSx2Sx2)=SySx2SxSxynSx2Sx2\begin{equation*} b=\frac{S_y}{n} -\frac{S_x}{n}\left(\frac{nS_{xy}-S_xS_y}{nS_{x^2} -S_x^2}\right) =\frac{S_yS_{x^2}-S_xS_{xy}}{nS_{x^2} -S_x^2} \end{equation*}

From the UBC Math 100 open textbook project, © Joel Feldman, Andrew Rechnitzer, Elyse Yeager and others. Licensed CC BY-NC-SA 4.0; this HTML adaptation is released under the same licence. Full attribution.