# Optimization

Optimization problems require you to find the best option from a set of alternatives, based on some criteria. In general, you have some function $f(x)$ that you want to *maximize* or *minimize* by choosing the value of $x$ that results in the optimal (maximal or minimal) value.

Often, your equation for $f(x)$ will contain another variable other than $x\text{.}$ This is where the *constraint* comes in. It is a different equation that has both variables in it, so you can solve it for the other variable and substitute that into the original function.

Here is the basic strategy for solving optimization problems:

- Draw a sketch of the problem, if applicable.
- Introduce variables (as few as possible).
- Develop a formula for the constrained quantity.
- Develop a formula for the quantity to optimize.
- Substitute (3) into (4) and simplify.
- Take the derivative, set it equal to zero, and solve.
- Compare the function values for each solution and for the endpoints.
- Choose the optimal value and determine any remaining variables.

## Example

Given two nonnegative integers $a$ and $b$ that sum to 9, find the maximum value of $a\sqrt{b}$ assuming $a>b\text{.}$

Since $a+b=9\text{,}$ we have

$b=9-a\text{.}$

Now we can rewrite the function that we want to maximize:

$f(a)=a\sqrt{b}=a\sqrt{9-a}\text{.}$

Taking the derivative gives us

${f}^{\prime}(a)=\sqrt{9-a}-\frac{a}{2\sqrt{9-a}}\text{,}$

and now we can set it equal to zero to find the turning point:

$0=\sqrt{9-a}-\frac{a}{2\sqrt{9-a}}=\frac{2(9-a)}{2\sqrt{9-a}}-\frac{a}{2\sqrt{9-a}}\text{.}$

Assuming that $a\ne 9\text{,}$ we can drop the denominator, since zeros come from the numerator of a rational:

$0=2(9-a)-a\phantom{\rule{2em}{0ex}}\phantom{\rule{0.2778em}{0ex}}\u27f9\phantom{\rule{0.2778em}{0ex}}\phantom{\rule{2em}{0ex}}a=6\text{.}$

If $a=6\text{,}$ then $b=9-6=3\text{.}$ The values that maximize this function are 6 and 3. They result in a value of $6\sqrt{3}\approx 10.392\text{.}$