Mathematical optimization

In many branches of science, including mathematics, **mathematical optimization** is a branch that is about finding a right set of answers that gives the best (optimal) solution to a problem, given some limitations, or criteria. In the simplest case, this means that a function needs to be minimized or maximized.

## Example
For example, consider a baker with a set amount of flour, sugar, yeast, etc. They also are given five hours to prepare. Time and ingredients are the constraints, or criteria. The baker is tasked with providing the largest volume of food to feed a hungry crowd. Maximizing the number of servings is the optimization function.

## Difficulty
Many problems are much harder, though, and solving them analytically is not feasible: in these cases, numerical methods are often used.  This often is a result of when the decisions that need to be made involve whole numbers.  A baker can usually make half of a recipe, but consider a rancher trying to determine how many cattle and sheep to graze.  Limitations may include amount of land available or money to purchase the animals. The optimization function is to maximize profit. If they could purchase a fraction of a cow or sheep, then the problem is pretty easy to solve.  However, since one can only buy whole sheep or cows, the problem becomes very difficult to solve perfectly, so the best one can do is sometimes to get a "best guess" using numerical methods with the help of a computer.

## Solutions
The first step is usually to take the derivative of the initial function. From here maxima or minima can be found within a domain by simply finding the critical points. These include domain (x) values where the differentiated function equals 0 or does not exist. Simply finding critical points is not enough to determine maxima or minima. The final step to determining a maximum, minimum, or neither can be one of two methods.

(1) X values lesser and lesser than the critical point must be substituted into the differentiated function to determine if the values change sign. If they go from negative to positive, the critical point is a minimum. If they go from positive to negative, the critical point is a maximum. If neither occurs, the point is neither. This is known as the first derivative test.

(2) The derivative of the differentiated function can be taken, creating a second-order derivative. The critical point must be substituted into the second derivative. If the output is positive, the critical point is a minimum. If the output is negative, the critical point is a maximum. This is known as the second derivative test.

## Applications
The application of optimization span many fields. A simple example is attempting to find the smallest possible difference in the distance of two objects in two-dimensional space (x and y). In this context, the derivative of the function that gives the difference is taken in order to find the minimum. A more complicated example is in Machine Learning, in which the optimization function attempts to find the global minimum of the loss function in order to minimize the difference or loss between the algorithm’s predictions and the actual values. This example is more difficult as Machine learning algorithms often utilize multidimensional data usually in the form of tensors yielding more complicated functions.

## Related software
Today, there are many tools to support optimization studies:
* MATLAB
* Wolfram Mathematica

## References