# Calculus/Optimization

 ← Related Rates Calculus Euler's Method → Optimization

## Introduction

Optimization is one of the uses of calculus in the real world. Let us assume we are a pizza parlor and wish to maximize profit. Perhaps we have a flat piece of cardboard and we need to make a box with the greatest volume. How does one go about this process?

This requires the use of maximums and minimums. We know that we find maximums and minimums via derivatives. Therefore, one can conclude that calculus will be a useful tool for maximizing or minimizing (collectively known as "optimizing") a situation.

## How to Solve

These general steps should be taken in order to complete an optimization problem.

1. Write out formulas and other pieces of information about the problem.
1. The problems should have a variable you control and a variable that you want to maximize/minimize.
2. The formulas you find may contain extra variables. Depending on how the question works out, they may be substituted out or can be ignored (which will be explained later).
2. Combine the formulas together so that the variable you want to maximize/minimize is on one side of the equation and everything else is on the other side.
3. Differentiate the formula. If your equation has multiple variables, pick any variable to differentiate as long as it is not the one you control (i.e. pick the variable that you could not get rid of from the formula).
1. Note that during differentiation, if you come across a variable that you have not picked, imagine it as a number and apply the necessary differentiation rule. Do not treat it as a variable in this case.
4. Set the differentiated formula to equal 0 and solve for the variable you control.
5. The value you get here is your answer. If you instead have another formula, that means that your answer depends on those other variables, which would usually be what the question asked for if you have such a situation that you have another variable to juggle to begin with.

The reason why this algorithm works comes from a few mathematical theorems which you will probably not need to know when completing these problems. Usually the problems given will be mathematically simple (in other words, there are not a lot of cases to test). However, if you wish to know, they work like this:

• A derivative of 0 is either a global or local maximum or minimum. Usually the question will tend towards answering that question without much difficulty (like always positive numbers, for example)

## Examples

### Volume Example

A box manufacturer desires to create a box with a surface area of 100 inches squared. What is the maximum size volume that can be formed by bending this material into a box? The box is to be closed. The box is to have a square base, square top, and rectangular sides.
• Write out known formulas and information
${\displaystyle A_{base}=x^{2}}$
${\displaystyle A_{side}=x\cdot h}$
${\displaystyle A_{total}=2x^{2}+4x\cdot h=100}$
${\displaystyle V=l\cdot w\cdot h=x^{2}\cdot h}$
• Eliminate the variable h in the volume equation
${\displaystyle 2x^{2}+4xh=100}$
${\displaystyle x^{2}+2xh=50}$
${\displaystyle 2xh=50-x^{2}}$
${\displaystyle h={\frac {50-x^{2}}{2x}}}$
${\displaystyle V=(x^{2})\left({\frac {50-x^{2}}{2x}}\right)}$

${\displaystyle ={\frac {50x-x^{3}}{2}}}$

• Find the derivative of the volume equation in order to maximize the volume
${\displaystyle {\frac {dV}{dx}}={\frac {50-3x^{2}}{2}}}$
• Set ${\displaystyle {\frac {dV}{dx}}=0}$ and solve for ${\displaystyle x}$
${\displaystyle {\frac {50-3x^{2}}{2}}=0}$
${\displaystyle 50-3x^{2}=0}$
${\displaystyle 3x^{2}=50}$
${\displaystyle x=\pm {\frac {\sqrt {50}}{\sqrt {3}}}}$
• Plug-in the x value into the volume equation and simplify

${\displaystyle V={\frac {1}{2}}\left[50{\sqrt {\frac {50}{3}}}-\left({\sqrt {\frac {50}{3}}}\right)^{3}\right]}$ ${\displaystyle =68.04138174...}$

Answer: ${\displaystyle V_{max}=68.04138174...}$

### Volume Example II

It is desired to make an open-top box of greatest possible volume from a square piece of tin whose side is ${\displaystyle \alpha }$ , by cutting equal squares out of the corners and then folding up the tin to form the sides. What should be the length of a side of the squares cut out?

If we call the side length of the cut out squares ${\displaystyle x}$ , then each side of the base of the folded box is ${\displaystyle \alpha -2x}$ , and the height is ${\displaystyle x}$ . Therefore, the volume function is ${\displaystyle V(x)=x(\alpha -2x)^{2}=x(\alpha ^{2}-4\alpha x+4x^{2})=\alpha ^{2}x-4\alpha x^{2}+4x^{3}}$ .

We must optimize the volume by taking the derivative of the volume function and setting it equal to 0. Since it does not change, ${\displaystyle \alpha }$ is treated as a constant, not a variable.

${\displaystyle V(x)=\alpha ^{2}x-4\alpha x^{2}+4x^{3}}$

${\displaystyle V'(x)=\alpha ^{2}-8\alpha x+12x^{2}}$

${\displaystyle 0=12x^{2}-8\alpha x+\alpha ^{2}}$

We can now use the quadratic formula to solve for ${\displaystyle x}$ :

${\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}}$

${\displaystyle x={\frac {-(-8\alpha )\pm {\sqrt {(-8\alpha )^{2}-4(12)(\alpha ^{2})}}}{2(12)}}}$

${\displaystyle x={\frac {8\alpha \pm {\sqrt {64\alpha ^{2}-48\alpha ^{2}}}}{24}}}$

${\displaystyle x={\frac {8\alpha \pm {\sqrt {16\alpha ^{2}}}}{24}}}$

${\displaystyle x={\frac {8\alpha \pm 4\alpha }{24}}}$

${\displaystyle x={\frac {\alpha }{6}},{\frac {\alpha }{2}}}$

We reject ${\displaystyle x={\frac {\alpha }{2}}}$ , since it is a minimum (it results in the base length ${\displaystyle \alpha -2x}$ being 0, making the volume 0). Therefore, the answer is ${\displaystyle x={\frac {\alpha }{6}}}$ .

### Sales Example

A small retailer can sell n units of a product for a revenue of ${\displaystyle r(n)=8.1n}$ and at a cost of ${\displaystyle c(n)=n^{3}-7n^{2}+18n}$, with all amounts in thousands. How many units does it sell to maximize its profit?

The retailer's profit is defined by the equation ${\displaystyle p(n)=r(n)-c(n)}$, which is the revenue generated less the cost. The question asks for the maximum amount of profit which is the maximum of the above equation. As previously discussed, the maxima and minima of a graph are found when the slope of said graph is equal to zero. To find the slope one finds the derivative of ${\displaystyle p(n)}$ . By using the subtraction rule ${\displaystyle p'(n)=r'(n)-c'(n)}$ : ${\displaystyle p(n)=r(n)-c(n)}$ ${\displaystyle p'(n)={\frac {d}{dn}}[8.1n]-{\frac {d}{dn}}\left[n^{3}-7n^{2}+18n\right]=-3n^{2}+14n-9.9}$

Therefore, when ${\displaystyle -3n^{2}+14n-9.9=0}$ the profit will be maximized or minimized. Use the quadratic formula to find the roots, giving {3.798,0.869}. To find which of these is the maximum and minimum the function can be tested:

${\displaystyle p(0.869)=-3.97321,p(3.798)=8.58802}$

Because we only consider the functions for all ${\displaystyle n\geq 0}$ (i.e., you can't have ${\displaystyle n=-5}$ units), the only points that can be minima or maxima are those two listed above. To show that 3.798 is in fact a maximum (and that the function doesn't remain constant past this point) check if the sign of ${\displaystyle p'(n)}$ changes at this point. It does, and for n greater than 3.798 ${\displaystyle P'(n)}$ the value will remain decreasing. Finally, this shows that for this retailer selling 3.798 units would return a profit of \$8,588.02.

 ← Related Rates Calculus Euler's Method → Optimization