MAT1051 · Week 10 · Optimization Problems, Linear Approximation and Differentials

Optimization, linear approximation and differentials

Turning a word problem into a single-variable function and finding its maximum/minimum, approximating with the tangent line, and estimating error with differentials. The classic word problem of the final.

optimizationobjective functionconstraintlinear approximationlinearizationtangent line approximationdifferentialabsolute errorrelative errorpercentage error

The most “applied” week of Calculus I. In an optimization problem you turn a word situation into a function and find the best value with the extrema knowledge of week 8. Linear approximation is the use of the derivative’s idea “the tangent line is close to the function” for estimating numbers without a calculator. Differentials are the application of the same idea to error computation. Things to keep in mind:

  1. In optimization the hard part is not the derivative, it is setting up the function. Objective function + constraint.
  2. Use the constraint to reduce to one variable. You cannot differentiate a function of two variables.
  3. Show that the point you found is a max or a min. The endpoints or the f′′f'' test.
  4. Linear approximation = the tangent line. L(x)=f(a)+f′(a)(x−a)L(x)=f(a)+f'(a)(x-a).
  5. dydy is the change along the tangent, Δy\Delta y is the actual change.

Optimization problems

The six-step method

1. Draw a figure, name the variables, write the units.
2. Objective function: what are you maximizing/minimizing? (area, volume, cost, distance)
3. Constraint: the information linking the variables (perimeter 600, volume 4000...)
4. Solve the constraint for one variable, substitute into the objective -> a single-variable f(x).
5. Write the interval that makes physical sense (such as length > 0).
6. Solve f'(x) = 0; verify that it is a max/min with the endpoints or with f''.

Example 1 (pen). A rectangular area will be enclosed with 600600 m of fence and divided into two equal compartments by a fence parallel to one side. Maximize the total area.

Let the dividing fence be parallel to the sides of length xx. Then there are three fences of length xx (two outer sides and the divider), and two fences of length yy:

3x+2y=600⇒y=600−3x23x+2y=600 \Rightarrow y=\frac{600-3x}{2}

Which side you choose to be the triple one does not change the result; only the labels swap. Drawing the figure and counting the fences one by one prevents errors at this step.

A(x)=x⋅600−3x2=300x−32x2,0<x<200A(x)=x\cdot\frac{600-3x}{2}=300x-\frac32x^2,\qquad 0<x<200

A′(x)=300−3x=0⇒x=100A'(x)=300-3x=0 \Rightarrow x=100. A′′=−3<0A''=-3<0, max. y=600−3002=150y=\dfrac{600-300}{2}=150. The largest area is 100⋅150=15000100\cdot150=15000 m².

Example 2 (material). The least material for a box with a square base, an open top and a volume of 40004000 cm³.

base side x, height h
objective:   S = x^2 + 4xh                 (base + 4 side faces, no top)
constraint:  x^2 h = 4000  ->  h = 4000 / x^2
S(x) = x^2 + 16000 / x,   x > 0
S'(x) = 2x - 16000 / x^2 = 0  ->  x^3 = 8000  ->  x = 20
S''(x) = 2 + 32000 / x^3 > 0  ->  minimum
h = 4000 / 400 = 10,   S = 400 + 800 = 1200 cm^2

On an open interval (x>0x>0) there are no endpoints. Since there is a single critical point and S′′>0S''>0, this local min is also the absolute min. Write this sentence on the exam.

PITFALL · not checking whether it is a max or a min. f′=0f'=0 gives a candidate. Before writing the answer, either compare with the endpoint values or show the sign of f′′f''. For example in the wire problem (Question 12) the critical point gives the minimum; the maximum is at an endpoint, when all the wire goes to the circle.

TIP · use the square for distances. Instead of d=(x−a)2+(y−b)2d=\sqrt{(x-a)^2+(y-b)^2}, minimize d2d^2. The square root is an increasing function, and the smallest dd and the smallest d2d^2 are at the same point. The derivative is much shorter.

Linear approximation

If ff is differentiable at aa, then for xx near aa the graph is very close to the tangent line:

f(x)≈L(x)=f(a)+f′(a)(x−a)f(x)\approx L(x)=f(a)+f'(a)(x-a)

LL is called the linearization of ff at aa. Choose aa as a point close to the target number for which you can compute f(a)f(a) and f′(a)f'(a) in your head.

Example 3. Estimating 9.2\sqrt{9.2}. f(x)=xf(x)=\sqrt x, a=9a=9: f(9)=3f(9)=3, f′(9)=16f'(9)=\dfrac16.

L(9.2)=3+16(0.2)=3.0333…(true: 3.03315…)L(9.2)=3+\frac16(0.2)=3.0333\ldots\qquad(\text{true: }3.03315\ldots)

Commonly used approximations (xx near zero, a=0a=0):

FunctionApproximation
sin⁡x\sin xxx
cos⁡x\cos x11
tan⁡x\tan xxx
exe^x1+x1+x
ln⁡(1+x)\ln(1+x)xx
(1+x)k(1+x)^k1+kx1+kx

Example 4. (1.02)5≈1+5(0.02)=1.1(1.02)^5\approx1+5(0.02)=1.1. The true value is 1.104081.10408. The error is of the order of the square of x=0.02x=0.02.

Over or under? If f′′<0f''<0 (concave down), the graph stays below the tangent and LL overestimates (as for x\sqrt x). If f′′>0f''>0, it underestimates (as for exe^x).

Differentials

For y=f(x)y=f(x), dxdx is an independent variable (a small increment), and

dy=f′(x) dxdy=f'(x)\,dx

dydy is the rise along the tangent line. The actual change is Δy=f(x+dx)−f(x)\Delta y=f(x+dx)-f(x). When dxdx is small, dy≈Δydy\approx\Delta y.

Example 5. f(x)=x2f(x)=x^2, x=3x=3, dx=0.1dx=0.1: dy=2x dx=0.6dy=2x\,dx=0.6, Δy=3.12−9=0.61\Delta y=3.1^2-9=0.61. The difference is exactly dx2=0.01dx^2=0.01.

Error estimation

If you measure one quantity and compute another from it, the measurement error propagates to the computed value. The differential estimates it.

Example 6. The edge of a cube is 1010 cm, with a measurement error of ±0.1\pm0.1 cm.

V = x^3        dV = 3x^2 dx = 3 · 100 · 0.1 = 30 cm^3     (absolute error)
relative error  = dV / V = 30 / 1000 = 0.03                (3 percent)
shortcut:        dV / V = 3 · dx / x = 3 · 0.01 = 0.03

General rule: if Q=kxnQ=kx^n, then dQQ=ndxx\dfrac{dQ}{Q}=n\dfrac{dx}{x}. The larger the power, the larger the relative error.

PITFALL · confusing dydy and Δy\Delta y. If the question says “use differentials to estimate”, compute dy=f′(x)dxdy=f'(x)dx. If it says “find the actual change”, compute f(x+Δx)−f(x)f(x+\Delta x)-f(x). They may ask for both together and also ask for the difference.

Common mistakes

Wrong thinkingCorrect
Differentiating a function of two variablesFirst reduce to one variable with the constraint
Finding the critical point and calling it the maxVerify with the endpoints or f′′f''
Not writing the domain intervalLength >0>0; limits such as the cut-out square x<6x<6
Counting fence along the river tooDon’t include a side that isn’t in the problem
Differentiating the distance with its rootMinimize d2d^2
L(x)=f(a)+f′(x)(x−a)L(x)=f(a)+f'(x)(x-a)The slope is f′(a)f'(a), a constant number
Choosing aa far from the target numbera=25a=25 for 26\sqrt{26}, a=8a=8 for 8.063\sqrt[3]{8.06}
dV=V′dV=V' in error computationdV=V′(r) drdV=V'(r)\,dr; don’t forget to multiply by drdr
Not converting the relative error to a percentage0.0150.015 = 1.5%1.5\%

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1medium

Find two positive numbers whose sum is 2020 such that the product of one number and the square of the other is as large as possible.

Show answer
20/3 and 40/3 (maximum product 32000/27 ≈ 1185.2)

x+y=20x+y=20, P=xy2P=xy^2. Use the constraint: x=20−yx=20-y, P(y)=(20−y)y2=20y2−y3P(y)=(20-y)y^2=20y^2-y^3, 0<y<200<y<20. P′=40y−3y2=y(40−3y)=0⇒y=403P'=40y-3y^2=y(40-3y)=0 \Rightarrow y=\tfrac{40}{3}. P′′=40−6yP''=40-6y, at y=403y=\tfrac{40}3 it is −40<0-40<0: max. x=203x=\tfrac{20}{3}, P=203⋅16009=3200027P=\tfrac{20}{3}\cdot\tfrac{1600}{9}=\tfrac{32000}{27}.

Question 2easy

An open-top box is made from a 12×1212\times12 cm sheet by cutting equal squares of side xx from the corners and folding up the sides. Find xx that maximizes the volume, and the maximum volume.

Show answer
x = 2 cm, V = 128 cm³

V(x)=x(12−2x)2V(x)=x(12-2x)^2, 0<x<60<x<6. V′=(12−2x)2+x⋅2(12−2x)(−2)=(12−2x)(12−2x−4x)=(12−2x)(12−6x)V'=(12-2x)^2+x\cdot2(12-2x)(-2)=(12-2x)(12-2x-4x)=(12-2x)(12-6x). V′=0V'=0: x=6x=6 (endpoint, V=0V=0) or x=2x=2. V(2)=2⋅64=128V(2)=2\cdot64=128 cm³. The volume is 00 at the endpoints, so the max is at x=2x=2.

Question 3easy

A farmer has 240240 m of fencing to enclose a rectangular field along a straight river. No fence is needed along the river. Find the dimensions that maximize the area.

Show answer
60 m × 120 m (side parallel to the river 120 m), area 7200 m²

Let the two sides perpendicular to the river be xx and the parallel side yy: 2x+y=2402x+y=240. A=xy=x(240−2x)=240x−2x2A=xy=x(240-2x)=240x-2x^2. A′=240−4x=0⇒x=60A'=240-4x=0 \Rightarrow x=60, y=120y=120. A′′=−4<0A''=-4<0: max. A=7200A=7200 m².

Question 4medium

A closed cylindrical can must hold 500500 cm³. Find the radius and height that minimize the total surface area.

Show answer
r = (250/π)^(1/3) ≈ 4.30 cm, h = 2r ≈ 8.60 cm

Constraint: πr2h=500⇒h=500πr2\pi r^2h=500 \Rightarrow h=\dfrac{500}{\pi r^2}. Surface: S=2πr2+2πrh=2πr2+1000rS=2\pi r^2+2\pi rh=2\pi r^2+\dfrac{1000}{r}. S′=4πr−1000r2=0⇒r3=250π⇒r≈4.30S'=4\pi r-\dfrac{1000}{r^2}=0 \Rightarrow r^3=\dfrac{250}{\pi} \Rightarrow r\approx4.30. S′′=4π+2000r3>0S''=4\pi+\dfrac{2000}{r^3}>0: min. h=500πr2=2πr3πr2=2r≈8.60h=\dfrac{500}{\pi r^2}=\dfrac{2\pi r^3}{\pi r^2}=2r\approx8.60 cm. The height equals the diameter.

Question 5medium

Find the point on the curve y=xy=\sqrt{x} that is closest to the point (3,0)(3,0).

Show answer
(5/2, √(5/2)); minimum distance √11/2 ≈ 1.658

Minimize the square of the distance (the minimum is at the same point without the root): d2=(x−3)2+(x−0)2=(x−3)2+xd^2=(x-3)^2+(\sqrt x-0)^2=(x-3)^2+x. Derivative: 2(x−3)+1=0⇒x=522(x-3)+1=0 \Rightarrow x=\tfrac52. The second derivative is 2>02>0: min. The point is (52,52)\left(\tfrac52,\sqrt{\tfrac52}\right), d2=14+52=114d^2=\tfrac14+\tfrac52=\tfrac{11}{4}, d=112d=\tfrac{\sqrt{11}}{2}.

Question 6easy

Find the linearization of f(x)=xf(x)=\sqrt{x} at a=25a=25 and use it to approximate 26\sqrt{26}.

Show answer
L(x) = 5 + (x - 25)/10; √26 ≈ 5.1

f(25)=5f(25)=5, f′(x)=12xf'(x)=\dfrac{1}{2\sqrt x}, f′(25)=110f'(25)=\dfrac{1}{10}. L(x)=5+110(x−25)L(x)=5+\dfrac{1}{10}(x-25). L(26)=5.1L(26)=5.1. The true value is 5.0990…5.0990\ldots; since x\sqrt x is concave down, the tangent overestimates a little.

Question 7easy

Use a linear approximation to estimate 8.063\sqrt[3]{8.06}.

Show answer
≈ 2.005

f(x)=x1/3f(x)=x^{1/3}, a=8a=8 (the nearest number whose cube root is known). f(8)=2f(8)=2, f′(x)=13x−2/3f'(x)=\tfrac13x^{-2/3}, f′(8)=13⋅14=112f'(8)=\tfrac13\cdot\tfrac14=\tfrac{1}{12}. L(8.06)=2+112(0.06)=2+0.005=2.005L(8.06)=2+\tfrac{1}{12}(0.06)=2+0.005=2.005. True: 2.004988…2.004988\ldots.

Question 8medium

For y=x3−2xy=x^3-2x, compute dydy and Δy\Delta y when x=2x=2 and dx=Δx=0.1dx=\Delta x=0.1.

Show answer
dy = 1, Δy = 1.061

dy=f′(x) dx=(3x2−2) dx=10⋅0.1=1dy=f'(x)\,dx=(3x^2-2)\,dx=10\cdot0.1=1. True change: Δy=f(2.1)−f(2)=(9.261−4.2)−(8−4)=5.061−4=1.061\Delta y=f(2.1)-f(2)=(9.261-4.2)-(8-4)=5.061-4=1.061. The difference is 0.0610.061, of the order of dx2dx^2.

Question 9medium

The radius of a sphere is measured as 1010 cm with a possible error of ±0.05\pm0.05 cm. Use differentials to estimate the maximum error in the computed volume, and the relative error.

Show answer
dV ≈ ±20π ≈ ±62.8 cm³; relative error 1.5%

V=43πr3⇒dV=4πr2 dr=4π(100)(0.05)=20π≈62.8V=\tfrac43\pi r^3 \Rightarrow dV=4\pi r^2\,dr=4\pi(100)(0.05)=20\pi\approx62.8 cm³. Relative error: dVV=4πr2dr43πr3=3drr=3⋅0.005=0.015\dfrac{dV}{V}=\dfrac{4\pi r^2dr}{\frac43\pi r^3}=3\dfrac{dr}{r}=3\cdot0.005=0.015, that is 1.5%1.5\%. A 0.5%0.5\% error in the radius triples in the volume.

Question 10medium

Find the linearization of f(x)=tan⁡xf(x)=\tan x at a=π4a=\dfrac{\pi}{4} and use it to estimate tan⁡(0.8)\tan(0.8).

Show answer
L(x) = 1 + 2(x - π/4); tan(0.8) ≈ 1.0292

f(π4)=1f(\tfrac\pi4)=1, f′(x)=sec⁡2xf'(x)=\sec^2x, f′(π4)=(2)2=2f'(\tfrac\pi4)=(\sqrt2)^2=2. L(x)=1+2(x−π4)L(x)=1+2\left(x-\tfrac\pi4\right). 0.8−π4≈0.8−0.785398=0.0146020.8-\tfrac\pi4\approx0.8-0.785398=0.014602. L(0.8)≈1.0292L(0.8)\approx1.0292. True: 1.02961.0296.

Question 11hard

A rectangle has its base on the xx-axis and its two upper vertices on the parabola y=12−x2y=12-x^2. Find the largest possible area.

Show answer
32

By symmetry the upper vertices are (±x,12−x2)(\pm x,12-x^2), 0<x<120<x<\sqrt{12}. The base is 2x2x and the height is 12−x212-x^2: A=2x(12−x2)=24x−2x3A=2x(12-x^2)=24x-2x^3. A′=24−6x2=0⇒x=2A'=24-6x^2=0 \Rightarrow x=2. A′′=−12x<0A''=-12x<0: max. A=4⋅8=32A=4\cdot8=32.

Question 12hard

A 4040 cm wire is cut into two pieces. One piece is bent into a square and the other into a circle. How much wire should be used for the square to minimize the total area?

Show answer
160/(π + 4) ≈ 22.40 cm

Use xx cm for the square: side x4\tfrac x4, area x216\tfrac{x^2}{16}. 40−x40-x for the circle: radius 40−x2π\tfrac{40-x}{2\pi}, area (40−x)24π\dfrac{(40-x)^2}{4\pi}. A(x)=x216+(40−x)24πA(x)=\dfrac{x^2}{16}+\dfrac{(40-x)^2}{4\pi}, 0≤x≤400\le x\le40. A′=x8−40−x2π=0⇒πx=4(40−x)⇒x=160π+4≈22.40A'=\dfrac x8-\dfrac{40-x}{2\pi}=0 \Rightarrow \pi x=4(40-x) \Rightarrow x=\dfrac{160}{\pi+4}\approx22.40. A′′>0A''>0: min. (The max is at an endpoint: all the wire to the circle, x=0x=0.)

Verification: All answers were checked with node (verify/MAT1051/10.mjs): the optimization functions were scanned at 200000 points on the allowed interval and the location and value of the maximum/minimum were compared; linear approximations with the true value, differentials with a numerical derivative and the true Δy.

Review card

OPTIMIZATION: 1) figure + variables 2) objective function (what is max/min?) 3) constraint equation 4) reduce to ONE variable with the constraint 5) write the domain interval 6) derivative = 0 7) show it is a max/min Verification: on a closed interval compare with the endpoints; on an open interval a single critical point + sign of f'' Distance: minimize d^2 instead of d (no root, same point) Cylinder minimum surface (closed): h = 2r L(x) = f(a) + f'(a)(x - a) a: a nearby point whose value is known sin x ≈ x, cos x ≈ 1, e^x ≈ 1 + x, ln(1+x) ≈ x, (1+x)^k ≈ 1 + kx (x ≈ 0) f'' < 0 (concave down): L overestimates; f'' > 0: underestimates dy = f'(x) dx (change along the tangent) Δy = f(x+dx) - f(x) (actual) relative error = dQ/Q percentage error = 100 · dQ/Q V = k r^n -> dV/V = n dr/r