Blog

Linear Programming Word Problems: Variables and Constraints

Turn linear programming word problems into clear models with decision variables, objective functions, constraints, worked examples, and practice answers.

  • 12th
Copper threads become an orderly grid in an ivory loom, with an amber bead at a corner enclosed by brass rails

You read a question about a workshop, a food mixture, or an advertising budget. The story makes sense. Then you reach the instruction, “Formulate a linear programming problem,” and suddenly every number seems to belong everywhere.

Should the selling price go into the objective? Does “at least” mean greater than or less than? Is the available time an equation or an inequality?

The way through is to give each part of the story a job. Variables describe the choices, the objective measures the result, and constraints describe the limits or requirements. Once those jobs are clear, the algebra becomes much easier to organise.

This guide focuses on the step before drawing the graph: building the right model. We will use original examples, translate awkward phrases, and check that our inequalities say what we intended.

What does it mean to formulate an LPP?

An LPP is a linear programming problem. To formulate one, you express a planning situation using a linear objective function and linear restrictions on decision variables. In the two-variable problems studied here, the objective usually has the form Z = ax + by, with fixed coefficients. This terminology follows the NCERT chapter on linear programming.

A complete formulation tells the reader:

  1. What x and y represent, including their units.
  2. What quantity must be maximised or minimised.
  3. Which conditions every acceptable choice must satisfy.
  4. Whether negative or fractional values are allowed.

For example, Maximise P = 70x + 90y is only an objective. It is not a complete model until we know what x and y mean and what restricts them.

If your answer is “profit,” you may have the objective. If it is “cloth used,” you probably have the left-hand side of a resource constraint.

Step 1: Choose variables for decisions you can make

Suppose a studio makes tote bags and cushion covers. The decision is how many of each to produce.

Write:

  • Let x be the number of tote bags produced per day.
  • Let y be the number of cushion covers produced per day.

Avoid writing only “Let x be bags.” A variable represents a quantity, not the object itself.

The time period matters too. Daily production must be compared with daily resource availability. If the question gives weekly capacity, either define weekly quantities or convert the capacity consistently.

Choose the unit before collecting coefficients

If x means kilograms of a mixture, use cost per kilogram. If it means 100-gram portions, use cost per portion.

Suppose an ingredient costs Rs 80 per kilogram. Its cost contribution is:

  • 80x when x is measured in kilograms;
  • 8x when x is the number of 100-gram portions.

Both are valid. Mixing the first definition with the second coefficient is not.

Step 2: Separate the target from the restrictions

Ask what the decision-maker wants to achieve.

The question wantsTypical objective
Greatest total profitMaximise profit
Cheapest acceptable mixtureMinimise cost
Largest total outputMaximise quantity
Least total processing timeMinimise time

Now ask which conditions must be respected while pursuing that target. Money available, machine hours, minimum orders, storage, and composition requirements usually become constraints.

The same kind of quantity can play different roles in different questions. Cost can be the objective in a cheapest-mixture problem, but a constraint in a profit problem with a fixed budget.

Profit and revenue are different

If a product sells for Rs 150 and its stated variable cost is Rs 95, the contribution per unit is 150 - 95 = Rs 55. When the question asks to maximise profit and there are no other varying costs, use that difference rather than the selling price.

Suppose a second product contributes Rs 40 per unit, and x and y denote the quantities of these two products. If a fixed cost of Rs 600 applies to every possible production plan, actual profit is 55x + 40y - 600. Maximising 55x + 40y chooses the same plan, but the final profit must still subtract Rs 600.

This shortcut works only for a cost that is constant across all choices. A charge incurred only when a particular product is made needs additional modelling; do not quietly treat it as constant.

Step 3: Translate one sentence at a time

For the following table, let x and y be quantities of two products, and let R be the total resource used.

Words in the questionTranslation
At most 60 units in totalx + y <= 60
At least 60 units in totalx + y >= 60
Exactly 60 units in totalx + y = 60
Resource use cannot exceed 120R <= 120
No fewer than 15 units of Ax >= 15
A cannot exceed Bx <= y
A must be at least twice Bx >= 2y

Here, <= means less than or equal to, and >= means greater than or equal to.

A resource being available does not mean that all of it must be used. “Up to 120 hours are available” gives an upper bound. Write an equality only if the story requires exact use.

Also, the instruction “maximise” does not determine the signs of the constraints. A profit-maximisation problem can include minimum orders, maximum capacities, and exact commitments together.

Check the sign with a simple example

If at least 60 units are required, a plan producing 70 should pass and a plan producing 50 should fail. The inequality x + y >= 60 does exactly that.

If your inequality rejects the obviously acceptable plan, revisit the wording before doing any graph work.

Worked example 1: Production with two scarce resources

A studio produces tote bags and cushion covers. Each tote bag needs 2 metres of fabric and 1 hour of stitching. Each cushion cover needs 1 metre of fabric and 2 hours of stitching. Each day, at most 100 metres of fabric and 80 stitching hours are available. Profit is Rs 70 per tote bag and Rs 90 per cushion cover. Assume everything produced can be sold.

Formulate a model to maximise daily profit.

Define the decisions

Let x be tote bags produced per day and y be cushion covers produced per day.

Make a small resource table before writing inequalities:

ItemFabric in metresStitching hours
One tote bag21
One cushion cover12
Daily availability10080

Read a resource column downward. Fabric used by all bags is 2x; fabric used by all covers is y. Therefore:

2x + y <= 100

Likewise, stitching time gives:

x + 2y <= 80

Daily profit is:

P = 70x + 90y

The complete continuous LPP is:

Maximise P = 70x + 90y
subject to:
2x + y <= 100
x + 2y <= 80
x >= 0, y >= 0

Because finished items are counted, a literal production plan also needs whole-number quantities. We first consider the usual continuous model; in this example its optimum is already whole-numbered.

A short solution check

The feasible corner points are (0, 0), (50, 0), (40, 20), and (0, 40).

Plan (x, y)Daily profit
(0, 0)Rs 0
(50, 0)Rs 3,500
(40, 20)Rs 4,600
(0, 40)Rs 3,600

The best plan is 40 tote bags and 20 cushion covers per day. It uses 2(40) + 20 = 100 metres of fabric and 40 + 2(20) = 80 stitching hours.

Notice why choosing only the item with higher profit per unit fails. Cushion covers earn more each, but they also use more stitching time. The best combination depends on both resources.

For the drawing and corner-selection steps, see the companion guide to feasible regions and corner points.

Worked example 2: Minimum requirements and minimum cost

A fictional laboratory feed mixture uses ingredients A and B. One kilogram of A supplies 3 units of nutrient M and 1 unit of nutrient N. One kilogram of B supplies 1 unit of M and 2 units of N. The batch needs at least 18 units of M and at least 16 units of N. A costs Rs 40 per kilogram and B costs Rs 30 per kilogram. Fractional kilograms are allowed.

These invented nutrient units are for a mathematics exercise, not a feeding recommendation.

Let x and y be kilograms of A and B in the batch.

The target is low cost:

Minimise C = 40x + 30y

The requirements give:

3x + y >= 18
x + 2y >= 16
x >= 0, y >= 0

Both nutrient constraints use >= because extra nutrient units are allowed in this stated model. An upper safety limit would need another constraint if the question supplied one.

The boundary lines meet where:

3x + y = 18
x + 2y = 16

6x + 2y = 36
5x = 20
x = 4, y = 6

The relevant corner costs are Rs 540 at (0, 18), Rs 340 at (4, 6), and Rs 640 at (16, 0).

We can verify the minimum without relying only on a corner table. Rewrite cost as:

C = 10(3x + y) + 10(x + 2y)

Every feasible mixture therefore has cost at least 10(18) + 10(16) = Rs 340. The mixture (4, 6) reaches that bound, so it is optimal.

Worked example 3: Percentages refer to a whole

A shop blends two fictional tea ingredients. Let x be kilograms of premium tea and y kilograms of standard tea. It must prepare exactly 50 kilograms. Premium tea must make up at least 30% of the blend. Premium tea costs Rs 400 per kilogram and standard tea costs Rs 250 per kilogram.

The total quantity condition is:

x + y = 50

The composition condition is:

x >= 0.30(x + y)

The expression in brackets is essential: 30% of the whole blend means 30% of x + y.

Rearranging gives 0.70x >= 0.30y, or 7x >= 3y. Since the total is fixed at 50 kilograms, we can also write x >= 15.

The model is:

Minimise C = 400x + 250y
subject to:
x + y = 50
7x >= 3y
x >= 0, y >= 0

Substituting y = 50 - x gives C = 12500 + 150x. Cost rises as the amount of premium tea increases, so choose the smallest allowed x: 15 kilograms. Then y = 35 and cost is Rs 14,750.

Why x >= 0.30y is wrong here

That would mean premium tea is at least 30% of the standard tea, not 30% of the total. For example, x = 12 and y = 38 satisfies 12 >= 0.30(38), but premium tea is only 24% of the 50-kilogram blend.

A single numerical counterexample can reveal a translation error faster than a page of algebra.

Worked example 4: Convert units before writing the limit

A print shop produces standard and illustrated booklets. Each standard booklet takes 6 printing minutes and each illustrated booklet takes 10 printing minutes. At most 5 printing hours are available per day. There is an order for at least 12 illustrated booklets, and finishing capacity is at most 40 booklets altogether. Profit is Rs 20 per standard booklet and Rs 35 per illustrated booklet.

Let x and y be the respective daily quantities.

Five hours is 300 minutes, so the model is:

Maximise P = 20x + 35y
subject to:
6x + 10y <= 300
x + y <= 40
y >= 12
x >= 0, y >= 0

Writing 6x + 10y <= 5 would compare minutes with hours. Writing 6x + 10y = 300 would unnecessarily require every minute to be used.

Check the proposed plan (20, 12): it uses 240 minutes, produces 32 booklets, and meets the minimum order. It is feasible, although feasibility alone does not prove it is best.

Here (0, 30) is optimal, earning Rs 1,050. To check this, profit per printing minute is at most Rs 3.50 for either product, so total profit cannot exceed 3.50(300) = Rs 1,050. Thirty illustrated booklets attain that bound and satisfy the other conditions.

Tricky phrases worth slowing down for

”A is at least 10 more than B”

Write x >= y + 10, or x - y >= 10.

Do not write x + y >= 10. That describes a minimum combined quantity and says nothing about the difference.

”A is no more than twice B”

Write x <= 2y. Check the direction with y = 5: at most 10 units of A are allowed.

”At least one of the two products must be made”

If quantities are whole numbers, x + y >= 1 expresses this. For continuous quantities, “some positive production” is a strict condition and needs more care. Use a stated minimum output where one is provided; do not invent one.

”Either use machine A or machine B”

An either-or choice is not automatically represented by requiring both conditions at once. Such decisions may need binary variables and a more advanced model. Ordinary school formulations usually describe restrictions that all apply together.

”The products are in the ratio 2:3”

If positive total production is intended, the ratio gives 3x = 2y. Combine it with the stated output requirement. The equation alone also allows (0, 0), where a ratio is not defined.

What makes the model linear?

In the models above, the contribution per unit stays fixed. Doubling the quantity doubles that product’s contribution to cost, profit, or resource use. Contributions from the two products add together.

Expressions such as 4x + 7y, x - 2y, and 0.3x + 0.6y are linear. Expressions such as xy, x^2 + y, or 1/x + y are not linear in the decision variables.

A constant percentage requirement can still be linear: x >= 0.3(x + y) rearranges into a linear inequality. The presence of a percentage does not itself make a problem nonlinear.

The model also assumes the stated coefficients apply across the relevant range. Quantity discounts, changing productivity, and uncertainty may need a richer model. The lp_solve formulation tutorial provides another resource-allocation example and discusses the additional whole-number restriction for indivisible goods.

Do not round a fractional answer without checking

Continuous linear programming allows fractional quantities. This is sensible for kilograms, litres, or hours when the situation permits divisibility.

For indivisible products, a fractional optimum is a warning to revisit the whole-number requirement. Rounding upward may break capacity; rounding downward may break a minimum order. Even a rounded feasible point need not be the best whole-number solution.

State the distinction clearly. If the task specifically requires integer quantities, the model includes that restriction and the final plan must be checked accordingly.

A one-minute audit before drawing the graph

Read your model back into ordinary language:

  1. Definitions: Have I named quantities, units, and the time period?
  2. Target: Does the objective measure exactly what the question asks to improve?
  3. Resources: Does each left-hand side calculate total use of one resource?
  4. Signs: Have I distinguished maximum availability from minimum requirements?
  5. Coverage: Is every stated condition represented?
  6. Domains: Have I included non-negativity and any required whole-number condition?
  7. Reality check: Does a simple candidate plan behave as expected?

Constraints must hold together. If the problem requires x + y >= 50 but also x + y <= 40, no plan can satisfy both. Check for a copying mistake, but do not change the question’s data simply to create a solution.

If asked only to formulate, stop after a clear complete model. If asked to solve, continue with the graph and optimisation. OpenStax’s linear programming lesson develops that full sequence from constraints to feasible choices and objective values.

Try these translation questions

For questions 1 to 5, let x and y be quantities of products A and B.

  1. Combined production cannot exceed 75 units.
  2. A must be at least 8 units more than B.
  3. B must constitute at most 40% of total output.
  4. Each A takes 15 minutes and each B takes 20 minutes. Four hours are available.
  5. Exactly 36 units must be made, and A must be at least twice B.
  6. A costs Rs 25 per kilogram and B costs Rs 18 per kilogram. Define variables and write the objective for the cheapest mixture.
  7. Profit is Rs 60 per A and Rs 45 per B. Storage allows at most 30 units altogether. Does Maximise P = 30x + 30y express the target correctly?
  8. A proposed plan meets both resource limits but fails a minimum order. Is it feasible?

Answers with the reason

  1. x + y <= 75. It is an upper limit on total output.
  2. x - y >= 8. The condition is about the difference.
  3. y <= 0.40(x + y), simplifying to 3y <= 2x. The percentage refers to total output.
  4. 15x + 20y <= 240, or 3x + 4y <= 48. Convert hours to minutes first.
  5. x + y = 36 and x >= 2y. Both conditions apply.
  6. Let x and y be kilograms of A and B. Minimise C = 25x + 18y. A complete problem would also need the mixture requirements and domain restrictions.
  7. No. Maximise P = 60x + 45y, subject to the storage constraint x + y <= 30 and other stated conditions.
  8. No. Feasibility requires every constraint to be satisfied simultaneously.

Include x >= 0 and y >= 0 when assembling the quantity models above, with whole-number restrictions where the quantities require them.

Frequently asked questions

What is the first step in a linear programming word problem?

Identify what can be chosen. Define a variable for each decision quantity, including the unit and time period, before translating the numerical information.

How do I identify the objective function?

Find the result the question asks to maximise or minimise. Multiply each quantity by its contribution per unit and add the contributions. State the direction of optimisation explicitly.

Does “at least” mean greater than or equal to?

Yes. “At least 20 units” allows exactly 20 or any larger acceptable quantity, so use >= 20 for the relevant expression.

Should available resources always be fully used?

No. Availability normally sets an upper limit. Unused resources can remain in an optimal plan. Write an equality only when exact use is required by the statement.

Can a minimisation problem have a less-than-or-equal-to constraint?

Yes. A cheapest-mixture problem may include a maximum batch size or an ingredient cap. The objective direction does not determine constraint signs.

Why do we include non-negativity constraints?

Production quantities, ingredient amounts, and similar physical decisions cannot be negative. These restrictions keep the model consistent with the meaning of the variables.

Can I interchange x and y?

Yes, provided you interchange their definitions and every corresponding coefficient consistently. The letters are arbitrary; their meanings are not.

How do I express a minimum percentage of one ingredient?

Multiply the required percentage by the total quantity. If A must form at least 25% of an A-and-B blend, write x >= 0.25(x + y), which simplifies to 3x >= y.

Can I round the optimal solution to whole numbers?

Not automatically. Check whole-number requirements, all constraints, and whether another allowed integer plan gives a better objective value. A continuous optimum and an integer optimum can differ.

What should my final answer contain if the question asks only for formulation?

Give the variable definitions, the objective with maximise or minimise, all constraints, and the domain restrictions. A graph or numerical optimum is needed only if the question also asks you to solve the model.

Looking for commerce tuitions?

Prachi is a gold-medalist commerce teacher with experience at Deloitte and KPMG. She focuses on fundamentals to build a strong foundation.

Start classes