Skip to main content
Mathematics LibreTexts

3.3: Graphical Solutions

  • Page ID
    67077
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Wouldn’t it be nice if we could simply produce and sell infinitely many units of a product and thus make a never-ending amount of money? In business (and in day-to-day living) we know that some things are just unreasonable or impossible. Instead, our hope is to maximize or minimize some quantity, given a set of constraints.

    In order to have a linear programming problem, we must have:

    • Constraints, represented as inequalities
    • An objective function, that is, a function whose value we either want to be as large as possible (want to maximize it) or as small as possible (want to minimize it).

    Consider this extension of the example from the end of the last section.

    Example \(\PageIndex{1}\)

    A company produces a basic and premium version of its product.  The basic version requires 20 minutes of assembly and 15 minutes of painting.  The premium version requires 30 minutes of assembly and 30 minutes of painting.  If the company has staffing for 3,900 minutes of assembly and 3,300 minutes of painting each week.  They sell the basic products for a profit of $30 and the premium products for a profit of $40.  How many of each version should be produced to maximize profit?

    Solution

    Let \(b-\) the number of basic products made, and \(p=\) the number of premium products made.  Our objective function is what we’re trying to maximize or minimize.  In this case, we’re trying to maximize profit.  The total profit, \(P\), is

    \[P = 30b + 40p\nonumber \]

    In the last section, the example developed our constraints.  Together, these define our linear programming problem:

    Objective function: \[P = 30b + 40p\nonumber \]

    Constraints:

    \[\begin{array}{*{20}{c}}  20b + 30p \leq 3900 \\ 15b + 30p \leq 3300 \end{array}\nonumber \]

    \[b \geq 0, \quad p \geq 0\nonumber \]

    In this section, we will approach this type of problem graphically.  We start by graphing the constraints to determine the feasible region – the set of possible solutions.  Just showing the solution set where the four inequalities overlap, we see a clear region.

    clipboard_e9b56343c8cc66317a9fb7ce2a1029fbd.png

    To consider how the objective function connects, suppose we considered all the possible production combinations that gave a profit of \(P = \$3000\), so that \(3000 = 30b + 40p\). That set of combinations would form a line in the graph.  Doing the same for a profit of $5000 and $6500 would give additional lines.  Graphing those on top of our feasible region, we see a pattern:

     

    clipboard_e660fbc1d9a2f4f1b917f19ea9af10ee3.png

    Notice that all the constant-profit lines are parallel, and that in general the profit increases as we move up to upper right.  Notice also that for a profit of $5000 there are some production levels inside the feasible region for that profit level, but some are outside.  That means we could feasibly make $5000 profit by producing, for example, 167 basic items and no premium items, but we can’t make $5000 by producing 125 premium items and no basic items because that falls outside our constraints. 

    The solution to our linear programming problem will be the largest possible profit that is still feasible.  Graphically, that means the line furthest to the upper-right that still touches the feasible region on at least point.  That solution is the one below:

    clipboard_e42e7ac4245351a61572216332126adfc.png

    This profit line touches the feasible region where \(b = 195\) and \(p = 0\), giving a profit of

    \[P = 30(195) + 40(0) = \$ 5850. \nonumber \]

    Notice that this is slightly larger than the profit that would be made by completely utilizing all staffing at \(b = 120, p = 50\), where the profit would be $5600.

    The objective function along with the four corner points above forms a bounded linear programming problem. That is, imagine you are looking at three fence posts connected by fencing (black point and lines, respectively). If you were to put your dog in the middle, you could be sure it would not escape (assuming the fence is tall enough). If this is the case, then you have a bounded linear programming problem. If the dog could walk infinitely in any one direction, then the problem is unbounded.

    In the past example, you can see that the line of maximum profit will always touch the boundary of the feasible region.  That observation inspires the fundamental theorem of linear programming.

    Fundamental Theorem of Linear Programming

    • If a solution exists to a bounded linear programming problem, then it occurs at one of the corner points.
    • If a feasible region is unbounded, then a maximum value for the objective function does not exist.
    • If a feasible region is unbounded, and the objective function has only positive coefficients, then a minimum value exists.

    In the last example we solve the problem somewhat intuitively by “sliding” the profit line up.  Typically we use a more procedural approach.

    Solving a Linear Programming Problem Graphically

    1. Define the variables to be optimized. The question asked is a good indicator as to what these will be.
    2. Write the objective function, first in words, then convert to a mathematical equation
    3. Write the constraints, first in words, then convert to mathematical inequalities
    4. Graph the constraints inequalities, and shade the feasible region
    5. Identify the corner points by solving systems of linear equations whose intersection represents a corner point.
    6. Test all corner points in the objective function. The “winning” point is the point that optimizes the objective function (biggest if maximizing, smallest if minimizing)

    Exercise \(\PageIndex{1}\)

    Maximize \(P = 14x + 9y\nonumber \) subject to the constraints:

     \[\begin{align*}  x + y &\leq 9  \\  3x + y &\leq 15  \\  x \geq 0, & \; y \geq 0  \\ \end{align*} \nonumber \]

    Answer

    Graphing the feasible region, we see there are three corner points of potential interest:  (0, 9), (5, 0), and the intersection of the two lines at (3, 6).  We then evaluate the objective function at each corner point.

    clipboard_e54dc0725524b19e0d7f1f5dbbf1a9959.png 

    \(P\) is maximized when \(x = 3, y = 6\).

    Point

    \(P = 14x + 9y\)

    (0, 9)

    81

    (5, 0)

    70

    (3, 6)

    96

     

    Example \(\PageIndex{2}\)

    A health-food business would like to create a high-potassium blend of dried fruit in the form of a box of 10 fruit bars. It decides to use dried apricots, which have 407 mg of potassium per serving, and dried dates, which have 271 mg of potassium per serving. The company can purchase its fruit through in bulk for a reasonable price. Dried apricots cost $9.99/lb. (about 3 servings) and dried dates cost $7.99/lb. (about 4 servings). The company would like the box of bars to have at least the recommended daily potassium intake of about 4700 mg, and contain at least 1 serving of each fruit. In order to minimize cost, how many servings of each dried fruit should go into the box of bars?

    Solution

    We begin by defining the variables. Let

    \(x =\) number of servings of dried apricots

    \(y =\) number of servings of dried dates

    We next work on the objective function.

    For apricots, there are 3 servings in one pound. This means that the cost per serving is $9.99/3 = $3.33. The cost for \(x\) servings would thus be 3.33\(x\).

    For dates, there are 4 servings per pound. This means that the cost per serving is \(\$ 7.99 / 4=\$ 2.00 .\) The cost for \(y\) servings would thus be \(2.00 y.\)

    The total cost, \(C\), for apricots and dates would be

    \[C=3.33 x+2.00 y \nonumber\]

    Normally we would have constraints \(x \geq 0\) and \(y \geq 0\) since negative servings can't be used. But in this case, we re further restricted. In words:

    • There must be at least 1 serving of each fruit
    • The product must contain at least \(4700 \mathrm{mg}\) of potassium

    Mathematically,

    • Since there must be at least 1 serving of each fruit, \(x \geq 1\) and \(v \geq 1\)
    • There are \(407 x\) mg of potassium in \(x\) servings of apricots and \(271 y\) mg of potassium in \(y\) servings of dates. The sum should be greater than or equal to \(4700 \mathrm{mg}\) of potassium, or \(407 x+271 y \geq 4700\)

    Thus we have.

    Objective function:

    \[C=3.33 x+2.00 y \nonumber\]

    Constraints:

    \[\begin{align*}407 x+271 y \geq 4700 \\ x \geq 1, \quad y \geq 1\end{align*}\]

    We graph the constraints and shade the feasible region:

    clipboard_e6d7da3457f025f1034e2e57a3a8134a3.png

    The region is unbounded, but we will be able to find a minimum still.  We can see there are two corner points.

    The one in the upper left is the intersection of the lines \(407x + 271y = 4700\) and \(x=1\).  Solving for the intersection using substitution:

    \[\begin{align*} 407(1) + 271y &= 4700  \\ y &\approx 15.8  \\ \end{align*} \nonumber \]

    Point:  \((1, 15.8)\)

    The one in the lower right is the intersection of the lines \(407x + 271y = 4700\) and \(y = 1\). 

    \[\begin{align*}  407x + 271(1) &= 4700  \\ x &\approx 10.9 \end{align*}  \]

    Point:  \((10.9, 1)\)

    Testing the objective function at each of these corner points:

     

    Point

    Cost, \(C = 3.33x + 2.00y\)

     

    (10.9, 1)

    \(C = 3.33(10.9) + 2.00(1) = \$38.30\)

    (1, 15.8)

    \(C = 3.33(1) + 2.00(15.8) = \$34.96\)

    The company can minimize cost by using 1 serving of apricots and 15.8 servings of dates.

    Exercise \(\PageIndex{2}\)

    A company makes two products.  Product A requires 3 hours of manufacturing and 1 hour of assembly.  Product B requires 4 hours of manufacturing and 2 hours of assembly.  There are a total of 84 hours of manufacturing and 32 hours of assembly available.  Determine the production to maximize profit if the profit on product A is $50 and the profit on product B is $60.

    Answer

    Let \(a\) be the number of product A produced, and \(b\) be the number of product B.

    Our goal is to maximize profit:  \(P = 50a + 60b\).

    clipboard_e3fac00a6013d67c03fb2e1872083390b.png

    From manufacturing we get the constraint:

    \[3a + 4b \leq 84\nonumber \]

    From assembly we get the constraint:

    \[1a + 2b \leq 32\nonumber \]

    We have corner points at (0, 16), (28, 0).  The third is at the intersection of the two lines.  To find that we could multiply the second equation by -2 and add:

    \[\begin{array}{rc} 3a + 4b &= 84 \\ - 2a - 4b &=  - 64 \\ \hline  a&= 20  \end{array} \nonumber \]

    The third corner point is at (20, 6).

    Evaluating the objective function at each of these points:

     

    Point

    \(P\)

    (0, 16)

    \(P = 50(0) + 60(16) = 960\)

    (28, 0)

    \(P = 50(28) + 60(0) = 1400\)

    (20, 6)

    \(P = 50(20) + 60(6) = 1360\)

     

    Profit will be maximized by producing 28 units of product A and 0 units of product B.

    Example \(\PageIndex{3}\)

    A factory manufactures chairs and tables, each requiring the use of three operations: Cutting, Assembly, and Finishing. The first operation can be used at most 40 hours; the second at most 42 hours; and the third at most 25 hours. A chair requires 1 hour of cutting, 2 hours of assembly, and 1 hour of finishing; a table needs 2 hours of cutting, 1 hour of assembly, and 1 hour of finishing.  If the profit is $20 per unit for a chair and $30 for a table, how many units of each should be manufactured to maximize profit?

    Solution

    We begin by defining the variables. Let

    \(c  =\) number of chairs made

    \(t =\) number of tables made

    The profit, \(P\), will be \(P = 20c + 30t\).

    For cutting, \(c\) chairs will require \(1c\) hours and \(t\) tables will require \(2t\) hours.  We can use at most 40 hours, so

    \[c + 2t \leq 40\nonumber \].

    For assembly, \(c\) chairs will require \(2c\) hours and t tables will require \(1t\) hours.  We can use at most 42 hours, so

    \[2c + t \leq 42\nonumber \].

    For finishing, c chairs will require \(1c\) hours and \(t\) tables will require \(1t\) hours.  We can use at most 25 hours, so

    \[c + t \leq 25\nonumber \].

    Since we can’t produce negative items, \(c \geq 0,\quad t \geq 0\).

    Graphing the constraints, we can see the feasible region.

    clipboard_e0d82e3160f536ab85c364888806d2691.png

    There are five corner points for this region.

    Point 1

    In the lower left, where \(t = 0\) crosses \(c = 0\).    Point: (0, 0)

    Point 2

    In the upper left, where \(c = 0\) crosses \(c + 2t = 40 \).   

    Using substitution, \(0 + 2t = 40 \), so \(t = 20\).

    Point: \((0, 20)\)

    Point 3

    In the lower right, where \(t = 0\) crosses \(2c + t = 42 \).   

    Using substitution, \(2c + 0 = 42 \), so \(c = 21\).

    Point: \((21, 0)\)

    Point 4

    Where \(c + 2t = 40\) crosses \(c + t = 25\).

    We can solve this as a system using any techniques we know. We could solve the second equation for \(c\), giving \(c = 25 - t\), then substitute into the first equation:

    \[\begin{align*} (25 - t) + 2t &= 40  \\ 25 + t &= 40  \\ t &= 15  \end{align*} \nonumber \]

    Then \(c = 25 – 15 = 10\).

    Point:  \((10, 15)\)

    Point 5

    Where \(2c + t = 42\) crosses \(c + t = 25\).

    We can solve this as a system using any techniques we know.  Using a different technique this time, we could multiply the bottom equation by -1 then add it to the first:

    \[\begin{array}{rc}  2c + t &= 42  \\  - c - t &=  - 25  \\ \hline c = 17 \end{array} \nonumber \]

    Then using \(c + t = 25 \), we have \(17 + t = 25\), so \(t = 8\).

    Point:  \((17, 8)\)

    Testing the objective function at each of these corner points:

    Point

    Profit, \(P = 20c + 30t\)

     

    (0, 0)

    \(P = 20(0) + 30(0) = \$0\)

    (0, 20)

    \(P = 20(0) + 30(20) = \$600\)

    (21, 0)

    \(P = 20(21) + 30(0) = \$420\)

    (10, 15)

    \(P = 20(10) + 30(15) = \$650\)

    (17, 8)

    \(P = 20(17) + 30(8) = \$580\)

    The profit will be maximized by producing 10 chairs and 15 tables.

    Important Topics of this Section

    Objective function

    Constraint equations

    Feasible region

    Corner points

    Fundamental Theorem of Linear Programming

    Solving a linear programming problem using a graph


    3.3: Graphical Solutions is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?