Linear Programming: Graphical Method, Constraints, and Examples
Solve two-variable linear programs using feasible vertices. Compare finite optima, integer constraints, ties, and infeasible or unbounded cases.
TL;DR
Linear programming maximises or minimises a linear objective subject to linear constraints. For a bounded two-variable feasible polygon, evaluate the objective at its vertices to find an optimum.
Key Points
- Define the decision variables and what their units represent.
- Write the quantity to optimise as a linear objective.
- The feasible region contains points satisfying all constraints together.
- Check the feasible vertices, including intersections of constraints and axes.
- A continuous solution can be fractional. Whole-number decisions require an integer model.
What is a linear programming problem?
Choose values for the decision variables, such as the quantities of two products. A constraint limits their allowed combinations. An objective function measures what you want to maximise or minimise, such as output or cost. Both must be linear in the variables. A term like or would change the type of problem.
For example, suppose and use two limited resources. The constraints might be , , , and . The objective might be to maximise . All allowable solutions must satisfy the four inequalities at once. The inclusive inequality guide explains how to handle boundaries.
One common maximisation form is subject to and . Here the vector collects decisions, lists their objective coefficients, and each row of gives the amounts used in a constraint. The matching entry of is that constraint's limit. Inequalities between vectors are checked one row at a time.
How do you solve a two-variable linear program graphically?
- Convert each constraint temporarily to an equation and graph its boundary line.
- Use a test point to identify the half-plane that satisfies each inequality. Use a point off the line.
- Keep the intersection of the feasible half-planes.
- Find the vertices of that region by solving pairs of boundary equations or checking axis intersections. Verify each vertex against all inequalities.
- Evaluate the objective at every feasible vertex. Choose the largest or smallest value as requested.
For a bounded polygon, every feasible point is a weighted combination of vertices, with nonnegative weights adding to 1. A linear objective at that point is the same weighted combination of its values at the vertices. It cannot exceed the largest of those values or fall below the smallest. This explains the corner method used in OpenStax and the UNAM notes.
How do you distinguish infeasibility, unboundedness, and ties?
| Situation | Meaning | What to check |
|---|---|---|
| Infeasible | No point satisfies every constraint | Check for inconsistent limits |
| Unbounded feasible region | Some allowable values extend without limit | The objective can still have a finite optimum |
| Unbounded maximum or minimum | The objective can improve without limit | Identify a feasible direction that improves it |
| Multiple optimal solutions | Different feasible points have the same best value | If two feasible points tie for the optimum, the segment between them ties too |
Larger linear programs are usually solved with algorithms such as simplex or interior-point methods. The graphical method is especially suited to two variables. If the quantities must be whole numbers, a linear objective with integrality constraints is an integer linear program. Rounding a fractional solution can make a constraint fail.
Worked Linear Programming Examples
Example 1
Maximise with , , and .
- The feasible axis intercepts are and . Solving both resource boundaries gives . The origin also satisfies the constraints.
- Evaluate at , , , and . The values are 0, 18, 32 and 30.
- The maximum is 32 at .
Example 2
Minimise with , , and .
- The boundary meets at and at .
- These give costs 20 and 23 respectively. Moving farther out with either coordinate increases cost when the other is fixed.
- For fixed , the least costly permissible is . Substitution shows cost rises as increases from 2, so the minimum is 20 at .
Example 3
Use the feasible region from Example 1 to maximise .
- The resource limit bounds above by 12.
- Both and are feasible and give 12.
- Every point on that segment is feasible and gives the same maximum. There are infinitely many optimal solutions.
Example 4
Find the maximum of if and . Then require both variables to be whole numbers.
- In the continuous model, . The point gives the maximum of 3.5.
- If both variables are integers, their sum is an integer, so it cannot exceed 3. The point is feasible and has sum 3.
- The integer maximum is 3. Rounding up to 4 while keeping would violate the capacity limit.
Example 5
Can and hold together?
- Any value satisfying the first constraint is at least 5.
- Any value satisfying the second is at most 3.
- No meets both. The system is infeasible regardless of the objective.
Example 6
Maximise with only and .
- Points are feasible for all .
- At each such point the objective equals .
- It can increase without bound. There is no finite maximum.
Mistakes That Change a Linear Program
Mistake 1: Using a boundary intersection that violates another constraint
After finding a candidate point, substitute it into all the inequalities. For Example 1, lies on one boundary but violates .
Mistake 2: Maximising a coefficient by itself
The coefficient 5 in tells you the contribution of one unit of . The resource limits still decide how much is feasible. Compare full objective values at the vertices.
Mistake 3: Deleting an equality boundary from an inclusive constraint
For and , points on the boundary can be feasible and often contain the optimum. Draw the boundary as included.
Try It Yourself
- Maximise with and .
- For the same region, where is maximised?
- Is feasible for and ?
Answers and Reasoning
- At , , and , the objective values are 0, 8, and 4. The maximum is 8 at .
- Every point on the segment with nonnegative coordinates gives 4.
- No. The left side is .
Questions About Linear Programming
Does every feasible linear program have a solution?
A feasible program has allowable points. It can lack a finite optimal value if the objective improves without limit. A continuous linear objective on a nonempty bounded, closed feasible region always attains an optimum.
What do the objective lines show?
In two variables, equal objective values lie on parallel lines. Moving these lines toward better values shows where one last touches the feasible region, such as a single vertex or an entire edge.
Conclusion
- Model the variables, objective, and all constraints.
- Check the feasible region and its corner points.
- Consider whether the model requires integers and whether the objective has a finite optimum.
Read More
- Read positive, negative, and zero slopes
- Use a matrix to check systems of equations
- Select algebra formulas for lines and inequalities
Research Behind This Article
- OpenStax, Contemporary Mathematics — Linear Programming. OpenStax
- Omar Antolín Camarena, Thinking of Linear Programs Geometrically. UNAM
- Oregon State University Extension, Operations Research: Using the Graphical Method to Solve Linear Programs. Oregon State
- National Taiwan University, Optimization — Introduction to Linear Programming. NTU