This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Graphing and Solving Equations
- Differentiation

Optimization is the process of maximizing or minimizing a desired quantity given certain constraints.

For example, you may want to create a cylindrical can that holds 1 liter with the smallest possible surface area.

Our goal is to find an absolute max (or min) of some function. We know this will occur at a local max (min). To find these we want to find the critical points (places where the derivative is 0 or undefined). We then plug these critical points into the function to find the biggest (smallest) value.

The challenge of optimization is converting the statement of the problem (a paragraph) into the right equations, in order to define the quantity to maximize (or minimize) as a function of one variable, which allows us to take the derivative and find the critical points.

We will generally follow these steps:

**Step 1** Define relevant variables.

**Step 2** Draw a picture.

**Step 3** Determine equations relating the variables.

**Step 4** Use the given constraints to eliminate as many variables as possible in order to write the quantity to be maximized (or minimized) as a function of one variable.

**Step 5** Take the derivative of our function.

**Step 6** Set the derivative equal to 0 and solve for the variable. Find where the derivative is undefined (if any). These are the critical points.

**Step 7** Plug the critical points and the endpoints of the domain into the function. [Note: If the endpoints of the domain are not included in the domain, then take limits instead.] The largest (smallest) value is the absolute max (min).

**Step 8** Check your answer with a graph.

**Step 9** Answer the original question. Sometimes you are asked for the max (or min) value. Other times you are asked for the values of the variables that result in that max (min) value. Sometimes you're asked for all of the above. When you're done with the other steps, go back and read the question. *And don't forget to use correct units.*

A rectangle has perimeter 100 meters. Find the dimensions that maximize the area.

**Solution**

**Step 1** Define variables: (1) the dimensions of the rectangle, which we'll call and ; (2) the area, which we'll call ; and (3) the perimeter, which we'll call .

**Step 2** Draw a picture.

**Step 3** Set up equations:

the area of a rectangle is .

the perimeter is .

**Step 4** Eliminate variables:

We are told that . Plug this in to the perimeter equation and solve for one of the variables:

[y == -x + 50]

We found . Plug this into the area equation:

This equation gives as a function of :

**Steps 5 and 6** Take the derivative and find the critical points.

[x == 25]

So if and only if .

Is the derivative ever undefined? No, except at the endpoints of the domain.

We need and to be positive (they are distances), which means they also need to be less than 50 (if one is greater than 50, the other would have to be less than 0 to get a perimeter of 100). So our endpoints are and .

**Step 7** Plug the critical points into the function:

0
625
0

Now we see that 625 is the maximum possible area, which occurs when .

**Step 8** Check with a graph.

We can see that does indeed have a maximum value around .

**Step 9** Answer the question:

When meters, meters as well.

So the rectangle with maximum area and perimeter m is a m by m square.

A landscape architect wishes to enclose a rectangular garden. On one side she will use a brick wall costing $30 per foot, and on the other three sides she will use a metal fence costing $10 per foot. If the area of the garden is to be 1000 square feet, find the dimensions of the garden that will minimize the cost of material.

**Solution**

**Step 1** =area of garden, =cost of material, =length, =width (put brick along one of the "" sides)

**Step 2** Draw a picture.

**Step 3**

The cost of fence is the cost per foot times the distance for each side:

**Step 4** We are told , so plug this into the area equation and solve for :

Now substitute for in the cost equation to get a function of :

**Steps 5 and 6** Take the derivative and find the critical points.

[x == -20*sqrt(5), x == 20*sqrt(5)]

Since x is a distance, we know , so we have one critical point: .

The domain of the cost function is .

**Step 7** Let's plug the critical point into the cost function:

800*sqrt(5)
1788.85438199983

What happens to the cost as or ?

+Infinity
+Infinity

As the dimension gets really small or really large, the cost increases without bound, so we have a minimum at our critical point.

**Step 8** Check with a graph.

We can see a minimum around .

**Step 9** Make sure to answer the question: What dimensions minimize the cost?

We want feet, and then feet (remember the brick goes along one of the sides of this length).

A box with no top is to be constructed from a 5 ft by 4 ft piece of cardboard by cutting a square from each corner and folding up the sides. How much should be cut off each corner to maximize the volume of the box?

**Solution**

**Step 1** volume, length, width, and height. We'll cut out an by square from each side (when we fold up the sides, will be the height of the box).

**Step 2** Draw a picture.

**Step 3** The volume of the box is , where and .

**Step 4** Substituting we see

4*h^3 - 18*h^2 + 20*h

**Steps 5 and 6**

[h == -1/6*sqrt(21) + 3/2, h == 1/6*sqrt(21) + 3/2]

0.736237384174027
2.26376261582597

**Step 7**

-1/54*(sqrt(21) - 9)^3 - 1/2*(sqrt(21) - 9)^2 - 10/3*sqrt(21) + 30
6.56422554052121

1/54*(sqrt(21) + 9)^3 - 1/2*(sqrt(21) + 9)^2 + 10/3*sqrt(21) + 30
-0.564225540521207

The second value gives a negative volume, so that can't be right. It looks like the first value is the one we want.

We should also think about the endpoints of the domain. We need , since it is a length. We also need , because , and if , then .

Indeed, if we set or we get a volume of 0. This also explains why we got a negative volume for .

0
0

So the maximum volume is about , which occurs when .

**Step 8** On the graph, we can see a max around .

**Step 9** We should cut off approximately feet from each corner.