Mathematics · Book 3 · Bachelor Year 1

University Mathematics — Year 1

University Mathematics — Year 1 · Bachelor Year 1

25Functions of Two Variables

The year ends with a first walk into higher dimension: functions f(x,y)f(x, y) of two real variables. Everything generalizes — limits, continuity, derivatives, extrema — but each notion gains a twist: limits can be approached along every direction at once, derivatives split into partials, and the gradient points the way uphill. The full theory (differentials, general Rn\R^n, submanifolds) belongs to the second year; here we set the vocabulary and the first honest theorems.

25.1 The plane R2\R^2; continuity

Definition 25.1

On R2\R^2, use the Euclidean norm (x,y)=x2+y2\norm{(x,y)} = \sqrt{x^2 + y^2} (Chapter 23). Open balls, neighborhoods, open subsets of R2\R^2 are defined exactly as in Chapter 12, with balls in place of intervals. A function f ⁣:URf \colon U \to \R (UR2U \subseteq \R^2 open) is continuous at aUa \in U when

ε>0, δ>0,Xaδ    f(X)f(a)ε,\forall\varepsilon > 0,\ \exists\delta > 0, \quad \norm{X - a} \leq \delta \implies \abs{f(X) - f(a)} \leq \varepsilon,

with the same sequential characterization as in one variable. Sums, products, quotients and compositions with continuous one-variable functions preserve continuity; the coordinate maps are continuous, hence so are polynomials in (x,y)(x,y).

Example 25.2 (The polar bound, the clean way to prove a limit)

Show that f(x,y)=x2y2x2+y2f(x, y) = \dfrac{x^2y^2}{x^2 + y^2} (with f(0,0)=0f(0,0) = 0) is continuous at the origin. In polar coordinates x=ρcosθx = \rho\cos\theta, y=ρsinθy = \rho\sin\theta:

f=ρ4cos2θsin2θρ2=ρ2(cosθsinθ)2ρ24ρ00,\abs{f} = \frac{\rho^4\cos^2\theta\sin^2\theta}{\rho^2} = \rho^2\,(\cos\theta\sin\theta)^2 \leq \frac{\rho^2}{4} \xrightarrow[\rho \to 0]{} 0 ,

a bound independent of θ\theta: whatever the direction of approach, the values are squeezed to 00. That uniformity in θ\theta is the whole point — a bound like g=cosθsinθ\abs g = \abs{\cos\theta\sin\theta} (no ρ\rho left) proves nothing, and indeed that gg is the discontinuous radial trap of the next example.

Example 25.3 (The radial trap)

Let f(x,y)=xyx2+y2f(x, y) = \dfrac{xy}{x^2 + y^2} for (x,y)(0,0)(x,y) \neq (0,0), f(0,0)=0f(0, 0) = 0. Along each axis, f=00f = 0 \to 0; but along the diagonal y=xy = x, f(x,x)=12↛0f(x, x) = \frac12 \not\to 0. No limit at the origin: approaching along every line, and even finding the same limit along each, is not enough (here the line limits disagree; worse examples agree along all lines yet fail along a parabola, Exercise 25.3). Continuity in each variable separately does not imply continuity.

25.2 Partial derivatives

Definition 25.4

The partial derivatives of ff at (a,b)(a, b) are the one-variable derivatives along the axes:

fx(a,b)=limh0f(a+h,b)f(a,b)h,fy(a,b)=limk0f(a,b+k)f(a,b)k.\frac{\partial f}{\partial x}(a,b) = \lim_{h \to 0} \frac{f(a + h, b) - f(a,b)}{h}, \qquad \frac{\partial f}{\partial y}(a,b) = \lim_{k \to 0} \frac{f(a, b + k) - f(a,b)}{k}.

ff is of class C1C^1 on UU when both exist and are continuous on UU. The gradient is f(a,b)=(fx,fy)(a,b)\nabla f(a,b) = \bigl(\frac{\partial f}{\partial x},\, \frac{\partial f}{\partial y}\bigr)(a,b).

Theorem 25.5 (C1C^1 implies a tangent plane)

Let ff be C1C^1 on UU and (a,b)U(a,b) \in U. Then, as (h,k)(0,0)(h, k) \to (0,0):

f(a+h,b+k)=f(a,b)+hfx(a,b)+kfy(a,b)+o((h,k)).f(a + h, b + k) = f(a, b) + h\,\frac{\partial f}{\partial x}(a,b) + k\,\frac{\partial f}{\partial y}(a,b) + o\bigl(\norm{(h,k)}\bigr) .

In particular ff is continuous, and the graph z=f(x,y)z = f(x,y) has at each point the tangent plane read off the formula.

Example 25.6 (Linear approximation in action)

Estimate f(1.02, 0.99)f(1.02,\ 0.99) for f(x,y)=x3y2f(x, y) = x^3y^2. At (1,1)(1, 1): f=1f = 1, fx=3x2y2=3\frac{\partial f}{\partial x} = 3x^2y^2 = 3, fy=2x3y=2\frac{\partial f}{\partial y} = 2x^3y = 2, so Theorem 25.5 gives

f(1.02, 0.99)1+3(0.02)+2(0.01)=1.04,f(1.02,\ 0.99) \approx 1 + 3\,(0.02) + 2\,(-0.01) = 1.04 ,

against the true value 1.023×0.992=1.040061.02^3 \times 0.99^2 = 1.04006\dots — the error is of second order in the increments, as the o((h,k))o(\norm{(h,k)}) promises. The tangent plane to the graph at (1,1,1)(1, 1, 1) is z=1+3(x1)+2(y1)z = 1 + 3(x - 1) + 2(y - 1), the equation implicit in the estimate.

Proof. Move one coordinate at a time:

f(a+h,b+k)f(a,b)=[f(a+h,b+k)f(a,b+k)]+[f(a,b+k)f(a,b)].f(a+h, b+k) - f(a,b) = \bigl[f(a+h, b+k) - f(a, b+k)\bigr] + \bigl[f(a, b+k) - f(a,b)\bigr].

By the one-variable mean value theorem (Theorem 14.9), the first bracket is hfx(a+θh,b+k)h\, \frac{\partial f}{\partial x}(a + \theta h,\, b + k) for some θ(0,1)\theta \in \intoo{0}{1}, and the second is kfy(a,b+θk)k\,\frac{\partial f}{\partial y}(a,\, b + \theta' k). Continuity of the partials at (a,b)(a,b) lets us write each as (value at (a,b)(a,b)) ++ (error 0\to 0); the total error is hε1+kε2=o((h,k))h\,\varepsilon_1 + k\,\varepsilon_2 = o(\norm{(h,k)}) since h,k(h,k)\abs h, \abs k \leq \norm{(h,k)}.

Theorem 25.7 (Chain rule)

Let ff be C1C^1 on UU and t(x(t),y(t))t \mapsto (x(t), y(t)) be C1C^1 from an interval into UU. Then g(t)=f(x(t),y(t))g(t) = f\bigl(x(t), y(t)\bigr) is C1C^1, with

g(t)=x(t)fx(x(t),y(t))+y(t)fy(x(t),y(t))=f, (x,y).g'(t) = x'(t)\,\frac{\partial f}{\partial x}\bigl(x(t),y(t)\bigr) + y'(t)\,\frac{\partial f}{\partial y}\bigl(x(t),y(t)\bigr) = \bigl\langle \nabla f,\ (x', y')\bigr\rangle .

Proof. Apply Theorem 25.5 at (x(t),y(t))(x(t), y(t)) with (h,k)=(x(t+s)x(t),y(t+s)y(t))(h, k) = (x(t+s) - x(t),\, y(t+s) - y(t)): as s0s \to 0, one-variable differentiability gives h=sx(t)+o(s)h = s\,x'(t) + o(s) and k=sy(t)+o(s)k = s\,y'(t) + o(s), so (h,k)=O(s)\norm{(h, k)} = O(s) and

g(t+s)g(t)=hfx+kfy+o((h,k))=s(xfx+yfy)+o(s),g(t+s) - g(t) = h\,\frac{\partial f}{\partial x} + k\,\frac{\partial f}{\partial y} + o\bigl(\norm{(h,k)}\bigr) = s\,\Bigl(x'\,\frac{\partial f}{\partial x} + y'\,\frac{\partial f}{\partial y}\Bigr) + o(s) ,

the final error absorbing both the o(s)o(s)’s of hh and kk (multiplied by the fixed values of the partials) and the o(O(s))o(O(s)) of the tangent-plane estimate. Divide by ss and let s0s \to 0. Continuity of gg' follows from that of all ingredients.

Example 25.8 (The chain rule, verified both ways)

Let f(x,y)=x2yf(x, y) = x^2 y and g(t)=f(t,t2)g(t) = f(t, t^2). Directly: g(t)=t2t2=t4g(t) = t^2\cdot t^2 = t^4, so g(t)=4t3g'(t) = 4t^3. By the chain rule: fx=2xy\frac{\partial f}{\partial x} = 2xy and fy=x2\frac{\partial f}{\partial y} = x^2, evaluated along the curve (t,t2)(t, t^2):

g(t)=12tt2+2tt2=2t3+2t3=4t3.g'(t) = 1\cdot 2t\cdot t^2 + 2t\cdot t^2 = 2t^3 + 2t^3 = 4t^3 .

The two computations agree, and the split is meaningful: 2t32t^3 of the growth comes from moving rightward through the xx-slope, 2t32t^3 from moving upward through the yy-slope. On curves where no closed form for gg exists, only the second computation survives — that is the theorem’s point.

Remark 25.9 (Reading the gradient)

Along a unit direction uu, the chain rule on tf(a+tu)t \mapsto f(a + tu) gives the directional derivative f(a),u\langle \nabla f(a), u\rangle: maximal when uu points along f(a)\nabla f(a) (by Cauchy–Schwarz, Theorem 23.4). The gradient is the direction of steepest ascent, and it is orthogonal to the level curves {f=c}\{f = c\} (differentiate ff along a curve drawn in a level set: the chain rule gives f,tangent=0\langle\nabla f,\, \text{tangent}\rangle = 0).

Example 25.10 (Level curves and gradients, on one function)

Take f(x,y)=x2y2f(x, y) = x^2 - y^2. Its level sets: {f=c}\{f = c\} is a hyperbola opening left-right for c>0c > 0, up-down for c<0c < 0, and the crossed pair of lines y=±xy = \pm x for c=0c = 0 — the contour map of a mountain pass, with the saddle point at the origin where the two zero-level lines cross. Gradient: f=(2x,2y)\nabla f = (2x, -2y). At the point (2,1)(2, 1) (on the level c=3c = 3): f=(4,2)\nabla f = (4, -2), while the tangent vector of the level curve, parametrized near that point by (t,t23)\bigl(t, \sqrt{t^2 - 3}\bigr), is (1,tt23)=(1,2)\bigl(1, \frac{t}{\sqrt{t^2 - 3}}\bigr) = (1, 2) at t=2t = 2 — and indeed

(4,2), (1,2)=44=0:\langle (4, -2),\ (1, 2)\rangle = 4 - 4 = 0 :

gradient perpendicular to the contour, pointing toward higher values of ff (here: away from the yy-axis). Two more readings: the gradient vanishes exactly at the saddle, where the contour map pinches; and the tangent line to the level curve at (2,1)(2,1) is 4(x2)2(y1)=04(x - 2) - 2(y - 1) = 0, i.e. 2xy=32x - y = 3 — the equation “f, MM0=0\langle \nabla f,\ M - M_0\rangle = 0” that generalizes the ellipse tangent of Exercise 24.11.

Theorem 25.11 (Schwarz)

If ff is of class C2C^2 (partials of partials exist and are continuous), then

2fxy=2fyx.\frac{\partial^2 f}{\partial x\,\partial y} = \frac{\partial^2 f}{\partial y\,\partial x} .

Proof. Admitted at this level.

25.3 Local extrema

Method 25.12 (Extremum studies, organized)

  1. Solve f=0\nabla f = 0 completely. Factor each partial whenever possible (products of linear factors split the system into transparent cases, as in Example 25.16 below); a forgotten case is a forgotten critical point.
  2. Classify each point with the Monge data r,s,tr, s, t — recomputed at each point, never once for all.
  3. If rts2=0rt - s^2 = 0, examine ff directly along well-chosen curves through the point (lines first, then parabolas), hunting either for two signs (no extremum) or for a locked sign with an argument covering all directions.
  4. Step back for the global picture: check the behavior at infinity (a local minimum may be no global one), and if the domain is not open, treat its boundary separately (Exercise 25.12) — the critical point theorem sees interior points only.

Theorem 25.13 (Critical points)

If ff (C1C^1 on the open set UU) has a local extremum at (a,b)U(a,b) \in U, then f(a,b)=(0,0)\nabla f(a,b) = (0,0): the point is critical.

Proof. The one-variable functions xf(x,b)x \mapsto f(x, b) and yf(a,y)y \mapsto f(a, y) have interior local extrema at aa, resp. bb: Proposition 14.7 kills both partials.

Method 25.14 (Second-order test (Monge notation))

At a critical point of a C2C^2 function, set

r=2fx2,s=2fxy,t=2fy2(values at the point).r = \frac{\partial^2 f}{\partial x^2}, \qquad s = \frac{\partial^2 f}{\partial x \partial y}, \qquad t = \frac{\partial^2 f}{\partial y^2} \qquad (\text{values at the point}).
  • If rts2>0rt - s^2 > 0: local extremum — minimum for r>0r > 0, maximum for r<0r < 0;
  • if rts2<0rt - s^2 < 0: no extremum (a saddle point);
  • if rts2=0rt - s^2 = 0: the test is silent; examine directly.

(Justification — a Taylor–Young expansion at order 22 and the sign study of the quadratic form rh2+2shk+tk2r h^2 + 2shk + tk^2 — is carried out in the second year; the test is used here as a working tool.)

Example 25.15

f(x,y)=x3+y33xyf(x,y) = x^3 + y^3 - 3xy. Critical points: f=(3x23y,  3y23x)=0\nabla f = (3x^2 - 3y,\; 3y^2 - 3x) = 0 gives y=x2y = x^2 and x=y2x = y^2, so x=x4x = x^4: x{0,1}x \in \{0, 1\}: points (0,0)(0,0) and (1,1)(1,1).

Second derivatives: r=6xr = 6x, s=3s = -3, t=6yt = 6y. At (0,0)(0,0): rts2=9<0rt - s^2 = -9 < 0: saddle. At (1,1)(1,1): rts2=369>0rt - s^2 = 36 - 9 > 0, r=6>0r = 6 > 0: local minimum, f(1,1)=1f(1,1) = -1. (Not global: f(x,0)=x3f(x, 0) = x^3 \to -\infty.)

Example 25.16 (A four-point study, in full)

f(x,y)=xy(3xy)=3xyx2yxy2f(x, y) = xy\,(3 - x - y) = 3xy - x^2y - xy^2. Gradient:

fx=y(32xy),fy=x(3x2y).\frac{\partial f}{\partial x} = y\,(3 - 2x - y), \qquad \frac{\partial f}{\partial y} = x\,(3 - x - 2y).

Critical points: if y=0y = 0, the second equation gives x{0,3}x \in \{0, 3\}; if x=0x = 0, the first gives y{0,3}y \in \{0, 3\}; if xy0xy \neq 0, solve 2x+y=32x + y = 3, x+2y=3x + 2y = 3: x=y=1x = y = 1. Four points: (0,0)(0,0), (3,0)(3,0), (0,3)(0,3), (1,1)(1,1). Second derivatives: r=2yr = -2y, s=32x2ys = 3 - 2x - 2y, t=2xt = -2x.

  • (1,1)(1,1): r=2r = -2, s=1s = -1, t=2t = -2: rts2=3>0rt - s^2 = 3 > 0, r<0r < 0: local maximum, f(1,1)=1f(1,1) = 1.
  • (0,0)(0,0): r=t=0r = t = 0, s=3s = 3: rts2=9<0rt - s^2 = -9 < 0: saddle; likewise (3,0)(3, 0) (s=3s = -3) and (0,3)(0, 3): three saddles.

The maximum is only local: f(T,T)=T2(3+2T)+f(-T, -T) = T^2(3 + 2T) \to +\infty. Symmetry check: f(x,y)=f(y,x)f(x, y) = f(y, x), and indeed the critical set and the classification are symmetric in xyx \leftrightarrow y. Interpretation: among rectangles-with-slack x,y0x, y \geq 0, x+y3x + y \leq 3, the product xy(3xy)xy(3 - x - y) of the three “parts” of 33 is largest when the parts are equal — a two-variable shadow of the AM–GM principle.

The two curves f = 0 for f = x3 + y3 - 3xy intersect at the critical points (0,0) (saddle) and (1,1) (local minimum).
The two curves f=0\nabla f = 0 for f=x3+y33xyf = x^3 + y^3 - 3xy intersect at the critical points (0,0)(0,0) (saddle) and (1,1)(1,1) (local minimum).

Remark 25.17 (Common pitfalls)

Partial derivatives may exist at a point of discontinuity: the radial trap g(x,y)=xyx2+y2g(x,y) = \frac{xy}{x^2+y^2} of Example 25.3 has gx(0,0)=gy(0,0)=0\frac{\partial g}{\partial x}(0,0) = \frac{\partial g}{\partial y}(0,0) = 0 (both axis restrictions vanish identically), yet gg has no limit at the origin — partials probe two directions only, continuity needs all of them; only the C1C^1 hypothesis restores order (Theorem 25.5). Line limits never suffice: Exercise 25.3’s function has limit 00 along every line and still no limit — always try parabolas (or polar bounds valid uniformly in θ\theta). Critical is necessary, not sufficient: saddles abound (three of four points in Example 25.16); and the theorem holds on open sets only — on a closed disc, extrema may sit on the boundary with nonzero gradient (Exercise 25.12). The silent case rts2=0rt - s^2 = 0 is genuinely silent: x4+y4x^4 + y^4 (minimum) and x3+y3x^3 + y^3 (neither) both have r=s=t=0r = s = t = 0 at the origin; only a direct sign study decides (Exercise 25.6, function hh). The gradient is orthogonal to level curves, not along them: to follow a contour line, move perpendicular to f\nabla f; to climb fastest, move along it — mixing the two reverses the geometry of every contour map.

Remark 25.18 (Where two variables lead)

This chapter is a doorway. The gradient and the chain rule extend verbatim to nn variables in the Year 2 volume, where the o((h,k))o(\norm{(h,k)}) of Theorem 25.5 becomes the differential and the Monge test is proved in full via the order-two Taylor formula and quadratic forms. The special case that can be settled this year — quadratic functions, for which the second-order expansion is exact — is the subject of the weekend problem, and it happens to be the case that runs the world’s data fitting: least squares regression. Constrained extrema (Exercise 25.5 was a preview) become Lagrange multipliers in Year 2; harmonic functions (Exercise 25.7) return in the complex analysis of the Year 3 volume.

Remark 25.19 (Perspectives inside Book 3: the year, closed)

This chapter is where the volume’s two halves shake hands. The analysis half supplied its tools one derivative at a time: the mean value theorem drives Theorem 25.5, Taylor expansions drive the extremum tests, and the ε\varepsilon’s of Chapter 12 came back with balls instead of intervals. The algebra half supplied the geometry: the gradient is read through the inner product of Chapter 23 (Cauchy–Schwarz makes it the steepest direction), the Monge data (r,s,t)(r, s, t) is a symmetric matrix of Chapter 21 with the determinant test of Chapter 22, and the weekend problem runs orthogonal projection on data vectors. Even the curves of Chapter 24 return as level sets. A reader who can reconstruct why each of these five hand-offs works has, in effect, revised the entire year — which is the real purpose of this final chapter.

Least squares in one picture: four data points, the regression line y = 1.4x - 0.1, and the vertical residuals (dashed) whose squares the line minimizes — total 0.2, the smallest achievable. The weekend problem computes this line, proves it is the unique minimizer, and identifies the whole construction with an orthogonal projection in ℝ4.
Least squares in one picture: four data points, the regression line y=1.4x0.1y = 1.4x - 0.1, and the vertical residuals (dashed) whose squares the line minimizes — total 0.20.2, the smallest achievable. The weekend problem computes this line, proves it is the unique minimizer, and identifies the whole construction with an orthogonal projection in R4\R^4.

25.4 Exercises

Exercise 25.1

Compute the partial derivatives: f(x,y)=x2y+exyf(x,y) = x^2 y + \eu^{xy};   g(x,y)=ln(x2+y2)\;g(x,y) = \ln(x^2 + y^2) (on R2{0}\R^2\setminus\{0\});   h(x,y)=arctanyx\;h(x,y) = \arctan\frac yx (on x>0x > 0).

Solution

Solution of Exercise 25.1.

fx=2xy+yexy\dfrac{\partial f}{\partial x} = 2xy + y\,\eu^{xy}, fy=x2+xexy\dfrac{\partial f}{\partial y} = x^2 + x\,\eu^{xy}.

gx=2xx2+y2\dfrac{\partial g}{\partial x} = \dfrac{2x}{x^2+y^2}, gy=2yx2+y2\dfrac{\partial g}{\partial y} = \dfrac{2y}{x^2+y^2}.

hx=y/x21+y2/x2=yx2+y2\dfrac{\partial h}{\partial x} = \dfrac{-y/x^2}{1 + y^2/x^2} = \dfrac{-y}{x^2+y^2}, hy=xx2+y2\dfrac{\partial h}{\partial y} = \dfrac{x}{x^2+y^2}.

Exercise 25.2

Study the continuity at (0,0)(0,0) (with value 00 there) of:

f(x,y)=x2yx2+y2,g(x,y)=xyx2+y2,h(x,y)=x3+y3x2+y2.f(x,y) = \frac{x^2 y}{x^2 + y^2}, \qquad g(x,y) = \frac{xy}{x^2 + y^2}, \qquad h(x,y) = \frac{x^3 + y^3}{x^2 + y^2}.

(Polar coordinates x=ρcosθx = \rho\cos\theta, y=ρsinθy = \rho\sin\theta help: bound by a function of ρ\rho alone when possible.)

Solution

Solution of Exercise 25.2.

In polar coordinates (ρ0\rho \to 0):

f=ρ3cos2θsinθρ2ρ0\abs{f} = \dfrac{\rho^3\abs{\cos^2\theta\sin\theta}}{\rho^2} \leq \rho \to 0: continuous.

g=cosθsinθg = \cos\theta\sin\theta: independent of ρ\rho, taking different values along different rays (cf. Example 25.3): no limit, not continuous.

hρ3(cos3θ+sin3θ)ρ22ρ0\abs h \leq \dfrac{\rho^3(\abs{\cos^3\theta} + \abs{\sin^3\theta})}{\rho^2} \leq 2\rho \to 0: continuous.

Exercise 25.3 ★★

Let f(x,y)=x2yx4+y2f(x,y) = \dfrac{x^2 y}{x^4 + y^2} (f(0,0)=0f(0,0) = 0). Prove that ff has limit 00 at the origin along every straight line, but that f(x,x2)=12f\bigl(x, x^2\bigr) = \frac12: ff is not continuous at (0,0)(0,0).

Solution

Solution of Exercise 25.3.

Along y=mxy = mx: f(x,mx)=mx3x4+m2x2=mxx2+m20f(x, mx) = \dfrac{m x^3}{x^4 + m^2 x^2} = \dfrac{mx}{x^2 + m^2} \to 0 (for m0m \neq 0; along y=0y = 0 and the yy-axis, f=0f = 0). So every straight-line limit is 00. But on the parabola y=x2y = x^2:

f(x,x2)=x4x4+x4=12:f(x, x^2) = \frac{x^4}{x^4 + x^4} = \frac12 :

the sequence (1n,1n2)(0,0)\bigl(\frac1n, \frac{1}{n^2}\bigr) \to (0,0) has f120f \to \frac12 \neq 0. Not continuous: lines do not suffice to test two-variable limits.

Exercise 25.4

Verify Schwarz’s theorem by hand on f(x,y)=x3y2+sin(xy)f(x, y) = x^3 y^2 + \sin(xy).

Solution

Solution of Exercise 25.4.

fx=3x2y2+ycos(xy)\frac{\partial f}{\partial x} = 3x^2y^2 + y\cos(xy); then

2fyx=6x2y+cos(xy)xysin(xy).\frac{\partial^2 f}{\partial y\,\partial x} = 6x^2 y + \cos(xy) - xy\sin(xy) .

fy=2x3y+xcos(xy)\frac{\partial f}{\partial y} = 2x^3 y + x\cos(xy); then

2fxy=6x2y+cos(xy)xysin(xy):\frac{\partial^2 f}{\partial x\,\partial y} = 6x^2 y + \cos(xy) - xy\sin(xy) :

equal, as Schwarz promises.

Exercise 25.5 ★★

Let ff be C1C^1 on R2\R^2 and g(t)=f(cost,sint)g(t) = f(\cos t, \sin t). Express g(t)g'(t) via the chain rule. Deduce that ff restricted to the unit circle attains extrema at points where f\nabla f is parallel to the radius vector.

Solution

Solution of Exercise 25.5.

By Theorem 25.7 with (x,y)=(cost,sint)(x, y) = (\cos t, \sin t):

g(t)=sintfx(cost,sint)+costfy(cost,sint)=f, (sint,cost).g'(t) = -\sin t\,\frac{\partial f}{\partial x}(\cos t, \sin t) + \cos t\,\frac{\partial f}{\partial y}(\cos t, \sin t) = \bigl\langle \nabla f,\ (-\sin t, \cos t)\bigr\rangle .

At an extremum of gg, g(t)=0g'(t) = 0: f\nabla f is orthogonal to the tangent vector (sint,cost)(-\sin t, \cos t) of the circle, hence parallel to the radius vector (cost,sint)(\cos t, \sin t) (the plane orthogonal complement of a unit vector is the line it spans, taken perpendicular). This is the simplest instance of a Lagrange multiplier.

Exercise 25.6 ★★

Find and classify the critical points of:

f(x,y)=x2+xy+y23x,g(x,y)=x2y2+4y,h(x,y)=x4+y42(xy)2.f(x, y) = x^2 + xy + y^2 - 3x, \qquad g(x, y) = x^2 - y^2 + 4y, \qquad h(x, y) = x^4 + y^4 - 2(x - y)^2 .

(For hh, the determinant test is silent at the origin: examine h(x,x)h(x, x) and h(x,x)h(x, -x).)

Solution

Solution of Exercise 25.6.

ff: f=(2x+y3,  x+2y)=0\nabla f = (2x + y - 3,\; x + 2y) = 0: y=x2y = -\frac x2 and 2xx2=32x - \frac x2 = 3: x=2x = 2, y=1y = -1. Second order: r=2r = 2, s=1s = 1, t=2t = 2: rts2=3>0rt - s^2 = 3 > 0, r>0r > 0: local (indeed global — quadratic) minimum at (2,1)(2, -1), value f(2,1)=3f(2,-1) = -3.

gg: g=(2x,  2y+4)=0\nabla g = (2x,\; -2y + 4) = 0: point (0,2)(0, 2); r=2r = 2, s=0s = 0, t=2t = -2: rts2=4<0rt - s^2 = -4 < 0: saddle.

hh: h=(4x34(xy),  4y3+4(xy))=0\nabla h = \bigl(4x^3 - 4(x - y),\; 4y^3 + 4(x-y)\bigr) = 0. Adding: x3+y3=0x^3 + y^3 = 0, so y=xy = -x; substituting: 4x38x=04x^3 - 8x = 0: x{0,±2}x \in \{0, \pm\sqrt2\}. Critical points: (0,0)(0,0), (2,2)(\sqrt2, -\sqrt2), (2,2)(-\sqrt2, \sqrt2). At (±2,2)(\pm\sqrt2, \mp\sqrt2): r=12x24=20r = 12x^2 - 4 = 20, s=4s = 4, t=20t = 20: rts2>0rt - s^2 > 0, r>0r > 0: local minima (value h=4+416=8h = 4 + 4 - 16 = -8). At (0,0)(0,0): r=t=4r = t = -4, s=4s = 4: rts2=0rt - s^2 = 0: silent. Examine: h(x,x)=2x4>0h(x, x) = 2x^4 > 0 and h(x,x)=2x48x2<0h(x, -x) = 2x^4 - 8x^2 < 0 for small x0x \neq 0: both signs in every neighborhood — no extremum at the origin.

Exercise 25.7 ★★

A function ff is harmonic when 2fx2+2fy2=0\frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} = 0. Check that x2y2x^2 - y^2, xyxy, excosy\eu^x\cos y and ln(x2+y2)\ln(x^2 + y^2) (off the origin) are harmonic.

Solution

Solution of Exercise 25.7.

x2y2x^2 - y^2: second partials 22 and 2-2: sum 00. xyxy: both pure second partials vanish. excosy\eu^x\cos y: 2x2=excosy\frac{\partial^2}{\partial x^2} = \eu^x\cos y, 2y2=excosy\frac{\partial^2}{\partial y^2} = -\eu^x\cos y: sum 00. ln(x2+y2)\ln(x^2+y^2): from Exercise 25.1,

2x2ln(x2+y2)=2(x2+y2)4x2(x2+y2)2=2(y2x2)(x2+y2)2,\frac{\partial^2}{\partial x^2}\ln(x^2+y^2) = \frac{2(x^2+y^2) - 4x^2}{(x^2+y^2)^2} = \frac{2(y^2 - x^2)}{(x^2+y^2)^2},

and the yy-version is its opposite: sum 00.

Exercise 25.8 ★★★

Find the point of the plane {x+2yz=4}R3\{x + 2y - z = 4\} \subseteq \R^3 closest to the origin, two ways: by orthogonal projection (Chapter 23), and by minimizing the two-variable function f(x,y)=x2+y2+(x+2y4)2f(x, y) = x^2 + y^2 + (x + 2y - 4)^2 obtained by eliminating zz.

Solution

Solution of Exercise 25.8.

Projection: the plane PP has normal n=(1,2,1)n = (1, 2, -1) and passes through A=(4,0,0)A = (4, 0, 0). The closest point to the origin is OO projected: p=O+AO,nn2n=46(1,2,1)=(23,43,23)p = O + \frac{\langle A - O, n\rangle}{\norm n^2}\,n = \frac{4}{6}(1,2,-1) = \bigl(\frac23, \frac43, -\frac23\bigr), at distance 46\frac{4}{\sqrt 6}. (Formula: distance from origin to plane X,n=c\langle X, n \rangle = c is cn\frac{\abs c}{\norm n} with c=4c = 4.)

Minimization: f(x,y)=x2+y2+(x+2y4)2f(x,y) = x^2 + y^2 + (x + 2y - 4)^2. Writing w=x+2y4w = x + 2y - 4 for the last factor:

f=(2x+2w,  2y+4w)=0    x=w and y=2w.\nabla f = \bigl(2x + 2w,\; 2y + 4w\bigr) = 0 \iff x = -w \text{ and } y = -2w .

Substituting into the definition of ww: w=w4w4w = -w - 4w - 4, so w=23w = -\frac23, giving x=23x = \frac23, y=43y = \frac43, and z=w=23z = w = -\frac23. Same point as by projection, at distance 49+169+49=263=46\sqrt{\frac49 + \frac{16}{9} + \frac49} = \frac{2\sqrt 6}{3} = \frac{4}{\sqrt6}; it is a minimum since ff \to \infty at infinity (a positive-definite quadratic plus linear terms).

Exercise 25.9 ★★★

(Laplacian in polar coordinates, first contact) Let ff be C2C^2 on R2{0}\R^2 \setminus \{0\} and radial: f(x,y)=φ(x2+y2)f(x, y) = \varphi\bigl(\sqrt{x^2+y^2}\bigr) with φ\varphi of class C2C^2 on (0,+)\intoo{0}{+\infty}. Prove that

2fx2+2fy2=φ(ρ)+φ(ρ)ρ,ρ=x2+y2,\frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} = \varphi''(\rho) + \frac{\varphi'(\rho)}{\rho}, \qquad \rho = \sqrt{x^2 + y^2},

and find all radial harmonic functions on the punctured plane.

Solution

Solution of Exercise 25.9.

With ρ=x2+y2\rho = \sqrt{x^2+y^2}: ρx=xρ\frac{\partial \rho}{\partial x} = \frac{x}{\rho}, so

fx=φ(ρ)xρ,2fx2=φ(ρ)x2ρ2+φ(ρ)(1ρx2ρ3),\frac{\partial f}{\partial x} = \varphi'(\rho)\,\frac{x}{\rho}, \qquad \frac{\partial^2 f}{\partial x^2} = \varphi''(\rho)\,\frac{x^2}{\rho^2} + \varphi'(\rho)\,\Bigl(\frac{1}{\rho} - \frac{x^2}{\rho^3}\Bigr),

(quotient and chain rules). Adding the symmetric yy-expression: the φ\varphi'' terms collect x2+y2ρ2=1\frac{x^2 + y^2}{\rho^2} = 1, the φ\varphi' terms collect 2ρx2+y2ρ3=1ρ\frac{2}{\rho} - \frac{x^2 + y^2}{\rho^3} = \frac{1}{\rho}:

Δf=φ+φρ.\Delta f = \varphi'' + \frac{\varphi'}{\rho} .

Radial harmonic: solve φ+φρ=0\varphi'' + \frac{\varphi'}{\rho} = 0: the first-order equation u+uρ=0u' + \frac u\rho = 0 for u=φu = \varphi' gives u=cρu = \frac{c}{\rho} (Theorem 5.2), then φ=clnρ+d\varphi = c\ln\rho + d. The radial harmonic functions are clnx2+y2+dc\,\ln\sqrt{x^2 + y^2} + d — the logarithmic potential of Exercise 25.7 and the constants, nothing else.

Exercise 25.10 ★★

Give the equation of the tangent plane to the graph z=xyz = xy at the point (1,1,1)(1, 1, 1). Then find all points of the graph of f(x,y)=x3+y33xyf(x,y) = x^3 + y^3 - 3xy where the tangent plane is horizontal, and relate the answer to Example 25.15.

Solution

Solution of Exercise 25.10.

For z=xyz = xy at (1,1)(1,1): partials y=1y = 1 and x=1x = 1, tangent plane z=1+(x1)+(y1)=x+y1z = 1 + (x - 1) + (y - 1) = x + y - 1. Horizontal tangent plane means both partials vanish, i.e. f=0\nabla f = 0: by Example 25.15, exactly the critical points (0,0)(0, 0) and (1,1)(1, 1), with horizontal planes z=0z = 0 and z=1z = -1. “Horizontal tangent plane” and “critical point” are the same notion, seen on the graph and in the formula.

Exercise 25.11 ★★

Let ff be C1C^1 on R2\R^2.

  1. If fx=0\frac{\partial f}{\partial x} = 0 everywhere, prove that f(x,y)f(x, y) depends only on yy.
  2. Find all C1C^1 solutions of the equation fx=fy\frac{\partial f}{\partial x} = \frac{\partial f}{\partial y} on R2\R^2. (Set g(u,v)=f(u+v2,uv2)g(u, v) = f\bigl(\frac{u+v}2, \frac{u-v}2\bigr) and compute gv\frac{\partial g}{\partial v} by the chain rule.)
Solution

Solution of Exercise 25.11.

  1. For fixed yy, the one-variable function xf(x,y)x \mapsto f(x,y) has zero derivative on R\R, hence is constant (Theorem 14.9): f(x,y)=f(0,y)f(x, y) = f(0, y) for all xx: ff depends only on yy.
  2. Let g(u,v)=f(u+v2,uv2)g(u, v) = f\bigl(\frac{u+v}2, \frac{u-v}2\bigr). By the chain rule (Theorem 25.7, applied in the variable vv with uu frozen):

    gv=12fx12fy=0.\frac{\partial g}{\partial v} = \frac12\,\frac{\partial f}{\partial x} - \frac12\,\frac{\partial f}{\partial y} = 0 .

    By (1), gg depends only on uu: g(u,v)=φ(u)g(u, v) = \varphi(u) with φ\varphi of class C1C^1, and reversing the change of variables (u=x+yu = x + y, v=xyv = x - y),

    f(x,y)=φ(x+y).f(x, y) = \varphi(x + y).

    Conversely every such ff satisfies fx=fy=φf_x = f_y = \varphi': the solutions are exactly the C1C^1 functions of x+yx + y.

Exercise 25.12 ★★★

Find the global maximum and minimum of f(x,y)=xyf(x, y) = xy on the closed disc x2+y21x^2 + y^2 \leq 1. (Admit the two-variable extreme value theorem: a continuous function on the closed disc attains its bounds — proved in the Year 2 volume. Treat the open disc by critical points and the boundary circle by the parametrization of Exercise 25.5.)

Solution

Solution of Exercise 25.12.

On the open disc, an extremum would be critical: f=(y,x)=0\nabla f = (y, x) = 0 only at (0,0)(0,0), where f=0f = 0; it is a saddle (f(±ε,±ε)=ε2>0>ε2=f(±ε,ε)f(\pm \varepsilon, \pm\varepsilon) = \varepsilon^2 > 0 > -\varepsilon^2 = f(\pm\varepsilon, \mp\varepsilon)), so no extremum there. By the admitted extreme value theorem the bounds are attained, necessarily on the boundary circle. There, with Exercise 25.5,

f(cost,sint)=costsint=sin2t2[12,12],f(\cos t, \sin t) = \cos t\sin t = \frac{\sin 2t}{2} \in \intcc{-\tfrac12}{\tfrac12},

with maximum 12\frac12 at t=π4,5π4t = \frac\pi4, \frac{5\pi}4 (points ±12(1,1)\pm\frac{1}{\sqrt2}(1,1)) and minimum 12-\frac12 at t=3π4,7π4t = \frac{3\pi}4, \frac{7\pi}4 (points ±12(1,1)\pm\frac{1}{\sqrt2}(1,-1)). Global maximum 12\frac12, global minimum 12-\frac12.

25.5 Problem: least squares and the regression line

Problem 25.1

Given nn data points, which straight line passes “closest” to all of them? Legendre and Gauss answered: the line minimizing the sum of the squared vertical errors — because that minimization is exactly solvable by linear algebra. This problem first proves the Monge test of Method 25.14 honestly for quadratic functions (the one case where the second-order expansion is exact), then builds the normal equations, the regression line, and the correlation coefficient on top of the Euclidean geometry of Chapter 23.

Part I — Quadratic functions: the Monge test, proved. Fix reals r,s,tr, s, t and let q(h,k)=rh2+2shk+tk2q(h, k) = r h^2 + 2s hk + t k^2.

  1. Suppose r0r \neq 0. Establish the completed-square form

    q(h,k)=r(h+srk) ⁣2+rts2rk2,q(h, k) = r\Bigl(h + \frac{s}{r}k\Bigr)^{\!2} + \frac{rt - s^2}{r}\,k^2 ,

    and deduce: if rts2>0rt - s^2 > 0, qq has the strict sign of rr off the origin; if rts2<0rt - s^2 < 0, qq takes both signs.

  2. Settle the remaining cases: r=0r = 0, t0t \neq 0 (symmetric); and r=t=0r = t = 0 (q=2shkq = 2shk). Conclude: qq takes both signs iff rts2<0rt - s^2 < 0, and qq vanishes only at the origin iff rts2>0rt - s^2 > 0.
  3. Let now f(x,y)=12(rx2+2sxy+ty2)+βx+γy+δf(x, y) = \frac12\bigl(r x^2 + 2s xy + t y^2\bigr) + \beta x + \gamma y + \delta be a quadratic function with a critical point X0=(a,b)X_0 = (a, b). Prove the exact expansion

    f(X0+(h,k))=f(X0)+12q(h,k)(no remainder),f(X_0 + (h,k)) = f(X_0) + \tfrac12\,q(h, k) \qquad (\text{no remainder}),

    and deduce the Monge classification for quadratic functions: strict global minimum if rts2>0rt - s^2 > 0, r>0r > 0; strict global maximum if rts2>0rt - s^2 > 0, r<0r < 0; saddle if rts2<0rt - s^2 < 0.

  4. Suppose rts2>0rt - s^2 > 0 and r>0r > 0 (so also t>0t > 0). Prove the explicit coercivity bound

    q(h,k)c(h2+k2),c=rts2r+t>0.q(h, k) \geq c\,(h^2 + k^2), \qquad c = \frac{rt - s^2}{r + t} > 0 .

    (Show that the quadratic form qc(h2+k2)q - c(h^2 + k^2), with coefficients rcr - c, ss, tct - c, still has nonnegative discriminant-test data.)

  5. Deduce that a quadratic function with positive definite quadratic part tends to ++\infty as (x,y)\norm{(x,y)} \to \infty, and therefore has a unique global minimizer: its critical point. Contrast with Example 25.15, where a local minimum of a nonquadratic function was not global.

Part II — The normal equations. Let C1,C2,bRnC_1, C_2, b \in \R^n (canonical inner product), and

f(u,v)=uC1+vC2b2.f(u, v) = \norm{u\,C_1 + v\,C_2 - b}^2 .
  1. Expand ff and show it is a quadratic function of (u,v)(u, v) with quadratic-part coefficients r=2C12r = 2\norm{C_1}^2, s=2C1,C2s = 2\langle C_1, C_2\rangle, t=2C22t = 2\norm{C_2}^2.
  2. Show that rts2>0rt - s^2 > 0 if and only if (C1,C2)(C_1, C_2) is free (the equality case of Cauchy–Schwarz, Theorem 23.4); assume this from now on.
  3. Show that the critical equations f=0\nabla f = 0 are the normal equations

    (C12C1,C2C1,C2C22)(uv)=(C1,bC2,b)\begin{pmatrix} \norm{C_1}^2 & \langle C_1, C_2\rangle\\ \langle C_1, C_2\rangle & \norm{C_2}^2 \end{pmatrix} \begin{pmatrix} u\\ v\end{pmatrix} = \begin{pmatrix} \langle C_1, b\rangle\\ \langle C_2, b\rangle\end{pmatrix}

    — the Gram matrix of Exercise 23.11 on the left — and that they say exactly: b(uC1+vC2)C1,C2b - (uC_1 + vC_2) \perp C_1, C_2. Conclude with Part I and Theorem 23.10: the unique minimizer gives p=uC1+vC2=p = uC_1 + vC_2 = the orthogonal projection of bb onto Vect(C1,C2)\operatorname{Vect}(C_1, C_2).

  4. Show that the minimal value is b2p,b=bp2\norm{b}^2 - \langle p, b\rangle = \norm{b - p}^2, and draw the Pythagorean picture.

Part III — The regression line. Data points (x1,y1),,(xn,yn)(x_1, y_1), \dots, (x_n, y_n), not all xix_i equal. Minimize

E(α,β)=i=1n(yiαβxi)2.E(\alpha, \beta) = \sum_{i=1}^{n}\bigl(y_i - \alpha - \beta x_i\bigr)^2 .

Write xˉ=1nxi\bar x = \frac1n\sum x_i, yˉ=1nyi\bar y = \frac1n\sum y_i, vx=1nxi2xˉ2v_x = \frac1n\sum x_i^2 - \bar x^2, vy=1nyi2yˉ2v_y = \frac1n\sum y_i^2 - \bar y^2, cxy=1nxiyixˉyˉc_{xy} = \frac1n\sum x_i y_i - \bar x\bar y.

  1. Recognize Part II with C1=(1,,1)C_1 = (1, \dots, 1), C2=(x1,,xn)C_2 = (x_1, \dots, x_n), b=(y1,,yn)b = (y_1, \dots, y_n), and write the normal equations

    nα+(xi)β=yi,(xi)α+(xi2)β=xiyi.n\alpha + \Bigl(\sum x_i\Bigr)\beta = \sum y_i, \qquad \Bigl(\sum x_i\Bigr)\alpha + \Bigl(\sum x_i^2\Bigr)\beta = \sum x_i y_i .
  2. Solve them:

    β=cxyvx,α=yˉβxˉ,\beta = \frac{c_{xy}}{v_x}, \qquad \alpha = \bar y - \beta\,\bar x ,

    and observe that the regression line y=α+βxy = \alpha + \beta x passes through the mean point (xˉ,yˉ)(\bar x, \bar y).

  3. Check vx>0v_x > 0 exactly when the xix_i are not all equal, and match this with question 7.
  4. Prove that the minimal error is

    Emin=n(vycxy2vx)=nvy(1ρ2),ρ=cxyvxvy(vy0).E_{\min} = n\Bigl(v_y - \frac{c_{xy}^2}{v_x}\Bigr) = n\,v_y\,(1 - \rho^2), \qquad \rho = \frac{c_{xy}}{\sqrt{v_x v_y}} \quad (v_y \neq 0).

    Deduce ρ1\abs\rho \leq 1, with ρ=1\abs\rho = 1 if and only if the data are perfectly aligned.

  5. Worked example: for the data (0,0)(0,0), (1,1)(1,1), (2,3)(2,3), (3,4)(3,4), compute xˉ,yˉ,vx,cxy\bar x, \bar y, v_x, c_{xy}, the regression line, the four residuals and EminE_{\min}.
  6. Prove that the residuals εi=yiαβxi\varepsilon_i = y_i - \alpha - \beta x_i of the optimal line satisfy iεi=0\sum_i \varepsilon_i = 0 and ixiεi=0\sum_i x_i\varepsilon_i = 0, and interpret both via orthogonality.

Part IV — Variations and applications.

  1. (Best constant) Show that the constant α\alpha minimizing i(yiα)2\sum_i (y_i - \alpha)^2 is the mean yˉ\bar y, and that the minimal value is nvyn\,v_y: the variance measures the failure of the data to be constant.
  2. (Line through the origin) Show that the slope minimizing i(yiβxi)2\sum_i (y_i - \beta x_i)^2 is β0=xiyixi2\beta_0 = \frac{\sum x_iy_i}{\sum x_i^2}, and give a condition on the data for β0\beta_0 to coincide with the slope cxy/vxc_{xy}/v_x of question 11.
  3. (Distance to a line, again) For a point MM and the line DD through P0P_0 directed by the unit vector ww, minimize g(τ)=P0+τwM2g(\tau) = \norm{P_0 + \tau w - M}^2 and deduce d(M,D)2=MP02MP0,w2d(M, D)^2 = \norm{M - P_0}^2 - \langle M - P_0, w\rangle^2; recover the formula d=ax0+by0+ca2+b2d = \frac{\abs{a x_0 + b y_0 + c}}{\sqrt{a^2 + b^2}} for the line ax+by+c=0ax + by + c = 0 in the plane.
  4. (Analysis of variance) Prove the decomposition vy=β2vx+Eminnv_y = \beta^2 v_x + \frac{E_{\min}}n: the variance of the yiy_i splits into the part explained by the line plus the residual variance.
  5. (Parabolic fit) To fit y=a+bx+cx2y = a + bx + cx^2, show that the normal equations are the 3×33 \times 3 system with the moment matrix

    (nxixi2xixi2xi3xi2xi3xi4),\begin{pmatrix} n & \sum x_i & \sum x_i^2\\ \sum x_i & \sum x_i^2 & \sum x_i^3\\ \sum x_i^2 & \sum x_i^3 & \sum x_i^4 \end{pmatrix},

    a Gram matrix which is invertible as soon as three of the xix_i are distinct (freeness of (1,X,X2)(1, X, X^2) sampled at the data, Exercise 23.11; compare the moment matrices of the weekend problem of Chapter 22).

Part V — Robustness, and synthesis.

  1. Classify the critical points of the three quadratic functions

    x2+xy+y2,x2+3xy+y2,x2+2xy+y2,x^2 + xy + y^2, \qquad x^2 + 3xy + y^2, \qquad x^2 + 2xy + y^2 ,

    by Part I, treating the degenerate third case by hand (where is the minimum attained?).

  2. (Outlier experiment) Append the point (10,0)(10, 0) to the data of question 14 and recompute the slope β\beta. What happened, and why is the squared error so sensitive to one distant point?
  3. (Weighted least squares) Given weights wi>0w_i > 0, minimize iwi(yiαβxi)2\sum_i w_i(y_i - \alpha - \beta x_i)^2: show the solution is given by the same formulas as question 11 with weighted means, variance and covariance (define them).
  4. Show that for the optimal line, Emin=0E_{\min} = 0 forces all points to lie exactly on it, and connect with the equality case ρ=1\abs\rho = 1 of question 13; test on the aligned data (1,1),(2,3),(3,5)(1,1), (2,3), (3,5).
  5. Synthesis, in four sentences: why quadratic functions are the one class where this chapter’s second-order test needs no admitted theorem; how the normal equations identify the analytic minimization with the orthogonal projection of Chapter 23; what the correlation coefficient measures and which inequality bounds it; and which pieces of Chapters 18–23 (bases, Gram and moment matrices, projections) reappeared. Name the method and the equations studied in Parts II–III.
Solution

Solution of Problem 25.1.

1. Expanding the right-hand side:

r(h+srk) ⁣2+rts2rk2=rh2+2shk+s2rk2+rts2rk2=q(h,k).r\Bigl(h + \frac srk\Bigr)^{\!2} + \frac{rt - s^2}{r}k^2 = rh^2 + 2shk + \frac{s^2}{r}k^2 + \frac{rt - s^2}{r}k^2 = q(h,k) .

If rts2>0rt - s^2 > 0: both squares carry the factor sign of rr, and q(h,k)=0q(h,k) = 0 forces k=0k = 0 then h=0h = 0: strict sign of rr off the origin. If rts2<0rt - s^2 < 0: q(1,0)=rq(1, 0) = r while q(sr,1)=rts2rq\bigl(-\frac sr, 1\bigr) = \frac{rt - s^2}{r} has the opposite sign: both signs occur.

2. If r=0tr = 0 \neq t, exchange the roles of hh and kk (the completed square in kk), with the same conclusions; note rts2=s2<0rt - s^2 = -s^2 < 0 as soon as s0s \neq 0, and indeed q=2shk+tk2q = 2shk + tk^2 takes both signs then (kk small against hh). If r=t=0r = t = 0: q=2shkq = 2shk, both signs iff s0s \neq 0, i.e. iff rts2=s2<0rt - s^2 = -s^2 < 0. Summary: qq takes both signs     rts2<0\iff rt - s^2 < 0; qq vanishes only at the origin (definite)     rts2>0\iff rt - s^2 > 0 (which forces r0r \neq 0, since r=0r = 0 gives q(1,0)=0q(1,0) = 0).

3. With fx=rx+sy+βf_x = rx + sy + \beta and fy=sx+ty+γf_y = sx + ty + \gamma, direct expansion gives

f(a+h,b+k)=f(a,b)+hfx(a,b)+kfy(a,b)+12q(h,k),f(a + h, b + k) = f(a, b) + h\,f_x(a,b) + k\,f_y(a,b) + \tfrac12 q(h, k),

with no higher terms (the function is a polynomial of degree 22). At a critical point the linear part vanishes: f(X0+H)f(X0)=12q(H)f(X_0 + H) - f(X_0) = \frac12 q(H) exactly, so the sign study of questions 1–2 classifies: strict global minimum (rts2>0rt - s^2 > 0, r>0r > 0), strict global maximum (rts2>0rt - s^2 > 0, r<0r < 0), saddle — both signs in every neighborhood — when rts2<0rt - s^2 < 0. This proves Method 25.14 for quadratic functions.

4. The form qc(h2+k2)q - c(h^2 + k^2) has data rcr - c, ss, tct - c. With c=rts2r+tc = \frac{rt - s^2}{r + t} (note t>0t > 0 since rt>s20rt > s^2 \geq 0 and r>0r > 0):

(rc)(tc)s2=rts2c(r+t)+c2=c20,(r - c)(t - c) - s^2 = rt - s^2 - c(r + t) + c^2 = c^2 \geq 0,

and rc0r - c \geq 0 (cr    rts2r2+rtc \leq r \iff rt - s^2 \leq r^2 + rt, true). If rc>0r - c > 0, the completed square of question 1 shows qc(h2+k2)0q - c(h^2 + k^2) \geq 0; if rc=0r - c = 0, then s=0s = 0 (from s2=c2-s^2 = -c^2 \leq \dots forcing the displayed quantity 0\geq 0 with first factor 00) and the form is (tc)k20(t - c)k^2 \geq 0. In both cases q(h,k)c(h2+k2)q(h,k) \geq c(h^2 + k^2).

5. By questions 3–4, f(X)=f(X0)+12q(XX0)f(X0)+c2XX02+f(X) = f(X_0) + \frac12 q(X - X_0) \geq f(X_0) + \frac c2\norm{X - X_0}^2 \to +\infty as X\norm X \to \infty: ff is coercive, and the inequality is strict for XX0X \neq X_0: the critical point is the unique global minimizer. For the cubic f=x3+y33xyf = x^3 + y^3 - 3xy of Example 25.15, no such conclusion holds: f(x,0)=x3f(x,0) = x^3 \to -\infty, and the local minimum at (1,1)(1,1) is not global — exactness of the quadratic expansion is what failed.

6. Expanding the squared norm:

f(u,v)=u2C12+2uvC1,C2+v2C222uC1,b2vC2,b+b2,f(u,v) = u^2\norm{C_1}^2 + 2uv\,\langle C_1, C_2\rangle + v^2\norm{C_2}^2 - 2u\,\langle C_1, b\rangle - 2v\,\langle C_2, b\rangle + \norm b^2 ,

a quadratic function of (u,v)(u, v) whose quadratic part is 12(ru2+2suv+tv2)\frac12(ru^2 + 2suv + tv^2) with r=2C12r = 2\norm{C_1}^2, s=2C1,C2s = 2\langle C_1, C_2\rangle, t=2C22t = 2\norm{C_2}^2.

7. rts2=4(C12C22C1,C22)0rt - s^2 = 4\bigl(\norm{C_1}^2\norm{C_2}^2 - \langle C_1, C_2\rangle^2\bigr) \geq 0 by Cauchy–Schwarz (Theorem 23.4), with equality exactly when C1,C2C_1, C_2 are proportional (or one is zero), i.e. when the pair is linked. So rts2>0    (C1,C2)rt - s^2 > 0 \iff (C_1, C_2) free.

8. f=0\nabla f = 0 reads

C12u+C1,C2v=C1,b,C1,C2u+C22v=C2,b,\norm{C_1}^2 u + \langle C_1, C_2\rangle v = \langle C_1, b\rangle, \qquad \langle C_1, C_2\rangle u + \norm{C_2}^2 v = \langle C_2, b\rangle,

the normal equations with the Gram matrix on the left; they say uC1+vC2b, Ci=0\langle uC_1 + vC_2 - b,\ C_i\rangle = 0 for i=1,2i = 1, 2, i.e. bpVect(C1,C2)b - p \perp \operatorname{Vect}(C_1, C_2) for p=uC1+vC2p = uC_1 + vC_2. By Part I (questions 3, 5) the unique critical point is the unique global minimizer, and by Theorem 23.10 the characterization “pFp \in F, bpFb - p \perp F” identifies pp as the orthogonal projection of bb onto F=Vect(C1,C2)F = \operatorname{Vect}(C_1, C_2).

9. bp2=b22b,p+p2\norm{b - p}^2 = \norm b^2 - 2\langle b, p\rangle + \norm p^2, and p,bp=0\langle p, b - p\rangle = 0 gives p2=p,b\norm p^2 = \langle p, b\rangle: the minimum equals b2p,b\norm b^2 - \langle p, b\rangle. Pythagoras: b2=p2+bp2\norm b^2 = \norm p^2 + \norm{b - p}^2 — the data vector splits into its explained part pp and its residual part bpb - p, orthogonal to each other.

10. E(α,β)=αC1+βC2b2E(\alpha, \beta) = \norm{\alpha C_1 + \beta C_2 - b}^2 with the stated C1,C2,bC_1, C_2, b; the normal equations of question 8 are, entrywise,

nα+(xi)β=yi,(xi)α+(xi2)β=xiyi.n\alpha + \Bigl(\sum x_i\Bigr)\beta = \sum y_i, \qquad \Bigl(\sum x_i\Bigr)\alpha + \Bigl(\sum x_i^2\Bigr)\beta = \sum x_i y_i .

11. Dividing by nn: α+βxˉ=yˉ\alpha + \beta\bar x = \bar y and αxˉ+β(vx+xˉ2)=cxy+xˉyˉ\alpha\bar x + \beta\bigl(v_x + \bar x^2\bigr) = c_{xy} + \bar x\bar y. Substituting α=yˉβxˉ\alpha = \bar y - \beta\bar x into the second: βvx=cxy\beta v_x = c_{xy}, so

β=cxyvx,α=yˉβxˉ,\beta = \frac{c_{xy}}{v_x}, \qquad \alpha = \bar y - \beta\bar x ,

and the first equation says precisely that (xˉ,yˉ)(\bar x, \bar y) lies on the line.

12. vx=1n(xixˉ)20v_x = \frac1n\sum(x_i - \bar x)^2 \geq 0, zero iff every xix_i equals xˉ\bar x. And rts2=4(nxi2(xi)2)=4n2vxrt - s^2 = 4\bigl(n\sum x_i^2 - (\sum x_i)^2\bigr) = 4n^2 v_x: question 7’s freeness condition is vx>0v_x > 0, i.e. the xix_i not all equal.

13. With α=yˉβxˉ\alpha = \bar y - \beta\bar x, center the data (x~i=xixˉ\tilde x_i = x_i - \bar x, y~i=yiyˉ\tilde y_i = y_i - \bar y):

E(α,β)=i(y~iβx~i)2=nvy2βncxy+β2nvx,E(\alpha, \beta) = \sum_i(\tilde y_i - \beta\tilde x_i)^2 = n\,v_y - 2\beta\,n\,c_{xy} + \beta^2 n\,v_x ,

minimized at β=cxy/vx\beta = c_{xy}/v_x with value Emin=n(vycxy2vx)=nvy(1ρ2)E_{\min} = n\bigl(v_y - \frac{c_{xy}^2}{v_x}\bigr) = n v_y(1 - \rho^2). Since Emin0E_{\min} \geq 0 and vy>0v_y > 0: ρ21\rho^2 \leq 1, and ρ=1\abs\rho = 1 iff Emin=0E_{\min} = 0, i.e. iff every residual vanishes: the points lie exactly on the line.

14. n=4n = 4: xˉ=64=1.5\bar x = \frac64 = 1.5, yˉ=2\bar y = 2, xi2=14\sum x_i^2 = 14 so vx=3.52.25=1.25v_x = 3.5 - 2.25 = 1.25, xiyi=0+1+6+12=19\sum x_iy_i = 0 + 1 + 6 + 12 = 19 so cxy=4.753=1.75c_{xy} = 4.75 - 3 = 1.75. Hence

β=1.751.25=1.4,α=21.4×1.5=0.1:y=1.4x0.1.\beta = \frac{1.75}{1.25} = 1.4, \qquad \alpha = 2 - 1.4\times1.5 = -0.1 : \qquad y = 1.4\,x - 0.1 .

Fitted values 0.1, 1.3, 2.7, 4.1-0.1,\ 1.3,\ 2.7,\ 4.1; residuals 0.1, 0.3, 0.3, 0.10.1,\ -0.3,\ 0.3,\ -0.1; Emin=0.01+0.09+0.09+0.01=0.2E_{\min} = 0.01 + 0.09 + 0.09 + 0.01 = 0.2 (check: vy=2644=2.5v_y = \frac{26}4 - 4 = 2.5 and 4(2.51.7521.25)=4(2.52.45)=0.24(2.5 - \frac{1.75^2}{1.25}) = 4(2.5 - 2.45) = 0.2).

15. The two normal equations of question 10 are exactly iεi=0\sum_i\varepsilon_i = 0 and ixiεi=0\sum_i x_i\varepsilon_i = 0: the residual vector is orthogonal to C1=(1,,1)C_1 = (1, \dots, 1) and to C2=(xi)C_2 = (x_i) — to the whole model space. In particular the optimal line always balances its errors: they sum to zero.

16.  ⁣d ⁣dα(yiα)2=2(yiα)=0\frac{\dd}{\dd\alpha}\sum(y_i - \alpha)^2 = -2\sum(y_i - \alpha) = 0 gives α=yˉ\alpha = \bar y (and the second derivative 2n>02n > 0 makes it the global minimum, the function being a coercive quadratic in one variable). Minimal value (yiyˉ)2=nvy\sum(y_i - \bar y)^2 = n v_y: the variance is the irreducible quadratic error of a constant model.

17.  ⁣d ⁣dβ(yiβxi)2=2xi(yiβxi)=0\frac{\dd}{\dd\beta}\sum(y_i - \beta x_i)^2 = -2\sum x_i(y_i - \beta x_i) = 0 gives β0=xiyixi2\beta_0 = \frac{\sum x_iy_i}{\sum x_i^2}. Writing both slopes over centered quantities: β0=cxy+xˉyˉvx+xˉ2\beta_0 = \frac{c_{xy} + \bar x\bar y}{v_x + \bar x^2} equals cxyvx\frac{c_{xy}}{v_x} iff cxyxˉ2=xˉyˉvxc_{xy}\bar x^2 = \bar x\bar y\,v_x, i.e. iff xˉ=0\bar x = 0 (centered abscissas) or yˉ=βxˉ\bar y = \beta\bar x — the latter meaning α=0\alpha = 0: the full regression line already passes through the origin.

18. g(τ)=MP022τMP0,w+τ2g(\tau) = \norm{M - P_0}^2 - 2\tau\langle M - P_0, w\rangle + \tau^2 is minimal at τ=MP0,w\tau^* = \langle M - P_0, w\rangle, with value d(M,D)2=MP02MP0,w2d(M,D)^2 = \norm{M - P_0}^2 - \langle M - P_0, w\rangle^2. In the plane, complete ww into an orthonormal basis (w,n)(w, n) with n=(a,b)a2+b2n = \frac{(a, b)}{\sqrt{a^2+b^2}} (unit normal of DD): then MP02=MP0,w2+MP0,n2\norm{M - P_0}^2 = \langle M - P_0, w\rangle^2 + \langle M - P_0, n\rangle^2, so d(M,D)=MP0,nd(M, D) = \abs{\langle M - P_0, n\rangle}, and with aP0x+bP0y=caP_{0x} + bP_{0y} = -c:

d=ax0+by0+ca2+b2.d = \frac{\abs{a x_0 + b y_0 + c}}{\sqrt{a^2 + b^2}} .

19. From Emin/n=vycxy2vxE_{\min}/n = v_y - \frac{c_{xy}^2}{v_x} and β2vx=cxy2vx\beta^2 v_x = \frac{c_{xy}^2}{v_x}:

vy=β2vx+Eminn:v_y = \beta^2 v_x + \frac{E_{\min}}n :

total variance == variance along the fitted line ++ residual variance. (Dividing by vyv_y: 1=ρ2+(1ρ2)1 = \rho^2 + (1 - \rho^2), the share of variance “explained” by the line is ρ2\rho^2.)

20. The model space is Vect(C1,C2,C3)\operatorname{Vect}\bigl(C_1, C_2, C_3\bigr) with C1=(1)C_1 = (1), C2=(xi)C_2 = (x_i), C3=(xi2)C_3 = (x_i^2); minimizing aC1+bC2+cC3b2\norm{aC_1 + bC_2 + cC_3 - b}^2 leads, exactly as in question 8, to the 3×33\times3 Gram system, whose matrix has entries Ci,Cj=kxki+j2\langle C_i, C_j\rangle = \sum_k x_k^{\,i+j-2}: the displayed moment matrix. It is invertible iff (C1,C2,C3)(C_1, C_2, C_3) is free (Exercise 23.11); a relation a+bxk+cxk2=0a + bx_k + cx_k^2 = 0 for all kk makes every xkx_k a root of one polynomial of degree 2\leq 2, impossible with three distinct values unless a=b=c=0a = b = c = 0. Compare the moment matrices of the weekend problem of Chapter 22, where their determinants were squared Vandermonde values.

21. First: r=2,s=1,t=2r = 2, s = 1, t = 2, rts2=3>0rt - s^2 = 3 > 0, r>0r > 0: strict global minimum at the origin. Second: r=2,s=3,t=2r = 2, s = 3, t = 2, rts2=5<0rt - s^2 = -5 < 0: saddle. Third: r=s=t=2r = s = t = 2, rts2=0rt - s^2 = 0: degenerate — but x2+2xy+y2=(x+y)20x^2 + 2xy + y^2 = (x + y)^2 \geq 0 vanishes on the whole line y=xy = -x: a (non-strict) global minimum attained along a line, invisible to the determinant test.

22. New sums (n=5n = 5): xˉ=3.2\bar x = 3.2, yˉ=1.6\bar y = 1.6, xiyi=19\sum x_iy_i = 19 so cxy=3.85.12=1.32c_{xy} = 3.8 - 5.12 = -1.32, xi2=114\sum x_i^2 = 114 so vx=22.810.24=12.56v_x = 22.8 - 10.24 = 12.56. New slope:

β=1.3212.560.105:\beta = \frac{-1.32}{12.56} \approx -0.105 :

one point turned a clearly increasing trend (β=1.4\beta = 1.4) into a slightly decreasing one. The squared error charges a residual ε2\varepsilon^2, so a single distant point — large xixˉ\abs{x_{i} - \bar x} and large residual — dominates both cxyc_{xy} and vxv_x: least squares is efficient but not robust.

23. Set W=wiW = \sum w_i and define xˉw=1Wwixi\bar x_w = \frac1W\sum w_ix_i, yˉw\bar y_w likewise, vxw=1Wwixi2xˉw2v_x^w = \frac1W\sum w_ix_i^2 - \bar x_w^2, cxyw=1Wwixiyixˉwyˉwc^w_{xy} = \frac1W\sum w_ix_iy_i - \bar x_w\bar y_w. The map u,vw=iwiuivi\langle u, v\rangle_w = \sum_i w_iu_iv_i is an inner product on Rn\R^n (wi>0w_i > 0 gives definiteness), so Part II applies verbatim and the normal equations divide by WW into

α+βxˉw=yˉw,αxˉw+β(vxw+xˉw2)=cxyw+xˉwyˉw,\alpha + \beta\bar x_w = \bar y_w, \qquad \alpha\bar x_w + \beta(v^w_x + \bar x_w^2) = c^w_{xy} + \bar x_w\bar y_w ,

whence β=cxyw/vxw\beta = c^w_{xy}/v^w_x and α=yˉwβxˉw\alpha = \bar y_w - \beta\bar x_w: the same formulas, with every average weighted.

24. Emin=εi2=0E_{\min} = \sum\varepsilon_i^2 = 0 forces every εi=0\varepsilon_i = 0: all points exactly on the line; by question 13 this is the case ρ=1\abs\rho = 1. Test: for (1,1),(2,3),(3,5)(1,1), (2,3), (3,5): xˉ=2\bar x = 2, yˉ=3\bar y = 3, vx=1434=23v_x = \frac{14}3 - 4 = \frac23, cxy=2236=43c_{xy} = \frac{22}3 - 6 = \frac43: β=2\beta = 2, α=1\alpha = -1, and indeed yi=2xi1y_i = 2x_i - 1 for all three points; vy=3539=83v_y = \frac{35}3 - 9 = \frac83 and ρ2=(4/3)2(2/3)(8/3)=1\rho^2 = \frac{(4/3)^2}{(2/3)(8/3)} = 1.

25. (i) For quadratic functions the order-two expansion is an identity, so the sign study of the quadratic form — pure algebra, questions 1–2 — classifies critical points with no admitted Taylor theorem. (ii) The normal equations say “residual orthogonal to the model space”, so the analytic minimum is the orthogonal projection of the data vector: calculus and Euclidean geometry compute the same object. (iii) The correlation ρ=cxy/vxvy\rho = c_{xy}/\sqrt{v_xv_y} measures the share ρ2\rho^2 of the variance explained by the line, and Cauchy–Schwarz bounds it: ρ1\abs\rho \leq 1, with equality only for aligned data. (iv) Bases and freeness (Chapter 18), Gram and moment matrices and their determinants (Chapters 22–23), and orthogonal projection (Chapter 23) all reappeared as the working parts of one algorithm. Parts II–III develop the method of least squares (Legendre, Gauss) through its normal equations.