# 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 $\displaystyle f{\left ( x \right )}$ that you want to maximize or minimize by choosing the value of $\displaystyle x$ that results in the optimal (maximal or minimal) value.

Often, your equation for $\displaystyle f{\left ( x \right )}$ will contain another variable other than $\displaystyle x$. 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:

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

## Example

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

Since $\displaystyle a + b = 9$, we have

$\displaystyle b = 9 - a$.

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

$\displaystyle f{\left ( a \right )} = a \sqrt{b} = a \sqrt{9 - a}$.

Taking the derivative gives us

$\displaystyle f{'} ( a ) = \sqrt{9 - a} - \frac{a}{2 \sqrt{9 - a}}$,

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

$\displaystyle 0 = \sqrt{9 - a} - \frac{a}{2 \sqrt{9 - a}} = \frac{2 \left ( 9 - a \right )}{2 \sqrt{9 - a}} - \frac{a}{2 \sqrt{9 - a}}$.

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

$\displaystyle 0 = 2 \left ( 9 - a \right ) - a \qquad \Rightarrow \qquad a = 6$.

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