- Math Article

Linear Programming

In Mathematics, linear programming is a method of optimising operations with some constraints. The main objective of linear programming is to maximize or minimize the numerical value. It consists of linear functions which are subjected to the constraints in the form of linear equations or in the form of inequalities. Linear programming is considered an important technique that is used to find the optimum resource utilisation. The term “linear programming” consists of two words as linear and programming. The word “linear” defines the relationship between multiple variables with degree one. The word “programming” defines the process of selecting the best solution from various alternatives.
Linear Programming is widely used in Mathematics and some other fields such as economics, business, telecommunication, and manufacturing fields. In this article, let us discuss the definition of linear programming, its components, and different methods to solve linear programming problems.
Table of Contents:
- Characteristics
- Linear programming Problems
- Simplex Method
Graphical Method
- Applications
- Practice Problems
What is Linear Programming?
Linear programming (LP) or Linear Optimisation may be defined as the problem of maximizing or minimizing a linear function that is subjected to linear constraints. The constraints may be equalities or inequalities. The optimisation problems involve the calculation of profit and loss. Linear programming problems are an important class of optimisation problems, that helps to find the feasible region and optimise the solution in order to have the highest or lowest value of the function.
In other words, linear programming is considered as an optimization method to maximize or minimize the objective function of the given mathematical model with the set of some requirements which are represented in the linear relationship. The main aim of the linear programming problem is to find the optimal solution.
Linear programming is the method of considering different inequalities relevant to a situation and calculating the best value that is required to be obtained in those conditions. Some of the assumptions taken while working with linear programming are:
- The number of constraints should be expressed in the quantitative terms
- The relationship between the constraints and the objective function should be linear
- The linear function (i.e., objective function) is to be optimised
Components of Linear Programming
The basic components of the LP are as follows:
- Decision Variables
- Constraints
- Objective Functions
Characteristics of Linear Programming
The following are the five characteristics of the linear programming problem:
Constraints – The limitations should be expressed in the mathematical form, regarding the resource.
Objective Function – In a problem, the objective function should be specified in a quantitative way.
Linearity – The relationship between two or more variables in the function must be linear. It means that the degree of the variable is one.
Finiteness – There should be finite and infinite input and output numbers. In case, if the function has infinite factors, the optimal solution is not feasible.
Non-negativity – The variable value should be positive or zero. It should not be a negative value.
Decision Variables – The decision variable will decide the output. It gives the ultimate solution of the problem. For any problem, the first step is to identify the decision variables.
Linear Programming Problems
The Linear Programming Problems (LPP) is a problem that is concerned with finding the optimal value of the given linear function. The optimal value can be either maximum value or minimum value. Here, the given linear function is considered an objective function. The objective function can contain several variables, which are subjected to the conditions and it has to satisfy the set of linear inequalities called linear constraints. The linear programming problems can be used to get the optimal solution for the following scenarios, such as manufacturing problems, diet problems, transportation problems, allocation problems and so on.
Methods to Solve Linear Programming Problems
The linear programming problem can be solved using different methods, such as the graphical method, simplex method, or by using tools such as R, open solver etc. Here, we will discuss the two most important techniques called the simplex method and graphical method in detail.
Linear Programming Simplex Method
The simplex method is one of the most popular methods to solve linear programming problems. It is an iterative process to get the feasible optimal solution. In this method, the value of the basic variable keeps transforming to obtain the maximum value for the objective function. The algorithm for linear programming simplex method is provided below:
Step 1 : Establish a given problem. (i.e.,) write the inequality constraints and objective function.
Step 2: Convert the given inequalities to equations by adding the slack variable to each inequality expression.
Step 3 : Create the initial simplex tableau. Write the objective function at the bottom row. Here, each inequality constraint appears in its own row. Now, we can represent the problem in the form of an augmented matrix, which is called the initial simplex tableau.
Step 4 : Identify the greatest negative entry in the bottom row, which helps to identify the pivot column. The greatest negative entry in the bottom row defines the largest coefficient in the objective function, which will help us to increase the value of the objective function as fastest as possible.
Step 5 : Compute the quotients. To calculate the quotient, we need to divide the entries in the far right column by the entries in the first column, excluding the bottom row. The smallest quotient identifies the row. The row identified in this step and the element identified in the step will be taken as the pivot element.
Step 6: Carry out pivoting to make all other entries in column is zero.
Step 7: If there are no negative entries in the bottom row, end the process. Otherwise, start from step 4.
Step 8: Finally, determine the solution associated with the final simplex tableau.
The graphical method is used to optimize the two-variable linear programming. If the problem has two decision variables, a graphical method is the best method to find the optimal solution. In this method, the set of inequalities are subjected to constraints. Then the inequalities are plotted in the XY plane. Once, all the inequalities are plotted in the XY graph, the intersecting region will help to decide the feasible region. The feasible region will provide the optimal solution as well as explains what all values our model can take. Let us see an example here and understand the concept of linear programming in a better way.
Calculate the maximal and minimal value of z = 5x + 3y for the following constraints.
x + 2y ≤ 14
3x – y ≥ 0
x – y ≤ 2
The three inequalities indicate the constraints. The area of the plane that will be marked is the feasible region.
The optimisation equation (z) = 5x + 3y. You have to find the (x,y) corner points that give the largest and smallest values of z.
To begin with, first solve each inequality.
x + 2y ≤ 14 ⇒ y ≤ -(1/2)x + 7
3x – y ≥ 0 ⇒ y ≤ 3x
x – y ≤ 2 ⇒ y ≥ x – 2
Here is the graph for the above equations.

Now pair the lines to form a system of linear equations to find the corner points.
y = -(½) x + 7
Solving the above equations, we get the corner points as (2, 6)
y = -1/2 x + 7
y = x – 2
Solving the above equations, we get the corner points as (6, 4)
Solving the above equations, we get the corner points as (-1, -3)
For linear systems, the maximum and minimum values of the optimisation equation lie on the corners of the feasibility region. Therefore, to find the optimum solution, you only need to plug these three points in z = 3x + 4y
z = 5(2) + 3(6) = 10 + 18 = 28
z = 5(6) + 3(4) = 30 + 12 = 42
z = 5(-1) + 3(-3) = -5 -9 = -14
Hence, the maximum of z = 42 lies at (6, 4) and the minimum of z = -14 lies at (-1, -3)
Linear Programming Applications
A real-time example would be considering the limitations of labours and materials and finding the best production levels for maximum profit in particular circumstances. It is part of a vital area of mathematics known as optimisation techniques. The applications of LP in some other fields are
- Engineering – It solves design and manufacturing problems as it is helpful for doing shape optimisation
- Efficient Manufacturing – To maximise profit, companies use linear expressions
- Energy Industry – It provides methods to optimise the electric power system.
- Transportation Optimisation – For cost and time efficiency.
Importance of Linear Programming
Linear programming is broadly applied in the field of optimisation for many reasons. Many functional problems in operations analysis can be represented as linear programming problems. Some special problems of linear programming are such as network flow queries and multi-commodity flow queries are deemed to be important to have produced much research on functional algorithms for their solution.
Linear Programming Video Lesson
Linear programming problem.

Linear Programming Practice Problems
Solve the following linear programming problems:
- A doctor wishes to mix two types of foods in such a way that the vitamin contents of the mixture contain at least 8 units of vitamin A and 10 units of vitamin C. Food ‘I’ contains 2 units/kg of vitamin A and 1 unit/kg of vitamin C. Food ‘II’ contains 1 unit/kg of vitamin A and 2 units/kg of vitamin C. It costs Rs 50 per kg to purchase Food ‘I’ and Rs 70 per kg to purchase Food ‘II’. Formulate this problem as a linear programming problem to minimise the cost of such a mixture
- One kind of cake requires 200g of flour and 25g of fat, and another kind of cake requires 100g of flour and 50g of fat. Formulate this problem as a linear programming problem to find the maximum number of cakes that can be made from 5kg of flour and 1 kg of fat assuming that there is no shortage of the other ingredients used in making the cakes.
Frequently Asked Questions on Linear Programming
Linear programming is a process of optimising the problems which are subjected to certain constraints. It means that it is the process of maximising or minimizing the linear functions under linear inequality constraints. The problem of solving linear programs is considered as the easiest one.
Mention the different types of linear programming.
The different types of linear programming are: Solving linear programming by Simplex method Solving linear programming using R Solving linear programming by graphical method Solving linear programming with the use of an open solver.
What are the requirements of linear programming?
The five basic requirements of linear programming are: Objective function Constraints Linearity Non-negativity Finiteness
Mention the advantages of Linear programming
The advantages of linear programming are: Linear programming provides insights to the business problems It helps to solve multi-dimensional problems According to the condition change, LP helps in making the adjustments By calculating the cost and profit of various things, LP helps to take the best optimal solution
What is meant by linear programming problems?
The linear programming problems (LPP) helps to find the best optimal solution of a linear function (also, known as the objective function) which are placed under certain constraints (set of linear inequality constraints)
To learn all concepts in Maths in a more engaging way, register at BYJU’S. Also, watch interesting videos on various Maths topics by downloading BYJU’S– The Learning App.
Thank you so much for clearly explained notes. I benefited a lot from them
Thank you very much for this material.
Leave a Comment Cancel reply
Your Mobile number and Email id will not be published. Required fields are marked *
Request OTP on Voice Call
Post Comment

- Share Share
Register with BYJU'S & Download Free PDFs

Steps to Solve a Linear Programming Problem
Introduction to linear programming, features of linear programming, parts of linear programming, why we need linear programming.
It is an optimization method for a linear objective function and a system of linear inequalities or equations . The linear inequalities or equations are known as constraints . The quantity which needs to be maximized or minimized (optimized) is reflected by the objective function. The fundamental objective of the linear programming model is to look for the values of the variables that optimize (maximize or minimize) the objective function.
We know that in linear programming, we subject linear functions to multiple constraints. These constraints can be written in the form of linear inequality or linear equations. This method plays a fundamental role in finding optimal resource utilization. The word "linear" in linear programming depicts the relationship between different variables. It means that the variables have a linear relationship between them. The word "programming" in linear programming shows that the optimal solution is selected from different alternatives.
We assume the following things while solving the linear programming problems:
- The constraints are expressed in the quantitative values
- There is a linear relationship between the objective function and the constraints
- The objective function which is also a linear function needs optimization

The linear programming problem has the following five features:
- Constraints
These are the limitations set on the main objective function. These limitations must be represented in the mathematical form.
- Objective function
This function is expressed as a linear function and it describes the quantity that needs optimization.
There is a linear relationship between the variables of the function.
Non-negativity
The value of the variable should be zero or non-negative.
The primary parts of a linear programming problem are given below:
- Decision variables
The applications of linear programming are widespread in many areas. It is especially used in mathematics, telecommunication, logistics, economics, business, and manufacturing fields. The main benefits of using linear programming are given below:
- It provides valuable insights to the business problems as it helps in finding the optimal solution for any situation.
- In engineering, it resolves design and manufacturing issues and facilitates in achieving optimization of shapes.
- In manufacturing, it helps to maximize profits.
- In the energy sector, it facilitates optimizing the electrical power system
- In the transportation and logistics industries, it helps in achieving time and cost efficiency.
In the next section, we will discuss the steps involved in solving linear programming problems.
We should follow the following steps while solving a linear programming problem graphically.
Step 1 - Identify the decision variables
The first step is to discern the decision variables which control the behavior of the objective function. Objective function is a function that requires optimization.
Step 2 - Write the objective function
The decision variables that you have just selected should be employed to jot down an algebraic expression that shows the quantity we are trying to optimize. In other words, we can say that the objective function is a linear equation that is comprised of decision variables.
Step 3 - Identify Set of Constraints
Constraints are the limitations in the form of equations or inequalities on the decision variables. Remember that all the decision variables are non-negative; i.e. they are either positive or zero.
Step 4 - Choose the method for solving the linear programming problem
Multiple techniques can be used to solve a linear programming problem. These techniques include:
- Simplex method
- Solving the problem using R
- Solving the problem by employing the graphical method
- Solving the problem using an open solver
In this article, we will specifically discuss how to solve linear programming problems using a graphical method.
Step 5 - Construct the graph
After you have selected the graphical method for solving the linear programming problem, you should construct the graph and plot the constraints lines.
Step 6 - Identify the feasible region
This region of the graph satisfies all the constraints in the problem. Selecting any point in the feasible region yields a valid solution for the objective function.
Step 7 - Find the optimum point
Any point in the feasible region that gives the maximum or minimum value of the objective function represents the optimal solution.
Now, that you know what are the steps involved in solving a linear programming problem, we will proceed to solve an example using the steps above.
A bakery manufacturers two kinds of cookies, chocolate chip, and caramel. The bakery forecasts the demand for at least 80 caramel and 120 chocolate chip cookies daily. Due to the limited ingredients and employees, the bakery can manufacture at most 120 caramel cookies and 140 chocolate chip cookies daily. To be profitable the bakery must sell at least 240 cookies daily.
Each chocolate chip cookie sold results in a profit of $0.75 and each caramel cookie produces $0.88 profit.
a) How many chocolate chip and caramel cookies should be made daily to maximize the profit?
b) Compute the maximum revenue that can be generated in a day?
Follow the following steps to solve the above problem.
Number of caramel cookies sold daily = x
Number of chocolate chip cookies sold daily = y
Step 2 - Write the Objective Function
Since each chocolate chip cookie yields the profit of $0.75 and each caramel cookie produces a profit of $0.88, therefore we will write the objective function as:

It is mentioned in the problem that the demand forecast of caramel cookies is at least 80 and the bakery cannot produce more than 120 caramel cookies. Therefore, we will write this constraint as:

It is also mentioned that the expected demand for the chocolate chip cookies is at least 120 and the bakery can produce no more than 140 cookies. Therefore, the second constraint is:

The green area of the graph is the feasibility region.
Step 7 - Find the Optimum point
Now, we will test the vertices of the feasibility region to determine the optimal solution. The vertices are:
(120, 120) , (100, 140), (120, 140)
(120, 120) P = 0.88 (120) + 0.75 (120) = $ 195.6
(100, 140) P = 0.88 (100) + 0.75 (140) = $ 193
(120, 140) P = 0.88 (120) + 0.75 (140) = $ 210.6
Hence, the bakery should manufacture 120 caramel cookies and 140 chocolate cookies daily to maximize the profit.
Now, we will proceed to solve the part b of the problem.
The answer to the part b is given in the previous section. The maximum profit that can be generated in a day is $210.6.
The platform that connects tutors and students
Did you like this article? Rate it!

I am passionate about travelling and currently live and work in Paris. I like to spend my time reading, gardening, running, learning languages and exploring new places.
Linear Programming Examples
Linear programming, linear programming problems and solutions, cancel reply.
Your comment
Current [email protected] *
Leave this field empty

I like it is easier to understand it the way you break it down

This is awesome and simple to digest. It indeed is user friendly 😊🙇🏽♀️

How many of each should be made to maximize profit?
Can you kindly help me solve this question. ….A company proposes to invest in two divisible projects which are expected to generate the following cash flows.
Additional information
1. The cost of capital applicable to both projects is 12%
2. Project A requires sh. 20,000 and Project B 10,000 initial investment.
3. The funds available are restricted as follows;
Cash available
4. Funds not utilized one year will not be available in the subsequent years.
i. Formulate a linear programming model to solve the above problem.
ii. Solve the problem graphically and comment on the proportion of investing on the two projects.
please help me
A farmer has 500acres of land kept for grazing by some animals.The estimate that one cow requires five acres and one goat requires 4 acres.The farmer has the facilities for 40 cows and 100 goats.if the farmer makes 300 per cow and100 per goat.How many cow and goat should be varse for maximum profit.(linear programming)
have you got the answer for this problem sir
Please sir can you help me solve this
Graceland investment limited produces two types of soup Bimpex and Dolapus if the revenue generated from each Carton of Bimpex and Dolapus are 360 naira and 240 respectively. the total raw material available for production is 180 units and it will take 20 Units to produce a Carton of Dolapus and 18units for Bimpus the time available for production is 120 hours and it will take two hours to produce a cartoon of Bimpus and 15 hours to produce Dolapus how many Carton Should graceland produce in Other maximize sales revenue- formulate the problem as a linear programming problem and solve using graphical method.
What Is Linear Programming? Definition, Methods and Problems for Data Scientists
Introduction.
Optimization is the way of life. We all have finite resources and time and we want to make the most of them. From using your time productively to solving supply chain problems for your company – everything uses optimization. It’s an especially interesting and relevant topic in data science .
It is also a very interesting topic – it starts with simple problems, but it can get very complex. For example, sharing a bar of chocolate between siblings is a simple optimization problem. We don’t think in mathematical terms while solving it. On the other hand, devising inventory and warehousing strategy for an e-tailer can be very complex. Millions of SKUs with different popularity in different regions to be delivered in defined time and resources – you see what I mean!
Linear programming (LP) is one of the simplest ways to perform optimization. It helps you solve some very complex LP problems and linear optimization problems by making a few simplifying assumptions. As an analyst, you are bound to come across applications and problems to be solved by Linear Programming solutions.
For some reason, LP doesn’t get as much attention as it deserves while learning data science . So, I thought let me do justice to this awesome technique. I decided to write an article that explains Linear programming examples in simple English. I have kept the content as simple as possible. The idea is to get you started and excited about Linear Programming.
Note- If you want to learn this in a course format, we have curated this free course for you- Linear Programming for Data Science Professionals
Table of Contents
What is linear programming, common terminologies used in linear programming, solve linear programs by graphical method, solve linear program using r, solve linear program using opensolver, simplex method, northwest corner method and least cost method, applications of linear programming.
Now, what is linear programming? Linear programming is a simple technique where we depict complex relationships through linear functions and then find the optimum points. The important word in the previous sentence is depicted. The real relationships might be much more complex – but we can simplify them to linear relationships.
Applications of linear programming are everywhere around you. You use linear programming at personal and professional fronts. You are using linear programming when you are driving from home to work and want to take the shortest route. Or when you have a project delivery you make strategies to make your team work efficiently for on-time delivery.
Example of a Linear Programming Problem (LPP)
Let’s say a FedEx delivery man has 6 packages to deliver in a day. The warehouse is located at point A. The 6 delivery destinations are given by U, V, W, X, Y, and Z. The numbers on the lines indicate the distance between the cities. To save on fuel and time the delivery person wants to take the shortest route.

So, the delivery person will calculate different routes for going to all the 6 destinations and then come up with the shortest route. This technique of choosing the shortest route is called linear programming.
In this case, the objective of the delivery person is to deliver the parcel on time at all 6 destinations. The process of choosing the best route is called Operation Research. Operation research is an approach to decision-making, which involves a set of methods to operate a system. In the above example, my system was the Delivery model.
Linear programming is used for obtaining the most optimal solution for a problem with given constraints. In linear programming, we formulate our real-life problem into a mathematical model. It involves an objective function, linear inequalities with subject to constraints.
Is the linear representation of the 6 points above representative of the real-world? Yes and No. It is an oversimplification as the real route would not be a straight line. It would likely have multiple turns, U-turns, signals and traffic jams. But with a simple assumption, we have reduced the complexity of the problem drastically and are creating a solution that should work in most scenarios.
Formulating a Problem
Let’s manufacture some chocolates… Example: Consider a chocolate manufacturing company that produces only two types of chocolate – A and B. Both the chocolates require Milk and Choco only. To manufacture each unit of A and B, the following quantities are required:
- Each unit of A requires 1 unit of Milk and 3 units of Choco
- Each unit of B requires 1 unit of Milk and 2 units of Choco
The company kitchen has a total of 5 units of Milk and 12 units of Choco. On each sale, the company makes a profit of
- Rs 6 per unit A sold
- Rs 5 per unit B sold.
Now, the company wishes to maximize its profit. How many units of A and B should it produce respectively?
Solution: The first thing I’m gonna do is represent the problem in a tabular form for better understanding.
Let the total number of units produced by A be = X
Let the total number of units produced by B be = Y
Now, the total profit is represented by Z
The total profit the company makes is given by the total number of units of A and B produced multiplied by its per-unit profit of Rs 6 and Rs 5 respectively.
Profit: Max Z = 6X+5Y
which means we have to maximize Z.
The company will try to produce as many units of A and B to maximize the profit. But the resources Milk and Choco are available in a limited amount.
As per the above table, each unit of A and B requires 1 unit of Milk. The total amount of Milk available is 5 units. To represent this mathematically,
Also, each unit of A and B requires 3 units & 2 units of Choco respectively. The total amount of Choco available is 12 units. To represent this mathematically,
Also, the values for units of A can only be integers.
So we have two more constraints, X ≥ 0 & Y ≥ 0
For the company to make maximum profit, the above inequalities have to be satisfied.
This is called formulating a real-world problem into a mathematical model.
Let us define some terminologies used in Linear Programming using the above example.
- Decision Variables: The decision variables are the variables that will decide my output. They represent my ultimate solution. To solve any problem, we first need to identify the decision variables. For the above example, the total number of units for A and B denoted by X & Y respectively are my decision variables.
- Objective Function: It is defined as the objective of making decisions. In the above example, the company wishes to increase the total profit represented by Z. So, profit is my objective function.
- Constraints: The constraints are the restrictions or limitations on the decision variables. They usually limit the value of the decision variables. In the above example, the limit on the availability of resources Milk and Choco are my constraints.
- Non-negativity Restriction: For all linear programs, the decision variables should always take non-negative values. This means the values for decision variables should be greater than or equal to 0.
The Process of Formulating a Linear Programming Problem
Let us look at the steps of defining a Linear Programming problem generically:
- Identify the decision variables
- Write the objective function
- Mention the constraints
- Explicitly state the non-negativity restriction
For a problem to be a linear programming problem, the decision variables, objective function and constraints all have to be linear functions.
If all the three conditions are satisfied, it is called a Linear Programming Problem .
A linear program can be solved by multiple methods. In this section, we are going to look at the Graphical method for solving a linear program. This method is used to solve a two-variable linear program. If you have only two decision variables, you should use the graphical method to find the optimal solution.
A graphical method involves formulating a set of linear inequalities subject to the constraints. Then the inequalities are plotted on an X-Y plane. Once we have plotted all the inequalities on a graph the intersecting region gives us a feasible region. The feasible region explains what all values our model can take. And it also gives us the best solution.
Let’s understand this with the help of an example.
Example: A farmer has recently acquired a 110 hectares piece of land. He has decided to grow Wheat and barley on that land. Due to the quality of the sun and the region’s excellent climate, the entire production of Wheat and Barley can be sold. He wants to know how to plant each variety in the 110 hectares, given the costs, net profits and labor requirements according to the data shown below:
The farmer has a budget of US$10,000 and availability of 1,200 man-days during the planning horizon. Find the optimal solution and the optimal value.
Solution: To solve this problem, first we gonna formulate our linear program.
Formulation of a Linear Problem
Step 1: Identify the decision variables
The total area for growing Wheat = X (in hectares)
The total area for growing Barley = Y (in hectares)
X and Y are my decision variables.
Step 2: Write the objective function
Since the production from the entire land can be sold in the market. The farmer would want to maximize the profit for his total produce. We are given net profit for both Wheat and Barley. The farmer earns a net profit of US$50 for each hectare of Wheat and US$120 for each Barley.
Our objective function (given by Z) is, Max Z = 50X + 120Y Step 3: Writing the constraints
1. It is given that the farmer has a total budget of US$10,000. The cost of producing Wheat and Barley per hectare is also given to us. We have an upper cap on the total cost spent by the farmer. So our equation becomes:
100X + 200Y ≤ 10,000
2. The next constraint is the upper cap on the availability of the total number of man-days for the planning horizon. The total number of man-days available is 1200. As per the table, we are given the man-days per hectare for Wheat and Barley.
10X + 30Y ≤ 1200
3. The third constraint is the total area present for plantation. The total available area is 110 hectares. So the equation becomes,
X + Y ≤ 110 Step 4: The non-negativity restriction
The values of X and Y will be greater than or equal to 0. This goes without saying.
X ≥ 0, Y ≥ 0
We have formulated our linear program. It’s time to solve it.
Solving an LP Through the Graphical Method
Since we know that X, Y ≥ 0. We will consider only the first quadrant.
To plot for the graph for the above equations, first I will simplify all the equations.
100X + 200Y ≤ 10,000 can be simplified to X + 2Y ≤ 100 by dividing by 100.
10X + 30Y ≤ 1200 can be simplified to X + 3Y ≤ 120 by dividing by 10.
The third equation is in its simplified form, X + Y ≤ 110.
Plot the first 2 lines on a graph in the first quadrant (like shown below)
The optimal feasible solution is achieved at the point of intersection where the budget & man-days constraints are active. This means the point at which the equations X + 2Y ≤ 100 and X + 3Y ≤ 120 intersect gives us the optimal solution.
The values for X and Y which gives the optimal solution is at (60,20).
To maximize profit the farmer should produce Wheat and Barley in 60 hectares and 20 hectares of land respectively.
The maximum profit the company will gain is,
Max Z = 50 * (60) + 120 * (20)
![the procedure employed to solve linear programming problem is Solving LP through graphical method [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/pic-566154.jpg)
R is an open-source tool that is very popular among the data scientists for essential data science tasks. Performing linear programming is very easy and we can attain an optimum solution in very few steps. Come let’s learn.
Example: A toy manufacturing organization manufactures two types of toys A and B. Both the toys are sold at Rs.25 and Rs.20 respectively. There are 2000 resource units available every day from which the toy A requires 20 units while toy B requires 12 units. Both of these toys require a production time of 5 minutes. Total working hours are 9 hours a day. What should be the manufacturing quantity for each of the pipes to maximize the profits?
The objective function is: Max.Z=25x+20y
where x are the units of pipe A
y are the units of pipe B
Constraints: 20x+12y<=2000
5x+5y<=540
Let’s see the code part now:
Therefore from the output, we see that the organization should produce 88 units of toy A and 20 units of toy B and the maximum profit for the organization will be Rs.2600.
In reality, a linear program can contain 30 to 1000 variables and solving it either Graphically or Algebraically is next to impossible. Companies generally use OpenSolver to tackle these real-world problems. Here I am gonna take you through steps to solve a linear program using OpenSolver.
OpenSolver is an open-source linear and optimizer for Microsoft Excel. It is an advanced version of a built-in Excel Solver. You can download OpenSolver here and follow the installation manual .
I want you to get hands-on knowledge of using OpenSolver. So, for a clear understanding, I will explain it using an example.
Example: Below there is a diet chart that gives me calories, protein, carbohydrate and fat content for 4 food items. Sara wants a diet with minimum cost. The diet chart is as follows:
The chart gives the nutrient content as well as the per-unit cost of each food item. The diet has to be planned in such a way that it should contain at least 500 calories, 6 grams of protein, 10 grams of carbohydrates and 8 grams of fat.
Solution: First, I’m gonna formulate my linear program in a spreadsheet.
- Step 1: Identify the decision variables. Here my decision variables are the food items. Add the headers. For trial purposes, we are entering arbitrary values. Let’s say, Sara consumes 3 units of Food Item 1, 0 unit of Food Item 2, 1 unit of Food Item 3 and 0 unit of Food Item 4. These are called variable cells.
![the procedure employed to solve linear programming problem is Identifying decision variables in OpenSolver [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/DP_124375.jpg)
- Step 2: Now we will write our objective function. For the diet to be optimal we must have minimum cost along with required calories, protein, carbohydrate, and fat.
![the procedure employed to solve linear programming problem is Objective function in OpenSolver [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/DP_2177062.jpg)
In cell B7:E7 we take the reference to the number of units. And in cell B8:E8 we put the per-unit cost of each food item.
In cell B10, we want the total cost of the diet. The total cost is given by the sumproduct of the number of units eaten and per-unit cost. Sumproduct is given by = B7*B8+C7*C8+D7*D8+E7*E8. Let’s see this in a spreadsheet.
![the procedure employed to solve linear programming problem is Solving LP with OpenSolver (Step 2) [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/DP_3135537.jpg)
- Step 3: Now, we will enter the constraints. Column F contains a total of calories, protein, carbohydrate, and fat. The total number of calorie intake in given by sumproduct the number of food items eaten and the calorie consumed per food item. For cell F13= Sumprodcut($B$7:$F$7, B13:F13). Similarly for others. Column G gives the inequality since the problem demands Calories, Protein, Carbohydrate and Fat to be at least 500, 6, 10 and 8 respectively. Column H gives the required nutrient content.
![the procedure employed to solve linear programming problem is Constraints in OpenSolver [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/DP_4172588.jpg)
- Step 4: Now, we will enter the Linear program into the solver. Now, once you have installed OpenSolver. When you click on the Data tab, on the right you will see Model. Click on the model, then enter the values one by one. First, we will enter the objective function,$B10 i.e in the objective cell. Select minimize because we want to minimize the diet cost.
![the procedure employed to solve linear programming problem is LP on OpenSolver [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/OS_184301.jpg)
- Step 5: Now enter the decision variables in the variable cells.
![the procedure employed to solve linear programming problem is Solving LP using OpenSolver [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/OS_274709.jpg)
- Step 6: Now, we will add the constraints. The first constraint is the F13 ≥ H13. Add all the constraints one by one.

- Step 7: Now, you have to enter one important constraint. The non-negativity restriction. All the decision variables will be greater than 0.

- Step 8: Now, click on Save Model to finish the modeling process. Once you save the model, it will look something like this.

- Step 9: Once the model is saved click on the Data tab then click solve. The optimal solution and values are displayed in the corresponding cells. The optimal minimum cost is US$0.90. Sara should consume 3 units of Food Item 2 and 1 unit of Food Item 3 for the required nutrient content at the minimum cost. This solves our linear program.

Simplex Method is one of the most powerful & popular methods for linear programming. The simplex method is an iterative procedure for getting the most feasible solution. In this method, we keep transforming the value of basic variables to get maximum value for the objective function.

. . . . . .
. . . . . .

. . . .

The above explanation gives the theoretical explanation of the simplex method. Now, I am gonna explain how to use the simplex method in real life using Excel.
Example: The advertising alternatives for a company include television, newspaper and radio advertisements. The cost for each medium with its audience coverage is given below.
The local newspaper limits the number of advertisements from a single company to ten. Moreover, in order to balance the advertising among the three types of media, no more than half of the total number of advertisements should occur on the radio. And at least 10% should occur on television. The weekly advertising budget is $18,200. How many advertisements should be run in each of the three types of media to maximize the total audience?
Solution: First I am going to formulate my problem for a clear understanding.
Step 1: Identify Decision Variables

Step 2: Objective Function
The objective of the company is to maximize the audience. The objective function is given by:

Now, I will mention each constraint one by one.
It is clearly given that we have a budget constraint. The total budget which can be allocated is $18,200. And the individual costs per television, newspaper and radio advertisement is $2000, $600 and $300 respectively. This can be represented by the equation,

The next constraint is the number of advertisements on television. The company wants at least 10% of the total advertisements to be on television. So, it can be represented as:

The last constraint is the number of advertisements on the radio cannot be more than half of the total number of advertisements. It can be represented as

Now, I have formulated my linear programming problem. We are using the simplex method to solve this. I will take you through the simplex method one by one.
To reiterate all the constraints are as follows. I have simplified the last two equations to bring them in standard form.

So our equations are as follows:

I hope now you are available to make sense of the entire advertising problem. All the above equations are only for your better understanding. Now if you solve these equations, you will get the values for X1= 4, X2= 10 and X3= 14.
On solving the objective function you will get the maximum weekly audience as 1,052,000. You can follow the tutorial here to solve the equation. To solve a linear program in excel, follow this tutorial .
Northwest Corner Method
The northwest corner method is a special type method used for transportation problems in linear programming. It is used to calculate the feasible solution for transporting commodities from one place to another. Whenever you are given a real-world problem, which involves supply and demand from one source of a different sources. The data model includes the following:
- The level of supply and demand at each source is given
- The unit transportation of a commodity from each source to each destination
The model assumes that there is only one commodity. The demand for which can come from different sources. The objective is to fulfill the total demand with minimum transportation cost. The model is based on the hypothesis that the total demand is equal to the total supply, i.e the model is balanced. Let’s understand this with the help of an example.
Example: Consider there are 3 silos which are required to satisfy the demand from 4 mills. (A silo is a storage area of the farm used to store grain and Mill is a grinding factory for grains).
![the procedure employed to solve linear programming problem is LP problem for Northwest Corner Method [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/SD128069.jpg)
Solution: Let’s understand what the above table explains.
The cost of transportation from Silo i to Mill j is given by the cost in each cell corresponding to the supply from each silo 1 and the demand at each Mill. For example, The cost of transporting from Silo 1 to Mill 1 is $10, from Silo 3 to Mill 5 is $18. It is also given the total demand & supply for mill and silos. The objective is to find the minimal transportation cost such that the demand for all the mills is satisfied.
As the name suggests Northwest corner method is a method of allocating the units starting from the top-left cell. The demand for Mill 1 is 5 and Silo 1 has a total supply of 15. So, 5 units can be allocated to Mill1 at a cost of $10 per unit. The demand for Mill1 is met. then we move to the top-left cell of Mill 2. The demand for Mill 2 is 15 units, which it can get 10 units from Silo 1 at a cost of $2 per unit and 5 units from Silo 2 at a cost of $7 per unit. Then we move onto Mill 3, the northwest cell is S2M3. The demand for Mill 3 is 15 units, which it can get from Silo 2 at a cost of $9 per unit. Moving on to the last Mill, Mill 4 has a demand of 15 units. It will get 5 units from a Silo 2 at a cost of $20 per unit and 10 units from Silo 3 at a cost of $18 per unit.
The total cost of transportation is = 5*10+(2*10+7*5)+9*15+(20*5+18*10) = $520
![the procedure employed to solve linear programming problem is LP solution by Northwest Corner Method [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-5154736.jpg)
Least Cost Method
Least Cost method is another method to calculate the most feasible solution for a linear programming problem. This method derives more accurate results than Northwest corner method. It is used for transportation and manufacturing problems. To keep it simple I am explaining the above transportation problem.
![the procedure employed to solve linear programming problem is Transportation LP problem [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-5388232.jpg)
According to the least cost method, you start from the cell containing the least unit cost for transportation. So, for the above problem, I supply 5 units from Silo 3 at a per-unit cost of $4. The demand for Mill1 is met. For Mill 2, we supply 15 units from Silo 1 at a per unit cost of $2. Then For Mill 3 we supply 15 units from Silo 2 at a per-unit cost of $9. Then for Mill 4 we supply 10 units from Silo 2 at a per unit cost of $20 and 5 units from Silo 3 an $18 per unit. The total transportation costs are $475.
Well, the above method explains we can optimize our costs further with the best method. Let’s check this using Excel Solver. Solver is an in-built add-on in Microsoft Excel. It’s an add-in plug available in Excel. Go to file->options->add-ins->select solver->click on manage->select solver->click Ok. Your solver is now added in excel. You can check it under the Data tab.
The first thing I am gonna do is enter my data in excel. After entering the data in excel, I have calculated the total of C3:F3. Similarly for others. This is done to take the total demand from Silo 1 and others.
![the procedure employed to solve linear programming problem is Demand-supply table for the LP problem [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-457786.jpg)
After this, I am gonna break my model into two. The first table gives me the units supplied and the second table gives me the unit cost.
![the procedure employed to solve linear programming problem is Cost table for LP problem [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-4645019.jpg)
Now, I am calculating my total cost which will be given by Sumproduct of unit cost and units supplied.
![the procedure employed to solve linear programming problem is Calculation of total cost for LP problem [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-4754548.jpg)
Now I am gonna use Solver to compute my model. Similar to the above method. Add the objective function, variable cells, constraints.
![the procedure employed to solve linear programming problem is Variable cells, objective function, and constraints of the LPP [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-48171589.jpg)
Now your model is ready to be solved. Click on solve and you will get your optimal cost. The minimum transportation cost is $435.
![the procedure employed to solve linear programming problem is Using LP to find minimum cost [Linear programming problem]](https://av-eks-blogoptimized.s3.amazonaws.com/image-5028050.jpg)
Linear programming and Optimization are used in various industries. The manufacturing and service industry uses linear programming on a regular basis. In this section, we are going to look at the various applications of Linear programming.
- Manufacturing industries use linear programming for analyzing their supply chain operations . Their motive is to maximize efficiency with minimum operation cost. As per the recommendations from the linear programming model, the manufacturer can reconfigure their storage layout, adjust their workforce and reduce the bottlenecks. Here is a small Warehouse case study of Cequent a US-based company, watch this video for a more clear understanding.
- Linear programming is also used in organized retail for shelf space optimization . Since the number of products in the market has increased in leaps and bounds, it is important to understand what does the customer want. Optimization is aggressively used in stores like Walmart, Hypercity, Reliance, Big Bazaar, etc. The products in the store are placed strategically keeping in mind the customer shopping pattern. The objective is to make it easy for a customer to locate & select the right products. This is subject to constraints like limited shelf space, a variety of products, etc.
- Optimization is also used for optimizing Delivery Routes . This is an extension of the popular traveling salesman problem. The service industry uses optimization for finding the best route for multiple salesmen traveling to multiple cities. With the help of clustering and greedy algorithm, the delivery routes are decided by companies like FedEx, Amazon, etc. The objective is to minimize the operation cost and time.
- Optimizations are also used in Machine Learning . Supervised Learning works on the fundamental of linear programming. A system is trained to fit on a mathematical model of a function from the labeled input data that can predict values from an unknown test data.
Well, the applications of Linear programming don’t end here. There are many more applications of linear programming in real-world like applied by Shareholders, Sports, Stock Markets, etc. Go on and explore further.
I hope you enjoyed reading this article. I have tried to explain all the basic concepts under linear programming. If you have any doubts or questions feel free to post them in the comments section. For easy understanding, we have broken this long article into a shorter course format – Linear Programming for Data Science Professionals
I have explained each concept with a real-life example. I want you to try them at your end and get hands-on experience. Let me know what you think!
Frequently Asked Questions
Q1. what is linear programming and why is it important.
A. Linear programming is an optimization technique used to optimize a linear objective function, subject to linear constraints represented by linear equations or linear constraints. It’s a mathematical technique to help find the best possible solution to a problem that has multiple objectives and limited resources.
Q2. What is a linear programming problem in simple words?
A. Linear programming problem is an optimization problem where the goal is to find the maximum or the minimum value within a number of constraints(such as available resources or limitations) depending upon the type of problem we are solving.
Q3. What is an objective function in LPP (linear programming problem)?
A. An objective function is a linear equation that represents the relationship between the decision variables and the value that is to be optimized. Every optimizing technique such as Linear programming or integer programming has an objective function that needs to be minimized/maximized in order to produce the best results. In LPP, the objective function is used along with the constraints to determine the optimal solution to the problem.
Learn , compete, hack and get hired !

About the Author
Avcontentteam, our top authors.

Download Analytics Vidhya App for the Latest blog/Article
27 thoughts on " what is linear programming definition, methods and problems for data scientists ".
kumar says: February 28, 2017 at 5:43 am
Swati Kashyap says: February 28, 2017 at 5:50 am
Arun says: February 28, 2017 at 6:29 am
Swati kashyap says: february 28, 2017 at 6:33 am.
Dima says: February 28, 2017 at 7:40 am
Bipul says: February 28, 2017 at 8:21 am
JB says: February 28, 2017 at 11:21 am
Swati kashyap says: february 28, 2017 at 11:27 am, swati kashyap says: february 28, 2017 at 11:41 am.
Geeta Shah says: February 28, 2017 at 1:32 pm
Abhishek Kulkarni says: February 28, 2017 at 2:43 pm
Anil Muduli says: March 02, 2017 at 7:54 am
Abhinandan Nuli says: March 02, 2017 at 2:35 pm
Anantha Sreenivas says: March 03, 2017 at 11:08 am
Rahul Ravipati says: March 08, 2017 at 4:34 am
Amit says: March 10, 2017 at 3:46 am
Swati kashyap says: march 10, 2017 at 7:47 am, amit says: march 10, 2017 at 7:52 am, swati kashyap says: march 10, 2017 at 7:59 am.
Noor Mohamed M says: July 25, 2017 at 4:11 pm
Aviroop says: March 30, 2018 at 10:30 am
Satnam says: April 01, 2018 at 9:19 pm
SHUBHAM KSHIRSAGAR says: May 03, 2018 at 4:34 pm
Thrishul says: May 17, 2018 at 7:53 pm

Dai Software says: September 10, 2021 at 2:07 pm
Aman says: October 06, 2022 at 8:04 am
Neba Brenda Asoh says: October 13, 2022 at 4:10 pm
Leave a reply your email address will not be published. required fields are marked *.
Notify me of follow-up comments by email.
Notify me of new posts by email.
Top Resources

How to Read and Write With CSV Files in Python:..

Understand Random Forest Algorithms With Examples (Updated 2023)

Understanding & Interpreting Confusion Matrices for Machine Learning (Updated 2023)

An Introduction to Large Language Models (LLMs)
Welcome to India's Largest Data Science Community
Back welcome back :), don't have an account yet register here, back start your journey here, already have an account login here.
A verification link has been sent to your email id
If you have not recieved the link please goto Sign Up page again
back Please enter the OTP that is sent to your registered email id
Back please enter the otp that is sent to your email id, back please enter your registered email id.
This email id is not registered with us. Please enter your registered email id.
back Please enter the OTP that is sent your registered email id
Please create the new password here, privacy overview.

- Entertainment & Pop Culture
- Geography & Travel
- Health & Medicine
- Lifestyles & Social Issues
- Philosophy & Religion
- Politics, Law & Government
- Sports & Recreation
- Visual Arts
- World History
- On This Day in History
- Biographies
- Top Questions
- Week In Review
- Infographics
- Demystified
- Image Galleries
- One Good Fact
- Britannica Explains In these videos, Britannica explains a variety of topics and answers frequently asked questions.
- Britannica Classics Check out these retro videos from Encyclopedia Britannica’s archives.
- #WTFact Videos In #WTFact Britannica shares some of the most bizarre facts we can find.
- This Time in History In these videos, find out what happened this month (or any month!) in history.
- Demystified Videos In Demystified, Britannica has all the answers to your burning questions.
- Student Portal Britannica is the ultimate student resource for key school subjects like history, government, literature, and more.
- COVID-19 Portal While this global health crisis continues to evolve, it can be useful to look to past pandemics to better understand how to respond today.
- 100 Women Britannica celebrates the centennial of the Nineteenth Amendment, highlighting suffragists and history-making politicians.
- Britannica Beyond We’ve created a new place where questions are at the center of learning. Go ahead. Ask. We won’t mind.
- Saving Earth Britannica Presents Earth’s To-Do List for the 21st Century. Learn about the major environmental problems facing our planet and what can be done about them!
- SpaceNext50 Britannica presents SpaceNext50, From the race to the Moon to space stewardship, we explore a wide range of subjects that feed our curiosity about space!
- Introduction
- Facts & Related Content
- More Articles On This Topic
- Contributors
- Article History
linear programming
Our editors will review what you’ve submitted and determine whether to revise the article.
- Mathematics LibreTexts Library - Linear Programming - The Simplex Method
- Story of Mathematics - Linear Programming – Explanation and Examples
- Wolfram MathWorld - Linear Programming
linear programming , mathematical modeling technique in which a linear function is maximized or minimized when subjected to various constraints . This technique has been useful for guiding quantitative decisions in business planning, in industrial engineering , and—to a lesser extent—in the social and physical sciences .

The a ’s, b ’s, and c ’s are constants determined by the capacities, needs, costs, profits, and other requirements and restrictions of the problem. The basic assumption in the application of this method is that the various relationships between demand and availability are linear; that is, none of the x i is raised to a power other than 1. In order to obtain the solution to this problem, it is necessary to find the solution of the system of linear inequalities (that is, the set of n values of the variables x i that simultaneously satisfies all the inequalities). The objective function is then evaluated by substituting the values of the x i in the equation that defines f .
Applications of the method of linear programming were first seriously attempted in the late 1930s by the Soviet mathematician Leonid Kantorovich and by the American economist Wassily Leontief in the areas of manufacturing schedules and of economics , respectively, but their work was ignored for decades. During World War II , linear programming was used extensively to deal with transportation, scheduling, and allocation of resources subject to certain restrictions such as costs and availability. These applications did much to establish the acceptability of this method, which gained further impetus in 1947 with the introduction of the American mathematician George Dantzig’s simplex method , which greatly simplified the solution of linear programming problems.
However, as increasingly more complex problems involving more variables were attempted, the number of necessary operations expanded exponentially and exceeded the computational capacity of even the most powerful computers . Then, in 1979, the Russian mathematician Leonid Khachiyan discovered a polynomial-time algorithm —in which the number of computational steps grows as a power of the number of variables rather than exponentially—thereby allowing the solution of hitherto inaccessible problems. However, Khachiyan’s algorithm (called the ellipsoid method) was slower than the simplex method when practically applied. In 1984 Indian mathematician Narendra Karmarkar discovered another polynomial-time algorithm, the interior point method, that proved competitive with the simplex method.
Linear Programming
Linear programming is a process that is used to determine the best outcome of a linear function. It is the best method to perform linear optimization by making a few simple assumptions. The linear function is known as the objective function. Real-world relationships can be extremely complicated. However, linear programming can be used to depict such relationships, thus, making it easier to analyze them.
Linear programming is used in many industries such as energy, telecommunication, transportation, and manufacturing. This article sheds light on the various aspects of linear programming such as the definition, formula, methods to solve problems using this technique, and associated linear programming examples.
What is Linear Programming?
Linear programming, also abbreviated as LP, is a simple method that is used to depict complicated real-world relationships by using a linear function . The elements in the mathematical model so obtained have a linear relationship with each other. Linear programming is used to perform linear optimization so as to achieve the best outcome.
Linear Programming Definition
Linear programming can be defined as a technique that is used for optimizing a linear function in order to reach the best outcome. This linear function or objective function consists of linear equality and inequality constraints. We obtain the best outcome by minimizing or maximizing the objective function .
Linear Programming Examples
Suppose a postman has to deliver 6 letters in a day from the post office (located at A) to different houses (U, V, W, Y, Z). The distance between the houses is indicated on the lines as given in the image. If the postman wants to find the shortest route that will enable him to deliver the letters as well as save on fuel then it becomes a linear programming problem. Thus, LP will be used to get the optimal solution which will be the shortest route in this example.

Linear Programming Formula
A linear programming problem will consist of decision variables , an objective function, constraints, and non-negative restrictions. The decision variables, x, and y, decide the output of the LP problem and represent the final solution. The objective function, Z, is the linear function that needs to be optimized (maximized or minimized) to get the solution. The constraints are the restrictions that are imposed on the decision variables to limit their value. The decision variables must always have a non-negative value which is given by the non-negative restrictions. The general formula of a linear programming problem is given below:
- Objective Function: Z = ax + by
- Constraints: cx + dy ≤ e, fx + gy ≤ h. The inequalities can also be "≥"
- Non-negative restrictions: x ≥ 0, y ≥ 0
How to Solve Linear Programming Problems?
The most important part of solving linear programming problem is to first formulate the problem using the given data. The steps to solve linear programming problems are given below:
- Step 1: Identify the decision variables.
- Step 2: Formulate the objective function. Check whether the function needs to be minimized or maximized.
- Step 3: Write down the constraints.
- Step 4: Ensure that the decision variables are greater than or equal to 0. (Non-negative restraint)
- Step 5: Solve the linear programming problem using either the simplex or graphical method.
Let us study about these methods in detail in the following sections.
Linear Programming Methods
There are two main methods available for solving linear programming problem. These are the simplex method and the graphical method. Given below are the steps to solve a linear programming problem using both methods.
Linear Programming by Simplex Method
The simplex method in lpp can be applied to problems with two or more decision variables. Suppose the objective function Z = 40\(x_{1}\) + 30\(x_{2}\) needs to be maximized and the constraints are given as follows:
\(x_{1}\) + \(x_{2}\) ≤ 12
2\(x_{1}\) + \(x_{2}\) ≤ 16
\(x_{1}\) ≥ 0, \(x_{2}\) ≥ 0
Step 1: Add another variable, known as the slack variable, to convert the inequalities into equations. Also, rewrite the objective function as an equation .
- 40\(x_{1}\) - 30\(x_{2}\) + Z = 0
\(x_{1}\) + \(x_{2}\) + \(y_{1}\) =12
2\(x_{1}\) + \(x_{2}\) + \(y_{2}\) =16
\(y_{1}\) and \(y_{2}\) are the slack variables.
Step 2: Construct the initial simplex matrix as follows:
\(\begin{bmatrix} x_{1} & x_{2} &y_{1} & y_{2} & Z & \\ 1&1 &1 &0 &0 &12 \\ 2& 1 & 0& 1 & 0 & 16 \\ -40&-30&0&0&1&0 \end{bmatrix}\)
Step 3: Identify the column with the highest negative entry. This is called the pivot column. As -40 is the highest negative entry, thus, column 1 will be the pivot column.
Step 4: Divide the entries in the rightmost column by the entries in the pivot column. We exclude the entries in the bottom-most row.
12 / 1 = 12
The row containing the smallest quotient is identified to get the pivot row. As 8 is the smaller quotient as compared to 12 thus, row 2 becomes the pivot row. The intersection of the pivot row and the pivot column gives the pivot element.
Thus, pivot element = 2.
Step 5: With the help of the pivot element perform pivoting, using matrix properties , to make all other entries in the pivot column 0.
Using the elementary operations divide row 2 by 2 (\(R_{2}\) / 2)
\(\begin{bmatrix} x_{1} & x_{2} &y_{1} & y_{2} & Z & \\ 1&1 &1 &0 &0 &12 \\ 1& 1/2 & 0& 1/2 & 0 & 8 \\ -40&-30&0&0&1&0 \end{bmatrix}\)
Now apply \(R_{1}\) = \(R_{1}\) - \(R_{2}\)
\(\begin{bmatrix} x_{1} & x_{2} &y_{1} & y_{2} & Z & \\ 0&1/2 &1 &-1/2 &0 &4 \\ 1& 1/2 & 0& 1/2 & 0 & 8 \\ -40&-30&0&0&1&0 \end{bmatrix}\)
Finally \(R_{3}\) = \(R_{3}\) + 40\(R_{2}\) to get the required matrix.
\(\begin{bmatrix} x_{1} & x_{2} &y_{1} & y_{2} & Z & \\ 0&1/2 &1 &-1/2 &0 &4 \\ 1& 1/2 & 0& 1/2 & 0 & 8 \\ 0&-10&0&20&1&320 \end{bmatrix}\)
Step 6: Check if the bottom-most row has negative entries. If no, then the optimal solution has been determined. If yes, then go back to step 3 and repeat the process. -10 is a negative entry in the matrix thus, the process needs to be repeated. We get the following matrix.
\(\begin{bmatrix} x_{1} & x_{2} &y_{1} & y_{2} & Z & \\ 0&1 &2 &-1 &0 &8 \\ 1& 0 & -1& 1 & 0 & 4 \\ 0&0&20&10&1&400 \end{bmatrix}\)
Writing the bottom row in the form of an equation we get Z = 400 - 20\(y_{1}\) - 10\(y_{2}\). Thus, 400 is the highest value that Z can achieve when both \(y_{1}\) and \(y_{2}\) are 0.
Also, when \(x_{1}\) = 4 and \(x_{2}\) = 8 then value of Z = 400
Thus, \(x_{1}\) = 4 and \(x_{2}\) = 8 are the optimal points and the solution to our linear programming problem.
Linear Programming by Graphical Method
If there are two decision variables in a linear programming problem then the graphical method can be used to solve such a problem easily.
Suppose we have to maximize Z = 2x + 5y.
The constraints are x + 4y ≤ 24, 3x + y ≤ 21 and x + y ≤ 9
where, x ≥ 0 and y ≥ 0.
To solve this problem using the graphical method the steps are as follows.
Step 1: Write all inequality constraints in the form of equations.
x + 4y = 24
3x + y = 21
Step 2: Plot these lines on a graph by identifying test points.
x + 4y = 24 is a line passing through (0, 6) and (24, 0). [By substituting x = 0 the point (0, 6) is obtained. Similarly, when y = 0 the point (24, 0) is determined.]
3x + y = 21 passes through (0, 21) and (7, 0).
x + y = 9 passes through (9, 0) and (0, 9).
Step 3: Identify the feasible region. The feasible region can be defined as the area that is bounded by a set of coordinates that can satisfy some particular system of inequalities.
Any point that lies on or below the line x + 4y = 24 will satisfy the constraint x + 4y ≤ 24.
Similarly, a point that lies on or below 3x + y = 21 satisfies 3x + y ≤ 21.
Also, a point lying on or below the line x + y = 9 satisfies x + y ≤ 9.
The feasible region is represented by OABCD as it satisfies all the above-mentioned three restrictions.
Step 4: Determine the coordinates of the corner points. The corner points are the vertices of the feasible region.
B = (6, 3). B is the intersection of the two lines 3x + y = 21 and x + y = 9. Thus, by substituting y = 9 - x in 3x + y = 21 we can determine the point of intersection.
C = (4, 5) formed by the intersection of x + 4y = 24 and x + y = 9

Step 5: Substitute each corner point in the objective function. The point that gives the greatest (maximizing) or smallest (minimizing) value of the objective function will be the optimal point.
33 is the maximum value of Z and it occurs at C. Thus, the solution is x = 4 and y = 5.
Applications of Linear Programming
Linear programming is used in several real-world applications. It is used as the basis for creating mathematical models to denote real-world relationships. Some applications of LP are listed below:
- Manufacturing companies make widespread use of linear programming to plan and schedule production.
- Delivery services use linear programming to decide the shortest route in order to minimize time and fuel consumption.
- Financial institutions use linear programming to determine the portfolio of financial products that can be offered to clients.
Related Articles:
- Introduction to Graphing
- Linear Equations in Two Variables
- Solutions of a Linear Equation
- Mathematical Induction
Important Notes on Linear Programming
- Linear programming is a technique that is used to determine the optimal solution of a linear objective function.
- The simplex method in lpp and the graphical method can be used to solve a linear programming problem.
- In a linear programming problem, the variables will always be greater than or equal to 0.

As the minimum value of Z is 127, thus, B (3, 28) gives the optimal solution. Answer: The minimum value of Z is 127 and the optimal solution is (3, 28)

- Example 3: Using the simplex method in lpp solve the linear programming problem Minimize Z = \(x_{1}\) + 2\(x_{2}\) + 3\(x_{3}\) \(x_{1}\) + \(x_{2}\) + \(x_{3}\) ≤ 12 2\(x_{1}\) + \(x_{2}\) + 3\(x_{3}\) ≤ 18 \(x_{1}\), \(x_{2}\), \(x_{3}\) ≥ 0 Solution: Convert all inequalities to equations by introducing slack variables. -\(x_{1}\) - 2\(x_{2}\) - 3\(x_{3}\) + Z = 0 \(x_{1}\) + \(x_{2}\) + \(x_{3}\) + \(y_{1}\) = 12 2\(x_{1}\) + \(x_{2}\) + 3\(x_{3}\) + \(y_{2}\) = 18 Expressing this as a matrix we get, \(\begin{bmatrix} x_{1} & x_{2} & x_{3} & y_{1} & y_{2} & Z & \\ 1 & 1 & 1 & 1 & 0 & 0 & 12\\ 2 & 1 & 3 & 0 & 1 & 0 & 18\\ -1 & -2 & -3 & 0 & 0 & 1 & 0 \end{bmatrix}\) As -3 is the greatest negative value thus, column 3 is the pivot column. 12 / 1 = 12 18 / 3 = 6 As 6 is the smaller quotient thus, row 2 is the pivot row and 3 is the pivot element. By applying matrix operations we get, \(\begin{bmatrix} x_{1} & x_{2} & x_{3} & y_{1} & y_{2} & Z & \\ 0.33 & 0.667 & 0 & 1 & -0.33 & 0 & 6\\ 0.667 & 0.33 & 1 & 0 & 0.33 & 0 & 6\\ 1 & -1 & 0 & 0 & 1 & 1 & 18 \end{bmatrix}\) Now -1 needs to be eliminated. Thus, by repreating the steps the matrix so obtained is as follows \(\begin{bmatrix} x_{1} & x_{2} & x_{3} & y_{1} & y_{2} & Z & \\ 0.5 & 1 & 0 & 1.5 & 0.5 & 0 & 9\\ 0.5 & 0 & 1 & -0.5 & 0.5 & 0 & 3\\ 1.5 & 0 & 0 & 1.5 & 0.5 & 1 & 27 \end{bmatrix}\) We get the maximum value of Z = 27 at \(x_{1}\) = 0, \(x_{2}\) = 9 \(x_{3}\) = 3 Answer: Maximum value of Z = 27 and optimal solution (0, 9, 3)
go to slide go to slide go to slide

Book a Free Trial Class
Practice Questions on Linear Programming
go to slide go to slide
FAQs on Linear Programming
What is meant by linear programming.
Linear programming is a technique that is used to identify the optimal solution of a function wherein the elements have a linear relationship.
What is Linear Programming Formula?
The general formula for a linear programming problem is given as follows:
What is the Objective Function in Linear Programming Problems?
The objective function is the linear function that needs to be maximized or minimized and is subject to certain constraints. It is of the form Z = ax + by.
How to Formulate a Linear Programming Model?
The steps to formulate a linear programming model are given as follows:
- Identify the decision variables.
- Formulate the objective function.
- Identify the constraints.
- Solve the obtained model using the simplex or the graphical method.
How to Find Optimal Solution in Linear Programming?
We can find the optimal solution in a linear programming problem by using either the simplex method or the graphical method. The simplex method in lpp can be applied to problems with two or more variables while the graphical method can be applied to problems containing 2 variables only.
How to Find Feasible Region in Linear Programming?
To find the feasible region in a linear programming problem the steps are as follows:
- Draw the straight lines of the linear inequalities of the constraints.
- Use the "≤" and "≥" signs to denote the feasible region of each constraint.
- The region common to all constraints will be the feasible region for the linear programming problem.
What are Linear Programming Uses?
Linear programming is widely used in many industries such as delivery services, transportation industries, manufacturing companies, and financial institutions. The linear program is solved through linear optimization method, and it is used to determine the best outcome in a given scenerio.
What Is Linear Programming? Meaning, Methods, and Examples
Linear programming helps determine how to arrive at the most optimized situation given a set of resource constraints.
Linear programming is defined as a technique in algebra that uses linear equations to figure out how to arrive at the optimal situation (maximum or minimum) as an answer to a mathematical problem, assuming the finiteness of resources and the quantifiable nature of the end optimization goal. This article explains how linear programming works with examples.
Table of Contents
What is linear programming, linear programming methods, examples of linear programming.
Linear programming is a technique in algebra that uses linear equations to determine how to arrive at the optimal situation (maximum or minimum) as an answer to a mathematical problem, assuming the finiteness of resources and the quantifiable nature of the end optimization goal.
Linear programming (LP) uses many linear inequalities pertaining to a given scenario to determine the “optimal” value one can obtain under those constraints. A classic example would be calculating the “optimal” production levels to maximize profits, given the restrictions of supplies and personnel.
In the “real world,” linear programming is an essential subfield of mathematics known as optimization methods. This area of research (or at least its applicable findings) is used in resource allocation and management. These “real-world” systems may have dozens or even hundreds of variables. In algebra, however, you will only see the basic (and graphable) linear example with two variables.
Graphing the inequalities (called “constraints”) to construct a walled-off zone on the x,y plane is the typical method for solving linear programming problems (known as “feasibility region”). Then, you determine the dimensions of the extremities of this feasible zone (i.e., the intersection locations of the different pairs of lines) and evaluate these vertices in the equation (termed “optimization equation”) in which you’re attempting to get the maximum or minimum value.
Linear programming (LP) is among the most straightforward optimization techniques. It simplifies specific, complicated linear programming and optimization issues to help you reach a solution. Data analysts will always encounter applications and challenges requiring linear programming solutions.
Linear programming formula
A linear programming issue includes choice parameters, a nonlinear objective, constraints, and nonnegative limitations. The outcome of the LP model is determined by the choice variables x and y, which also reflect the ultimate answer.
Z is the function that must be optimized (maximized or minimized) to arrive at an answer. The constrictions are the limits placed on the variables to limit their values. According to the non-negative limitations, the variables must always possess a non-negative value.
The linear programming formula may be regarded as follows:
- The function of the formula: ax + by = Z
- The formula’s operating limitations: cx + dy ≤ e and fx + gy ≤ h
- Other, non-negative restrictions: x ≥ 0, y ≥ 0
You need to know a few terms to understand the meaning of linear programming. First come the decision variables. These elements fight for limited resources, including products, services, etc. They are referred to as decision variables if they are connected with a linear connection capable of determining the most optimal option.
The next component would be the objective function. The challenge must have had a quantitatively measurable aim, such as maximizing profit, reducing costs, etc. These constraints also apply to the available resources, such as limited equipment, people, materials, etc. Some constraints are observably existent but do not hamper the process of the studied issue; they are referred to as redundant constraints.
A viable solution is the collection of all potential solutions that fulfill the constants in the format of variables. In addition, an optimum value is the best possible solution that effectively supports the problem’s aim.
The most crucial step in addressing a linear programming issue is formulating it using the provided data. The following are the steps for solving linear programming problems:
- Determine the choice factors
- Develop the objective function
- Determine whether the function should be decreased or maximized
- Record the limitations
- Verify that decision variables are either larger than or equal to 0. (Non-negative inhibition)
- Utilize either the simplex or graphical method to resolve the linear programming issue
See More: Top Five Free Cloud Platforms to Learn Kubernetes Online
Why is linear programming necessary?
We all encounter several target-based scenarios daily. Suppose a student has 15 days to finish an assignment, or a salesperson has one month to reach their sales quota, while another individual gets $600 to spend on an electronic device.
Let’s imagine that the student’s purpose for this endeavor is to get the highest possible grade. The salesman would strive for the highest possible monthly sales total. The purchaser of a device would want to decrease the price as much as feasible. They would attempt to purchase a device within their budget. The purpose of each situation described above is to maximize the benefits or reduce costs. Such issues are optimization challenges that may be resolved by linear programming.
An optimization issue in mathematics may include maximizing profit, minimizing costs, or minimizing resource use. We have previously described the aims of the three presented circumstances; we can now examine their respective limiting considerations. What does it imply?
In every instance, resources are scarce. In the first scenario, the deadline for completing the assignment is tight. Similarly, in example two, the individual must sell the greatest amount of things within a given time frame. In the third scenario, the individual must purchase the device within a defined budget; hence, the quantity of money is the restricting element. The lack of available resources hinders the search for optimal solutions to the presented challenges.
One cannot use the typical calculus and marginal analysis techniques in these circumstances. Calculus approaches can only handle precisely equal constraints, a limitation that linear programming does not have.
Numerous real-world applications make use of linear programming. It serves as the foundation for mathematical models that represent real-world connections. To organize and schedule production, manufacturing businesses employ linear programming extensively. To decrease travel time and fuel consumption, delivery services employ linear programming to determine the shortest route. Financial institutions establish the spectrum of investment instruments that may be supplied to customers using linear programming.
Linear programming delivers vital insights into business challenges by facilitating the identification of the ideal solution in each given circumstance.
Traits of a linear programming task
A problem being solved through linear programming will have the following traits or characteristics:
- Subject to constraints : Regarding the resource, one should represent the restrictions in mathematical form.
- Geared towards an objective function : The objective function of an issue should be described quantitatively.
- A linear relationship : The function’s connection across two or more independent variables must be linear. It indicates that the variable’s degree is one.
- Includes only finite numbers : There should be output and input numbers that are both finite and infinite. The optimum solution is not implementable if the function contains an unlimited number of elements.
- Does not include negative values : The variable’s value must be zero or positive. The value should not be negative.
- Hinges on decision variables : The result is determined by the decision variable. It provides the final solution to the issue. The first step in solving any issue is to determine the decision factors.
See More: What Is COBOL Programming Language? Definition, Examples, Uses, and Challenges
There are several approaches to solving linear programming problems. The four most important approaches are:
1. The simplex method
The simplex method is a typical methodology for tackling optimization problems in linear programming. Typically, it consists of a function and some restrictions written as inequalities. The inequality defines a polygonal area, with the solution often located at a vertex. This approach is a method for systematically examining the vertices as potential solutions.
The technique approaches and finally achieves the maximum or lowest value of the goal function via an iterative procedure. In addition, the strategy aids the decision-maker in identifying duplicate restrictions, a complete solution, several alternatives, and an infeasible issue, thereby providing a thorough grasp of the business situation.
A twin problem accompanies every linear programming issue. One may easily derive the answer to this issue using the simplex approach from resolving the initial problem.
George Dantzig created the simplex technique for linear programming. Dantzig developed planning systems for the United States Air Defense during World War II using a desk calculator. In 1946, a coworker challenged him to automate the planning procedure to prevent him from accepting another position. Dantzig defined the issue as linear inequalities, although he did not include an aim in his formulation at the time. Without a goal, a wide variety of plausible options exist. Therefore, military-specific “ground rules” should be applied to identify the best possible alternative.
Dantzig’s key realization was that most such ground rules might be expressed as a linear function of objectives that must be maximized.
2. Solving linear programming problems using R
Linear programming is an excellent tool for decision-making optimization. Several R programs, such as the lpSolve R package, enable the solution of linear programming difficulties. lpSolve is an R extension that allows links to a C-based framework for linear programming problem-solving. With only a few bits of open-source code, you may get statistically significant information (sensitivity analysis).
Whereas other free optimization solutions are available, having a linear programming R code in one’s individual code repository may save a considerable amount of time by eliminating the need to start writing the formula from scratch and requiring only the modification of the coefficients and signs of the respective matrices. This is helpful since R is regularly used for data science and statistical analysis.
3. Graphical linear programming
The technique of resolving a linear equation system by generating a graph is often referred to as the graphical method. The same holds true for linear programming issues.
Using graphical approaches, it is simple to solve any optimization programming issue with just two variables. These variables may be referred to as x1 and x2, and most of the analysis can be performed on a two-dimensional graph using these variables. The graphical approach for solving linear programming employs the extreme or corner points method and the iso-profit (cost) efficiency line method.
The iso-cost or iso-profit approach identifies the point combination that yields the same costs/profits as any other point combinations on the same line. This is accomplished by drawing parallel lines to the gradient of the equation.
4. Linear programming using OpenSolver
OpenSolver is a tool designed to solve models of linear and integer programming. OpenSolver is an Excel VBA add-on that expands the capabilities of Excel’s built-in Solver. Andrew Mason developed and updated it with students at the University of Auckland’s Engineering Science department. In addition, it permits you to resolve linear and mixed-integer optimization methods in Google Sheets without arbitrary size restrictions.
It’s important to note that almost all linear programming and mixed-integer linear programming libraries that are widely used are authored in Fortran, C, or C++ and are native to those languages. This is because linear programming requires a lot of work with (often sizable) matrices, which is hard to do in a language like Python . This kind of library is called a solver.
5. Mixed-integer linear programming
Linear programming can be made even more robust with mixed-integer linear programming. It can solve problems in which at least one variable has a discrete integer value instead of a continuous value. At first glance, mixed-integer problems look like continuous variable problems, but they are much better in flexibility and accuracy.
Integer variables are essential for accurately representing numbers expressed with integers, like the number of airplanes made or the number of customers served. The binary variable is a type of integer variable that is very important. It can only have the values 0 or 1 and helps make yes-or-no decisions, like whether or not to build a plant or turn on a machine. You can also use them to imitate logical constraints.
See More: Pivoting From Coder to Solution Architect: Four Skills and Certifications to Thrive
The Linear Programming Problem (LPP) involves finding the best value of a given linear function. The ideal value may either be the largest or smallest one. Here, the linear function provided is regarded as an objective function. The objective function may include several variables dependent on the situation and must fulfill the linear constraints, a collection of linear inequalities. One may utilize linear programming issues to determine the ideal solution for manufacturing, diet, transportation, and allocation problems, among others.
Listed below are a few illustrations of the kind of issues commonly addressed by linear programming techniques:
Example 1: Optimizing dietary needs and cost constraints
A doctor wants to combine two food kinds such that the mixture’s vitamin content includes a minimum of 8 elements of vitamin A and ten elements of vitamin C. Food ‘I’ includes 2 vitamin A units per kilogram and 1 vitamin C unit per kilogram. Food ‘II’ has 1 vitamin A unit per kilogram and 2 vitamin C units per kilogram. Food ‘I’ is priced at $5 per kilogram, whereas Food ‘II’ costs $7 per kilogram. To minimize the price of such a combination, this may be expressed as a problem of linear programming.
Example 2: Optimizing food ingredients and food volume
One type of cake calls for 200g of flour and 25g of fat, but another one calls for 100g of flour and 50g of fat. This issue may be expressed as a linear programming problem to determine the highest proportion of cake that can be baked using 5kg of wheat and 1kg of fat. It also implies that there are sufficient quantities of the other cake-making components.
Example 3: Optimizing goods transportation costs
Consider a manufacturing business with two plants in cities F1 & F2 and three retail outlets in cities C1, C2, or C3. Monthly demand at retail locations is 8, 5, and 2 units, whereas monthly supply at manufacturers is 6 and 9, accordingly. Notice that the entire supply and demand are equal. We are also provided with the cost of transporting one unit from manufacturing to retail outlets. This linear programming challenge aims to estimate the amount that must be shipped from each manufacturer to each retail area to satisfy demand at the lowest possible total shipping cost.
Example 4: Optimizing product sales to arrive at maximum profit
A bakery produces two types of cookies: chocolate chip and caramel. The bakery anticipates daily demand for a minimum of 80 caramelized & 120 chocolate chip cookies. Due to a lack of raw materials and labor, the bakery can produce 120 caramel cookies and 140 chocolate chip cookies daily. For the bakery to be viable, it must sell a minimum of 240 cookies each day. Every chocolate chip cookie served generates $0.75 in profit, whereas each caramel biscuit generates $0.88. The solution to the number of chocolate chip and caramel cookies that the bakery must produce each day to maximize profit may be determined using linear programming.
See More: Cobol Programmer: Job Description, Key Skills, and Salary in 2022
Linear programming, like decision trees and fuzzy logic , is essential for computing algorithms. It states that, given a set of fixed resource constraints, an optimal or best solution exists. This has myriad applications in cognitive technologies such as AI or machine learning , which try and apply mathematical formulae and statistical models to real-world problems.
Did this article adequately explain how linear programming works? Tell us on Facebook Opens a new window , Twitter Opens a new window , and LinkedIn Opens a new window . We’d love to hear from you!
MORE ON IT STRATEGY
- What Is Unified Communication? Definition, System, Cloud Service, Best Practices, and Examples
- 10 Best Practices for Disaster Recovery Planning (DRP)
- Top 10 SIEM Solutions in 2022
- What is Gamification? Definition, Software, Examples, and Best Practices 2022
- Scrum vs. DevOps: Understanding the Key Differences
Share This Article:
Technical Writer

Recommended Reads

How Decision Intelligence Brings Unparalleled Value to Businesses

Automation & Zero-touch IT: The Keys to Optimizing SaaS

Human Error Doesn’t Have To Be A Single Point of Failure

Five Common API Integration Issues and How to Avoid Them

Making it Work: 7 Ways to Build Business-Technology Alignment

Four Ways TSPs Can Ease the Pain of a Disrupted Supply Chain

- Mathematicians
- Math Lessons
- Square Roots
- Math Calculators

- Linear Programming – Explanation & Examples
What is Linear Programming?
Identifying variables, identify the objective function, the solution, example 1 solution, example 2 solution, example 3 solution, example 4 solution, example 5 solution, practice questions, linear programming – explanation and examples.

Linear programming is one specific type of mathematical optimization, which has applications in many scientific fields. Though there are ways to solve these problems using matrices, this section will focus on geometric solutions.
Linear programming relies heavily on a solid understanding of systems of linear inequalities . Make sure you review that section before moving forward with this one.
In particular, this topic will explain:
How to Solve Linear Programming Problems
Linear programming is a way of solving problems involving two variables with certain constraints. Usually, linear programming problems will ask us to find the minimum or maximum of a certain output dependent on the two variables.
Linear programming problems are almost always word problems. This method of solving problems has applications in business, supply-chain management, hospitality, cooking, farming, and crafting among others.
Typically, solving linear programming problems requires us to use a word problem to derive several linear inequalities. We can then use these linear inequalities to find an extreme value (either a minimum or a maximum) by graphing them on the coordinate plane and analyzing the vertices of the resulting polygonal figure.
Solving linear programming problems is not difficult as long as you have a solid foundational knowledge of how to solve problems involving systems of linear inequalities. Depending on the number of constraints, however, the process can be a bit time-consuming.
The main steps are:
- Identify the variables and the constraints.
- Find the objective function.
- Graph the constraints and identify the vertices of the polygon.
- Test the values of the vertices in the objective function.
These problems are essentially complex word problems relating to linear inequalities. The most classic example of a linear programming problem is related to a company that must allocate its time and money to creating two different products. The products require different amounts of time and money, which are typically restricted resources, and they sell for different prices. In this case, the ultimate question is “how can this company maximize its profit?”
As stated above, the first step to solving linear programming problems is finding the variables in the word problem and identifying the constraints. In any type of word problem, the easiest way to do this is to start listing things that are known.
To find the variables, look at the last sentence of the problem. Typically, it will ask how many __ and __… use whatever is in these two blanks as the x and y values. It usually does not matter which is which, but it is important to keep the two values straight and not mix them up.
Then, list everything known about these variables. Usually, there will be a lower bound on each variable. If one is not given, it is probably 0. For example, factories cannot make -1 product.
Usually there is some relationship between the products and limited resources like time and money. There may also be a relationship between the two products, such as the number of one product being greater than another or the total number of products being greater than or less than a certain number. Constraints are almost always inequalities.
This will become clearer in context with the example problems.
The objective function is the function we want to maximize or minimize. It will depend on the two variables and, unlike the constraints, is a function, not an inequality.
We will come back to the objective function, but, for now, it is important to just identify it.
At this point, we need to graph the inequalities. Since it is easiest to graph functions in slope-intercept form, we may need to convert the inequalities to this before graphing.
Remember that the constraints are connected by a mathematical “and,” meaning we need to shade the region where all of the inequalities are true. This usually creates a closed polygon, which we call “the feasible region.”
That is, the area inside the polygon contains all possible solutions to the problem.
Our goal, however, is not to find just any solution. We want to find the maximum or minimum value. That is, we want the best solution.
Fortunately, the best solution will actually be one of the vertices of the polygon! We can use the graph and/or the equations of the bounds of the polygon to find these vertices.
We can find the best solution plugging each of the x and y-values from the vertices into the objective function and analyzing the result. We then can pick the maximum or minimum output, depending on what we are looking for.
We must also double check that the answer makes sense. For example, it does not make sense to create 0.5 products. If we get an answer that is a decimal or fraction and this does not make sense in context, we can analyze a nearby whole number point. We have to make sure that this point is still greater than/less than the other vertices before declaring it to be the maximum/minimum.
This all may seem a bit confusing. Since linear programming problems are nearly always word problems, they make more sense when context is added.
In this section, we will add context and practice problems relating to linear programming. This section also includes step-by-step solutions.
Consider the geometric region shown in the graph.

- What are the inequalities that define this function?
- If the objective function is 3x+2y=P, what is the maximum value of P?
- If the objective function is 3x+2y=P, what is the minimum value of P
This figure is bounded by three different lines. The easiest one to identify is the vertical line on the right side. This is the line x=5. Since the shaded region is to the left of this line, the inequality is x ≤ 5.
Next, let’s find the equation of the lower bound. This line crosses the y-axis at (0, 4). It also has a point at (2, 3). Therefore, its slope is (4-3/0-2)= -1 / 2 . Therefore, the equation of the line is y=- 1 / 2 x+4. Since the shading is above this line, the inequality is y ≥- 1 / 2 x+4.
Now, let’s consider the upper bound. This line also crosses the y-axis at (0, 4). It has another point at (4, 3). Therefore, its slope is (3-4)/(4-0)= -1 / 4 . Thus, its equation is y=- 1 / 4 x+4. Since the shaded region is below this line, the inequality is y ≤ – 1 / 4 x+4.
In summary, our system of linear inequalities is x ≤ 5 and y ≥ – 1 / 2 x+4 and y ≤ – 1 / 4 x+4.
Now, we are given an objective function P=3x+2y to maximize. That is, we want to find values x and y in the shaded region so that we can maximize P. The key thing to note is that an extrema of the function P will be at the vertices of the shaded figure.
The easiest way to find this is to test the vertices. There are ways to find this using matrices, but they will be covered in greater depth in later modules. They also work better for problems with significantly many more vertices. Since there are only three in this problem, this is not too complicated.
We already know one of the vertices, the y-intercept, which is (0, 4). The other two are intersections of the two lines with x=5. Therefore, we just need to plug x=5 into both equations.
We then get y=- 1 / 2 (5)+4=- 5 / 2 +4=1.5 and y=- 1 / 4 (5)+4=2.75. Thus, our other two vertices are (5, 1.5) and (5, 2.75).
Now, we plug all three pairs of x and y-values into the objective function to get the following outputs.
(0, 4): P=0+2(4)=8.
(5, 1.5): P=3(5)+2(1.5)=18
(5, 2.75): P=3(5)+2(2.75)=20.5.
Therefore, the function P has a maximum at the point (5, 2.75).
We actually did most of the work for part C in part B. Finding the minimum of a function is not very different than finding the maximum. We still find all of the vertices and then test all of them in the objective function. Now, however, we just select the output with the smallest value.
Looking at part B, we see that this happens at the point (0, 4), with an output of 8.
A company creates square boxes and triangular boxes. Square boxes take 2 minutes to make and sell for a profit of $4. Triangular boxes take 3 minutes to make and sell for a profit of $5. Their client wants at least 25 boxes and at least 5 of each type ready in one hour. What is the best combination of square and triangular boxes to make so that the company makes the most profit from this client?
The first step in any word problem is defining what we know and what we want to find out. In this case, we know about the production of two different products which are dependent upon time. Each of these products also makes a profit. Our goal is to find the best combination of square and triangular boxes so that the company makes the most profit.
Constraints
First, let’s write down all of the inequalities we know. We can do this by considering the problem line by line.
The first line tells us that we have two kinds of boxes, square ones and triangular ones. The second tells us some information about the square boxes, namely that they take two minutes to make and net $4 profit.
At this point, we should define some variables. Let’s let x be the number of square boxes and y be the number of triangular boxes. These variables are both dependent upon each other because time spent making one is time that could be spent making the other. Make a note of this so that you do not mix them up.
Now, we know that the amount of time spent making a square box is 2x.
Now, we can do the same with the number of triangular boxes, y. We know that each triangular box requires 3 minutes and nets $5. Therefore, we can say that the amount of time spent making a triangular box is 3y.
We also know that there is a limit on the total time, namely 60 minutes. Thus, we know that the time spent making both types of boxes must be less than 60, so we can define the inequality 2x+3y ≤ 60.
We also know that both x and y must be greater than or equal to 5 because the client has specified wanting at least 5 of each.
Finally, we know that the client wants at least 25 boxes. This gives us another relationship between the number of square and triangular boxes, namely x+y ≥ 25.
Thus, overall, we have the following constraints:
These constraints function line the boundaries in the graphical region from example 1.
The Objective Function
Our objective, or goal, is to find the greatest profit. Therefore, our objective function should define the profit.
In this case, profit depends on the number of square boxes created and the number of triangular boxes created. Specifically, this company’s profit is P=4x+5y.
Note that this function is a line, not an inequality. In particular, it looks like a line written in standard form.
Now, to maximize this function, we need to find the graphical region represented by our constraints. Then, we need to test the vertices of this region in the function P.
Now, let’s consider the graph of this function. We can first graph each of our inequalities. Then, remembering that linear programming problem constraints are connected by a mathematical “and,” we will shade the region that is a solution to all four inequalities. This graph is shown below.

This problem has three vertices. The first is the point (15, 10). The second is the point (20, 5). The third is the point (22.5, 5).
Let’s plug all three values into the profit function and see what happens.
(15, 10): P=4(15)+5(10)=60+50=110.
(20, 5): P=4(20)+5(5)=105.
(22.5, 5): P=4(22.5)+5(5)=90+25=115.
This suggests that the maximum is 115 at 22.5 and 5. But, in context, this means that the company must make 22.5 square boxes. Since it cannot do that, we have to round down to the nearest whole number and see if this is still the maximum.
At (22, 5), P=4(22)+5(5)=88+25=113.
This is still greater than the other two outputs. Therefore, the company should make 22 square boxes and 5 triangular boxes to satisfy the client’s demands and maximize its own profit.
A woman makes craft jewelry to sell at a seasonal craft show. She makes pins and earrings. Each pin takes her 1 hour to make and sells for a profit of $8. The pairs of earrings take 2 hours to make, but she gets a profit of $20. She likes to have variety, so she wants to have at least as many pins as pairs of earrings. She also knows that she has approximately 40 hours for creating jewelry between now and the start of the show. She also knows that the craft show vender wants sellers to have more than 20 items on display at the beginning of the show. Assuming she sells all of her inventory, how many each of pins and earring pairs should the woman make to maximize her profit?
This problem is similar to the one above, but it has some additional constraints. We will solve it in the same way.
Let’s begin by identifying the constraints. To do this, we should first define some variables. Let x be the number of pins the woman makes, and let y be the number of pairs of earrings she makes.
We know that the woman has 40 hours to create the pins and earrings. Since they take 1 hour and 2 hours respectively, we can identify the constraint x+2y ≤ 40.
The woman also has constraints on the number of products she will make. Specifically, her vender wants her to have more than 20 items. Thus, we know that x+y>20. Since, however, she cannot make part of an earring on pin, we can adjust this inequality to x+y ≥ 21.
Finally, the woman has her own constraints on her products. She wants to have at least as many pins as pairs of earrings. This means that x ≥ y.
In addition, we have to remember that we cannot have negative numbers of products. Therefore, x and y are both positive too.
Thus, in summary, our constraints are:
The woman wants to know how she can maximize her profits. We know that the pins give her a profit of $8, and earrings earn her $20. Since she expects to sell all of the jewelry she makes, the woman will make a profit of P=8x+20y. We want to find the maximum of this function.
Now, we need to graph all of the constraints and then find the region where they all overlap. It helps to first put them all in slope-intercept form. In this case, then, we have
y ≤ – 1 / 2 x+20
This gives us the graph below.

Unlike the previous two examples, this function has 4 vertices. We will have to identify and test all four of them.
Note that these vertices are intersections of two lines. To find their intersection, we can set the two lines equal to each other and solve for x.
We’ll move from left to right. The far left vertex is the intersection of the lines y=x and y=-x+21. Setting the two equal gives us:
Therefore x= 21 / 2 , 0r 10.5 When x=10.5, the function y=x also is 10.5. Thus, the vertex is (10.5, 10.5).
The next vertex is the intersection of the lines y=x and y=- 1 / 2 x+20. Setting these equal gives us:
X=- 1 / 2 x+20
3 / 2 x=20.
Therefore, x= 40 / 3 , which is about 13.33. Since this is also on the line y=x, the point is ( 40 / 3 , 40 / 3 ).
The last two points lie on the x-axis. The first is the x-intercept of y=-x+21, which is the solution of 0=-x+21. This is the point (21, 0). The second is the x-intercept of y=- 1 / 2 x+20. That is the point where we have 0=- 1 / 2 x+20. This means that -20=- 1 / 2 x, or x=40. Thus, the intercept is (40, 0).
Therefore, our four vertices are (10.5, 10.5), ( 40 / 3 , 40 / 3 ), (21, 0), and (40, 0).
Finding the Maximum
Now, we test all four points in the function P=8x+20y.
(10.5, 10.5)=294
( 40 / 3 , 40 / 3 )=1120/3 (or about 373.33)
(0, 21)=168
(0, 40)=320.
Now, the maximum in this case is the point ( 40 / 3 , 40 / 3 ). However, the woman cannot make 40 / 3 pins or 40 / 3 pairs of earrings. We can adjust by finding the nearest whole number coordinate that is inside the region and testing it. In this case, we have (13, 13) or (14, 13). We will choose the latter since it will obviously yield a larger profit.
Then, we have:
P=14(8)+13(20)=372.
Thus, the woman should make 14 pins and 13 pairs of earrings for the greatest profit given her other constraints.
Joshua is planning a bake sale to raise funds for his class field trip. He needs to make at least $100 to meet his goal, but it is okay if he goes above that. He plans to sell muffins and cookies by the dozen. The dozen muffins will sell for a profit of $6, and the dozen cookies will sell for a profit of $10. Based on sales from the previous year, he wants to make at least 8 more bags of cookies than bags of muffins.
The cookies require 1 cup of sugar and 3 / 4 cups of flour per dozen. The muffins require 1 / 2 cup of sugar and 3 / 2 cups of flour per dozen. Joshua looks into his cabinet and finds that he has 13 cups of sugar and 11 cups of flour, but he does not plan to go get more from the store. He also knows that he can only bake one pan of a dozen muffins or one pan of a dozen cookies at a time. What is the fewest number of pans of muffins and cookies Joshua can make and still expect to meet his financial goals if he sells all of his product?
As before, we will have to identify our variables, find our constraints, identify the objective function, graph the system of constraints, and then test the vertices in the objective function to find a solution.
Joshua wants to know how the minimum number of pans of muffins and cookies to bake. Thus, let’s let x be the number of pans of muffins and y be the number of pans of cookies. Since each pan makes one dozen baked goods and Joshua sells the baked goods by the bag of one dozen, let’s ignore the number of individual muffins and cookies so as not to confuse ourselves. We can instead focus on the number of bags/pans.
First, Joshua needs to make at least $100 to meet his goal. He earns $6 by selling a pan of muffins and $10 by selling a pan of cookies. Therefore, we have the constraint 6x+10y ≥ 100.
Joshua also has a limitation based on his flour and sugar supplies. He has 13 total cups of sugar, but a dozen muffins calls for 1 / 2 cup and a dozen cookies calls for 1 cup. Thus, he has the constraint 1 / 2 x+1y ≤ 13.
Likewise, since a dozen muffins requires 3 / 2 cups of flour and a dozen cookies requires 3 / 4 cups of flour, we have the inequality 3 / 2 x+ 3 / 4 y ≤ 11.
Finally, Joshua cannot make fewer than 0 pans of either muffins or cookies. Thus, x and y are both greater than 0. He also wants to make at least 8 more pans of cookies than muffins. Therefore, we also have the inequality y-x ≥ 10
Therefore, our system of linear inequalities is:
6x+10y ≥ 100
1 / 2 x+y ≤ 13
3 / 2 x+ 3 / 4 y ≤ 11
Remember, the objective function is the function that defines the thing we want to minimize or maximize. In the previous two examples, we wanted to find the greatest profit. In this case, however, Joshua wants a minimum number of pans. Thus, we want to minimize the function P=x+y.
In this case, we are finding the overlap of 6 different functions!
Again, it is helpful to turn our constraint inequalities into y-intercept form so they are easier to graph. We get:
y ≥ 3 / 5 x+10
y ≤ – 1 / 2 x+13
When we create the polygonal shaded region, we find that it has 5 vertices, as shown below.

The Vertices
Now, we need to consider all 5 vertices and test them in the original function.
We have two vertices on the y-axis, which come from the lines y=- 3 / 5 x+10 and y=- 1 / 2 x+13. Clearly, these two y-intercepts are (0, 10) and (0, 13).
The next intersection, moving from left to right is the intersection of the lines y=- 1 / 2 x+13 and y=-2x+ 44 / 3 . Setting these two functions equal gives us:
– 1 / 2 x+13=-2x+ 44 / 3 .
Moving the x values to the left and the numbers without a coefficient to the right gives us
3 / 2 x= 5 / 3 .
x= 10 / 9 .
When x= 10 / 9 , we have y=-2( 10 / 9 )+44/3=- 20 / 9 + 132 / 9 = 112 / 9 , which has the decimal approximation 12.4. Thus, this is the point ( 10 / 9 , 112 / 9 ) or about (1.1, 12.4).
The next vertex is the intersection of the lines y=- 3 / 5 x+10 and y=x+8. Setting these equal, we have:
– 3 / 5 x+10=x+8
– 8 / 5 x=-2.
Solving for x then gives us 5 / 4 . At 5 / 4 , the function y=x+8 is equal to 37/4, which is 9.25. Therefore, the point is ( 5 / 4 , 37 / 4 ) or (1.25, 9.25) in decimal form.
Finally, the last vertex is the intersection of y=x+8 and y=-2x+ 44 / 3 . Setting these equal to find the x-value of the vertex, we have:
X+8=-2x+ 44 / 3 .
Putting the x-values on the left and numbers without a coefficient on the right gives us
3x= 20 / 3 .
Thus, solving for x gives us 20 / 9 (which is about 2.2). When we plug this number back into the equation y=x+8, we get y= 20 / 9 + 72 / 9 = 92 / 9 . This is approximately 10.2. Therefore, the last vertex is at the point ( 20 / 9 , 92 / 9 ), which is about (2.2, 10.2).
Finding the Minimum
Now, we want to find the minimum value of the objective function, P=x+y. That is, we want to find the fewest number of pans of muffins and cookies Joshua has to make while still satisfying all the other constraints.
To do this, we have to test all five vertices: (0, 13), (0, 10), ( 10 / 9 , 112 / 9 ), ( 5 / 4 , 37 / 4 ), ( 20 / 9 , 92 / 9 )
(0, 13): 0+13=13.
(0, 10): 0+10=10.
( 10 / 9 , 112 / 9 ): 10 / 9 + 112 / 9 = 112 / 9 , which is about 13.5.
( 5 / 4 , 37 / 4 ): 5 / 4 + 37 / 4 , which is 42 / 4 =10.5.
( 20 / 9 , 92 / 9 ): 20 / 9 + 92 / 9 = 112 / 9 . This is about 12.4.
Therefore, it seems Joshua’s best bet is to make 0 muffins and 10 cookies. This probably makes the baking simple anyway!
If, however, he wanted to make as many products as possible, (that is, if he wanted the maximum instead of the minimum), he would want to make 10 / 9 muffins and 112 / 9 cookies. This is not possible, so we would have to find the nearest whole number of cookies and muffins. The point (1, 12) is inside the shaded region, as is (0, 13). Either of these combinations would be the maximum.
It is possible to have shaded regions with even more vertices. For example, if Joshua wanted a minimum number of bags of muffins or a maximum number of bags of cookies, we would have another constraint. If he wanted a minimum number of total bags of baked goods, we would have another constraint. Additionally, we could develop more constraints based on the number of ingredients. Things like eggs, butter, chocolate chips, or salt could work in this context. In some cases, a solution could become so complex so as not to have any feasible answers. For example, it is possible that the region not include any solutions where both x and y are whole numbers.
Amy is a college student who works two jobs on campus. She must work for at least 5 hours per week at the library and two hours per week as a tutor, but she is not allowed to work more than 20 hours per week total. Amy gets $15 per hour at the library and $20 per hour at tutoring. She prefers working at the library though, so she wants to have at least as many library hours as tutoring hours. If Amy needs to make 360 dollars, what is the minimum number of hours she can work at each job this week to meet her goals and preferences?
As with the other examples, we need to identify the constraints before we can plot our feasible region and test the vertices.
Since Amy is wondering how many hours to work at each job, let’s let x bet the number of hours at the library and y the number of hours at tutoring.
Then, we know x ≥ 5 and y ≥ 2.
Her total number of hours, however, cannot be more than 20. Therefore, x+y ≤ 20.
Since she wants to have at least as many library hours as tutoring hours, she wants x ≥ y.
Each hour at the library earns her $15, so she gets 15x. Likewise, from tutoring, she earns 20y. Thus, her total is 15x+20y, and she needs this to be more than 360. Therefore, 15x+20y ≥ 360.
In sum, then Amy’s constraints are
15x+20y ≥ 360
The total number of hours that Amy works is the function P=x+y. We want to find the minimum of this function inside the feasible region.
The Feasible Region
To graph the feasible region, we need to first convert all of the constraints to slope-intercept form. In this case, we have:
y ≥- 3 / 4 x+18.
This graph looks like the one below.

Yes. This graph is blank because there is no overlap between all of these regions. This means that there is no solution.
Alternative Solution?
Perhaps Amy can persuade herself to get rid of the requirement that she work fewer hours at tutoring than at the library. What is the fewest number of hours she can work at tutoring and still meet her financial goals?
Now, her constraints are just x ≥ 5, y ≥ 2, y ≤ -x+20, and y ≥ – 3 / 4 x+18.
Then, we end up with this region.

In this case, the objective function is just minimizing the number of hours Amy works at tutoring, namely Therefore, P=y, and we can see from looking at the region that the point (8, 12) has the lowest y-value. Therefore, if Amy wants to meet her financial goals but work as few hours as possible at tutoring, she has to work 12 hours at tutoring and 8 hours at the library.

Previous Lesson | Main Page | Next Lesson

IMAGES
VIDEO
COMMENTS
The linear programming problem can be solved using different methods, such as the graphical method, simplex method, or by using tools such as R
Step 1 - Identify the decision variables · Step 2 - Write the objective function · Step 3 - Identify Set of Constraints · Step 4 - Choose the method for solving
Linear programming (LP) is one of the simplest ways to perform optimization. It helps you solve some very complex LP problems and linear
simplex method, standard technique in linear programming for solving an optimization problem, typically one involving a function and several constraints
Linear programming (LP), also called linear optimization, is a method to achieve the best outcome in a mathematical model whose requirements are represented
The steps to solve linear programming problems are given below: Step 1: Identify the decision variables. Step 2: Formulate the objective function. Check whether
Linear programming is a technique in algebra that uses linear equations to determine how to arrive at the optimal situation (maximum or minimum)
Linear programming is a way of solving problems involving two variables with certain constraints. Usually, linear programming problems will ask us to find the
This precalculus video tutorial provides a basic introduction into linear programming. It explains how to write the objective function and
First, the method is robust. It solves any linear program; it detects redundant constraints in the problem formulation; it identifies instances when the