Last updated on July 4th, 2025
Linear programming is a way to find the best possible result for a situation using a mathematical method. Linear programming helps simplify a complex situation, making it easier to study and solve the problem. This article explores linear programming concepts.
The mathematical method used to find the best possible output is called linear programming. It is used in situations involving linear relationships, such as the maximum profit or minimum cost in a business. It helps make decisions like maximizing profit or minimizing cost by using equations and inequalities. It is used in many fields to solve real-life problems.
Objective function, constraints, and decision variables are the components of linear programming. We will learn about them one by one.
Formulating the problem using the given data is the first step for solving linear programming problems. The steps given below are used to solve linear programming problems.
Step 1: Make the objective clear, like how many items to produce. These are our decision variables.
Step 2: Formulate the objective function that shows what we want to maximize or minimize. This is our objective function.
Step 3: Write down all the constraints, like how much money, time, or materials we can use.
Step 4: Make sure the choices can’t be negative. We can’t produce a negative number of items, so our minimal decision variable should be zero.
Step 5: Solve the problem using the graphical method or the simplex method to find the best answer.
Linear programming can be used to achieve the best result when we have limitations. These two methods mentioned below are used to solve linear programming:
The constraints (conditions or limits) are drawn on the graph in this method. Then we have to look for the common area where all the constraints are true. This is called feasible region. We can check the corners of the area to see where we can get the best result.
Example: Rohan has $10 with which he wants to buy pencils worth $2 a piece and erasers worth $1 each. Rohan wants to buy at most 7 items in total.
Solution:
1. Let x be the number of pencils and y be the number of erasers.
2. Write the constraints.
2x + y ≤ 10 (money limit).
x + y ≤ 7 (items limit).
x ≥ 0, y ≥ 0, because the items cannot be negative.
3. Draw these lines on a graph.
4. Shade the area that fits all the constraints.
5. Try the corner points and calculate the cost.
6. Pick the point that gives the Go through the objective function at each corner point of the feasible region. Select the point that gives the lowest or highest value. The selection of this point depends on the objective.
The simplex method checks only one possible answer at a time. It helps in solving bigger problems. It keeps improving the answer until it can’t get better. Imagine if we have Lego bricks, and we want to build the biggest tower, but only with a certain number of red and blue bricks. In this situation, the simplex method helps us figure out how many red and blue bricks can be used to build the tallest tower.
The method also uses a table called simplex tableau to keep the equations organized. The method utilizes a new, basic variable at each step to replace one solution with another. In other words, it uses the table to decide on the change that improves the tower’s height the most. This process called pivoting helps explore the feasible region and the best solution is then selected. It is like swapping the bricks in and out, one brick at a time, and selecting the best possible Lego brick.
Linear programming is used in different real-life scenarios such as engineering, healthcare, and marketing. Let us take a look at their applications mentioned below:
Linear programming is a useful tool for solving problems that involve limited resources. While using linear programming, students might make minor mistakes that can lead to the wrong answer. Here are some of the common mistakes and the ways to avoid them.
You sell bookmarks and stickers, making $2 for a bookmark and $1 for a sticker. You can make 10 items, but have only 12 minutes, and it takes 2 minutes for a bookmark and 1 minute for a sticker. How many bookmarks and stickers should you make to earn the maximum amount?
Make 4 bookmarks and 6 stickers to earn $14.
Let x = number of bookmarks
y = number of stickers
Total money = 2x + 1y
Constraints:
x + y ≤ 10 (total items)
2x + 1y ≤ 12 (time)
x ≥ 0 and y ≥ 0, because we can’t make negative items.
Draw these lines on the graph and find points where the lines meet.
Check each corner of the feasible region to find the best answer:
Point (x, y) | Money = 2x + y |
(0, 0) | 0 |
(0, 10) | 10 |
(3, 6) | 12 |
(4, 6) | 14 |
(6, 0) | 12 |
So, 4 bookmarks and 6 stickers give the maximum amount of $14.
John wants to buy apples and bananas. $3 and $2 per fruit is the cost of an apple and banana respectively. John needs 6 fruits at least. He needs to buy at least 2 apples, and he doesn't want to spend too much. How many of each should he buy to spend as less as possible?
John buys 2 apples and 4 bananas at a cost of $14.
Let x = apples and y = bananas
Cost = 3x + 2y
Constraints:
x + y ≥ 6 (needs 6 fruits)
x ≥ 2 (at least 2 apples)
x ≥ 0 and y ≥ 0 (no negative fruits)
Try with small numbers that follow the rules and compare the cost:
Apples (x) | Bananas (y) | Total fruits | Cost |
2 | 4 | 6 | $14 |
2 | 5 | 7 | $16 |
3 | 3 | 6 | $15 |
4 | 2 | 6 | $16 |
John’s best option is to buy 4 bananas and 2 apples at $14.
Sam has 10 hours for fun during the weekend. He plays video games (1 hour each) and watches movies (2 hours each) He wants to do at most 6 activities total He wants to spend all 10 hours having fun. Each video game gives him 5 fun points, and each movie gives him 8 fun points. What should Sam do to get the most fun points?
Sam should play 2 video games and watch 4 movies for 42 fun points.
Let x = video games, and y = movies.
Fun = 5x + 8y
Constraints:
Time: x + 2y = 10 ⇒ x = 10 - 2y
Substituting the values into the activity limit,
(10 − 2y) + y ≤ 6 ⇒ 10 − y ≤ 6 ⇒ y ≥ 4
Also since x = 10 - 2y, x ≥ 0 ⇒ 10 − 2y ≥ 0 ⇒ y ≤ 5
So the values for y are: 4 ≤ y ≤ 5
Let us substitute y as 4 and check
x = 10 − 2(4) = 2.
Total activities = x + y = 2 + 4 = 6
P = 5(2) + 8(4) = 10 + 32 = 42
Only 4 games and 2 movies use 10 hours and 6 activities.
A school bus must visit 2 towns: town A and town B. It uses 3 liters of fuel for town A and 5 liters of fuel for town B. It can use no more than 30 liters total and must visit 5 towns in total. Fuel costs $1 per liter. How many towns A and B should the bus visit to use the least fuel?
Visits 5 towns in A and 0 towns in B.
Total cost: $15
Let x = towns in A and y = towns in B
Fuel used: 3x + 5y
Constraints:
3x + 5y ≤ 30
x + y ≥ 5
x ≥ 0 and y ≥ 0
Try the combinations that follow the rules:
x | y | Total Towns | Fuel | Cost |
5 | 0 | 5 | 15 | $15 |
4 | 1 | 5 | 17 | |
3 | 2 | 5 | 19 | |
2 | 3 | 5 | 21 |
A factory makes toy cars and toy trucks. Selling a car and a truck means a profit of $4 and $6 respectively. Cars take 1 hour to make, trucks take 3 hours. Factor works only 9 hours a day. Can make at most 4 trucks. Calculate the number of cars and trucks the factory should make to get maximum profit.
Make 3 cars and 2 trucks to earn $24.
Let x = cars, y = trucks
Profit = 4x + 6y
Constraints:
1x + 3y ≤ 9 (work time)
y ≤ 4 (max trucks)
x ≥ 0 and y ≥ 0
Try values that fit:
x | y | Time used | profit |
3 | 2 | 3 + 6 = 9 | $24 |
2 | 2 | 2 + 6 = 8 | $20 |
1 | 3 | 1 + 9 = 10 | Over limit |
4 | 1 | 4 + 3 = 7 | $22 |
Best is 3 cars, 2 trucks for $24 profit.
Jaskaran Singh Saluja is a math wizard with nearly three years of experience as a math teacher. His expertise is in algebra, so he can make algebra classes interesting by turning tricky equations into simple puzzles.
: He loves to play the quiz with kids through algebra to make kids love it.