Mathwords logoMathwords

Constraint — Definition & Example

A constraint is a rule that limits which values the variables in a problem are allowed to take. In real situations, constraints describe limits such as a budget, available time, materials, or space.

A constraint is an equation h(x1,…,xn)=ch(x_1,\dots,x_n)=c or inequality g(x1,…,xn)≤bg(x_1,\dots,x_n)\le b (or ≥b\ge b) that the decision variables must satisfy. The set of all points satisfying every constraint at once is called the feasible region. A solution to a constrained problem must lie in this set.

Key Formula

maximize f(x,y)subject togi(x,y)≤bi,  i=1,…,m\text{maximize } f(x, y) \quad \text{subject to} \quad g_i(x, y) \le b_i, \; i = 1, \dots, m
Where:
  • f(x,y)f(x, y) = objective function: the quantity to maximize or minimize
  • gi(x,y)g_i(x, y) = the expression on the left side of the i-th constraint
  • bib_i = the limit (bound) for the i-th constraint
  • mm = the number of constraints

How It Works

First translate each limit in a word problem into a mathematical statement. Words like "at most" become ≤\le, "at least" becomes ≥\ge, and "exactly" becomes ==. Include hidden constraints too, such as quantities that cannot be negative. Together these constraints define the feasible region. In linear programming, if a best solution exists, at least one occurs at a corner (vertex) of that region, so you test the corners in the objective function.

Worked Example

Problem: A bakery makes xx batches of muffins and yy batches of cookies per day. The oven can bake at most 10 batches a day. There are only enough blueberries for at most 6 muffin batches. Each muffin batch earns $30 profit and each cookie batch earns $20. How many of each should the bakery make to maximize profit?
Step 1: Write the objective function and every constraint, including the nonnegativity constraints.
P=30x+20ysubject tox+y≤10,  x≤6,  x≥0,  y≥0P = 30x + 20y \quad \text{subject to} \quad x + y \le 10,\; x \le 6,\; x \ge 0,\; y \ge 0
Step 2: Find the corners of the feasible region. Three corners lie on the axes. The fourth is where x=6x = 6 meets x+y=10x + y = 10, which gives 6+y=106 + y = 10, so y=4y = 4.
(0,0),  (6,0),  (6,4),  (0,10)(0, 0),\; (6, 0),\; (6, 4),\; (0, 10)
Step 3: Evaluate the profit at each corner.
P(0,0)=0,P(6,0)=180,P(6,4)=260,P(0,10)=200P(0,0)=0,\quad P(6,0)=180,\quad P(6,4)=260,\quad P(0,10)=200
Step 4: The largest value is at (6,4)(6, 4). Check that this point satisfies every constraint: 6+4=10≤106 + 4 = 10 \le 10 and 6≤66 \le 6.
Pmax⁡=260 at (6,4)P_{\max} = 260 \text{ at } (6, 4)
Answer: Make 6 batches of muffins and 4 batches of cookies, for a maximum profit of $260 per day.

Why It Matters

Constraints appear throughout the linear programming unit in Algebra 2 and Precalculus, where you graph systems of inequalities to find feasible regions. In AP Calculus, optimization problems such as "maximize the area of a rectangle with 40 ft of fencing" depend on using a constraint to remove one variable. Operations researchers use thousands of constraints to schedule airline crews and route delivery trucks.

Common Mistakes

Mistake: Forgetting hidden constraints such as x≥0x \ge 0 and y≥0y \ge 0.
Correction: You cannot bake a negative number of batches or build a negative length. Always ask whether each variable has a natural lower or upper bound, and add it to your list.
Mistake: Choosing the point with the highest objective value without checking every constraint. In the bakery problem, (10,0)(10, 0) gives $300, but it violates x≤6x \le 6.
Correction: A point only counts if it satisfies all constraints at once. Test the corners of the feasible region, not intersections that fall outside it.

Related Terms