For situations where the function is complex or may have many optimal points, calculus may be the most suitable tool for solving an optimization problem. Calculus has a powerful device for finding the maximum or minimum of a function. This tool is called the "derivative." The derivative allows you to convert the function to another function. By setting the new function equal to zero and solving for the independent variable, you can determine exactly at what point or points the original function has an optimal point. Solving the problem then reduces to substituting these points into the function to see which has the largest or smallest value. A list of derivatives can be found in any introductory calculus book.
If your optimization function is restricted to a discrete domain, then trial and error is often the fastest method to finding the maximum or minimum of the function of interest. Even in the case of having an especially complex function, trial and error allows you to find the correct answer with certainty. Trial and error is a method in which you exhaust all possibilities in an organized manner. To use this method, take the independent variables and plug them into the function, one by one, taking note of the function's resulting values. On a discrete domain, this should not take much time, especially if you are using logic to determine which variables need not be looked at. For example, if you discover that positive variables always yield results smaller than negative variables, you can exclude all of the positive variables from the process.
Many times, graphing allows you to see where the optimal point of a function is. You can use a graphing calculator, computer software or graphing paper to draw and observe the function. A function will have a maximum or minimum point at a point that has a horizontal tangent. Thus, you should look for points at which a horizontal line touches the graph at only that point. These points are the possible minimum or maximums of the function. You need only look to determine which is which.
Linear programming is an advanced method of solving optimization problems. Linear programming is most suitable when you have a set of constraints for your variables. For example, you may need to find the maximum of "z = x + 2y" when "x" and "y" have constraints associated with them. These constraints may as simple as "x > y," but even such simple a constraint can often lead to making an optimization difficult to solve. Linear programming may be your last resort since it is an entire mathematical field, but its methods always yield an optimal result.