# Optimization Problems

## Related Calculator: Online Derivative Calculator with Steps

Perhaps, the most important application of derivatives is solving optimization problems.

With the help of derivatives we can find minimum and maximum values. That's exactly what we need in optimization problems.

But before working out a couple of examples, let's see what steps should be made before transforming real-life problem into mathematical.

1. Read problem and clearly understand it. Define unknown and unknown variables, given conditions.
2. In most cases (if not all) it is useful to draw a diagram for better understanding of problem.
3. Assign a symbol to the quantity that is to be maximized or minimized (for example, let it be P). Also select symbols for other unknown quantities and label the diagram with these symbols. It may help to use initials as suggestive symbols - for example, A for area, h for height, t for time.
4. Express P in terms of some other symbols from Step 3.
5. If P has been expressed as a function of more than one variable in Step 4, use the given information to find relationships (in the form of equations) among these variables. Then use these equations to obtain P as a function of one variable. Thus, P will be expressed as a function of one variable x, say, P=f(x).
6. Write real domain of function f in compliance with conditions of the problem.
7. Using differetnial calculus find absolute maximum (or minimum) value of f. In paricular, if domain of f is closed interval then Closed Interval Method can be used.
8. Interpret obtained result.

Example 1. A man wants to fence off a rectangular field and use a wall as one side. He has 2000 ft of fencing. What are the dimensions of the field that has the largest area? Let's start from the diagram. We wish to maximize the area of the rectangle A. Let x and y be the width and length of the rectangle (in feet). Then we express A terms of x and y: A=xy.

We want to express A as a function of just one variable, so we eliminate y by expressing it in terms of x. To do this we use the given information that the total length of the fencing is 2000 ft. Thus 2x+y=2000 or y=2000-2x.

Therefore, A=xy=x(2000-2x)=2000x-2x^2.

Note that x>=0 and x<=1000 (otherwise A<0). So the function that we wish to maximize is A(x)=2000x-2x^2, 0<=x<=1000.

The derivative is A'(x)=2000-4x.

To find stationary points we solve equation A'(x)=2000-4x=0 which gives x=500.

The maximum value occurs either at this stationary points or at the endpoints of the interval.

Since A(0)=0, A(500)=500000 and A(1000)=0 then Closed Interval Method gives the maximum value as A(500)=500000.

Thus, width of rectangular field should be x=500 ft. and length should be y=2000-2x=1000 ft.

Example 2. Find the point on parabola y=1/2x^2 that is closest to the point (-4,1).

The distance between the point (x,y) and (-4,1) is d=sqrt((x-(-4))^2+(y-1)^2)=sqrt((x+4)^2+(y-1)^2).

But since point (x,y) lies on parabola then y=1/2x^2 and d=sqrt((x+4)^2+(1/2x^2-1)^2).

To make things easier, we minimize d^2 instead of d (if d has minimum then d^2 has minimum at the same point).

So, f(x)=d^2=(x+4)^2+(1/2x^2-1)^2.

Using Chain Rule we have that f'(x)=2(x+4)*(x+4)'+2(1/2x^2-1)*(1/2x^2-1)'=2(x+4)+2x(1/2x^2-1)=

=x^3+8.

So, f'(x)=0 when x^3+8=0 or x=-2.

Since, f'(x)<0 when x<-2 and f'(x)>0 when x> -2 then by First Derivative Test x=-2 is absolute minimum.

Now, y=1/2x^2=1/2 (-2)^2=2.

Therefore the closest point that lies on the y=1/2x^2 to the point (-4,1) is (-2,2). The corresponding minimum distance is d=sqrt((-2+4)^2+(2-1)^2)=sqrt(5).

Example 3. Suppose that man stands at point A and wants to reach point D as quickly as possible. He could row his boat directly across the river that is 4 km wide to point B and then run to D, or he could row directly to D, or he could row to some point between B and D and then run to D. If he can row at 5 (km)/h and run at 9 (km)/h, where should he land to reach D as soon as possible? Assume that the speed of the water is 0. Distance between B and C is 8 km. Let x be a distance in km from B to C, the the running distance |CD|=8-|BC|=8-x.

From the right-angled triangle ABC by the Pythagorean Theorem we have |AC|^2=|AB|^2+|BC|^2 or |AC|^2=4^2+x^2 which gives |AC|=sqrt(x^2+16).

Since time equals distance divided by speed then time to row a boat is (sqrt(x^2+16))/5 and time to run is (8-x)/9.

So, the total time is T(x)=(sqrt(x^2+16))/5+(8-x)/9.

The domain of this function is [0,8]. Note that if x=0 he rows to B and if x=8 he rows directly to D.

T'(x)=1/5*1/(2sqrt(x^2+16))*(x^2+16)'-1/9=x/(5sqrt(x^2+16))-1/9.

T'(x)=0 when x/(5sqrt(x^2+16))-1/9=0 or x/(5sqrt(x^2+16))=1/9.

This gives 9x=5sqrt(x^2+16) or 81x^2=25(x^2+16).

Thus, x^2=50/7 or x=5 sqrt(2/7) (we don't take -5sqrt(2/7) because this value is not in the domain of T).

Now, using Closed Interval Method we calculate that T(0)=76/45~~1.69, T(5sqrt(2/7))=9/5sqrt(2/7)+1/9(8-5 sqrt(2/7))~~1.55 and T(8)=4/sqrt(5)~~1.79.

Since the smallest of these values occurs when x=5 sqrt(2/7), the absolute minimum value of T occurs there.

Thus, the man should land the boat at point C that is 5sqrt(2/7)~~2.67 km from point B.

Example 4. A box with an open top is to be constructed from a square piece of metal with side a inches by cutting out equal squares of side x at each corner and then folding up the sides. What should be x in order to maximize volume of box? Since we cut out a piece of length x then side of square box is a-2x, height of box is x (the part we fold up), so volume of box is V(x)=x(a-2x)^2.

Thus, we need to maximise V(x)=x(a-2x)^2 on interval [0,a/2], (note that x can't be greater than a/2).

We have that V_x'=(a-2x)^2+2x(a-2x)*(-2)=(a-2x)(a-2x-4x)=

=(a-2x)(a-6x).

So, V'(x)=0 when x=a/2 (endpoint) and x=a/6.

Now calculate values of function at endpoints and stationary points:

V(0)=0, V(a/2)=0, V(a/6)=a/6(a-2 a/6)^2=(2a^3)/27.

The greatest value is (2a^3)/27 so maximum occurs when x=a/6.

Example 5. Find the area of the largest rectangle that can be inscribed in a semicircle of radius r.

Solution 1. Let's take the semicircle to be the upper half of the circle x^2+y^2=r^2 with center the origin. Then the word inscribed means that the rectangle has two vertices on the semicircle and two vertices on the x-axis. Let (x,y) be the vertex that lies in the first quadrant. Then the rectangle has sides of lengths 2x and y, so its area is A=2xy.

To eliminate y we use the fact that point (x,y) lies on the circle, so x^2+y^2=r^2 or y=sqrt(r^2-x^2).

Therefore A=2xsqrt(r^2-x^2) for 0<=x<=r.

Using product rule and chain rule we obtain that A'(x)=(2x)'sqrt(r^2-x^2)+2x(sqrt(r^2-x^2))'=2sqrt(r^2-x^2)+x/(sqrt(r^2-x^2))*(r^2-x^2)'=

=2sqrt(r^2-x^2)-(2x^2)/(sqrt(r^2-x^2))=2(r^2-2x^2)/(sqrt(r^2-x^2)).

We have to find maximum of A(x) on closed interval [0,r].

So, A'(x)=0 when r^2-2x^2=0 or x=r/(sqrt(2)) (we don't take -r/(sqrt(2)) because x should be non-negative).

Now, check endpoints: A(0)=0, A(r)=0.

Since A(r/sqrt(2))=2(r/sqrt(2))sqrt(r^2-(r/sqrt(2))^2)=r^2>0 then maximum occurs when x=r/(sqrt(2)).

Largest possible area is r^2.

Solution 2. There is another solution. Connect center of circle with point (x,y). If theta is angle between drawn line and positive direction of x-axis then x=rcos(theta) and y=rsin(theta).

Area can be rewritten as A=2xy=2rcos(theta)rsin(theta)=r^2sin(2theta).

Since sin(2theta)<=1 then maximum occurs when sin(2theta)=1 or 2theta=pi/2 which gives theta=pi/4.

In this case A=r^2, x=rcos(pi/4)=r/(sqrt(2)) and y=rsin(pi/4)=r/(sqrt(2)) which are same answers as in solution 1.

Note, that in solution 2 we didn't use derivatives and calculus at all.