# Mathematical Optimization

Explore optimization problems and their applications, and learn mathematical optimization by solving a problem using CVXPY.

## What is mathematical optimization?

Mathematical optimization, also known as mathematical programming, is the process of finding the best solution to a problem from a set of possible solutions, often subject to constraints or conditions. The problem is typically formulated as an optimization problem consisting of an objective function to be maximized or minimized and a set of constraints that limit the feasible solutions.

The objective function is a mathematical expression that measures the performance or quality of the solution, and the constraints are mathematical expressions that specify the conditions the solution must satisfy. The **feasible solutions** are those that satisfy all the constraints, and the **optimal solution** is the one that maximizes or minimizes the objective function while satisfying the constraints.

### Example

Suppose we have a budget of $5000 to purchase two types of products: product A and product B. Each unit of product A costs $25, and each unit of product B is $35. We want to maximize the total number of units purchased subject to the following constraints:

- The total purchase cost must not exceed the budget of $5000.
- The number of units of product A must be at least 50.
- The number of units of product B must be at least 60.

Let $x$ be the number of units of product A purchased and $y$ be the number of units of product B purchased. Then, the objective function to be maximized is:

$f(x,y) = x + y$

The constraints can be written as follows:

$\begin{aligned} 25x + 35y & <= 5000 \\ x &>= 50 \\ y &>= 60 \end{aligned}$

Get hands-on with 1200+ tech skills courses.