How do I graph Linear Programming questions?

6k Views Asked by At

So let's say I have the following constraints:

$2a + 3b \leq 30$

$a + b \leq 15$

$a \geq 0$

$b \geq 0$

(I just made this problem up, so I'm not sure if it may make any sense when I graph it.)

Anyways, my question is that when it comes time to put the constraints onto a graph, how do I know which one is y and which one is x? Does it matter? For example, do I do $b = -a + 15$ or $a = -b + 15$ ? (This is being modeled after the $y=mx + b$ format.)

3

There are 3 best solutions below

0
On

It does not matter which variable goes on which axis. The important thing is that you carefully examine your constraints and use the quantity to be maximized or minimized. Let me explain:

Say you have the following constraints in $a$ and $b:$

1) $100 \leq a \leq 200;$

2) $80 \leq b \leq 170;$

3) $b \geq 200 - a.$

You want to maximize the value of $P$ as defined as $P = 5b - 2a.$

Now you graph. For the purpose of demonstration, let $a$ go on the $y-$axis and $b$ go on the $x-$axis. We have intersections at the Cartesian points $(80, 120),$ $(80, 200),$ $(100, 100),$ $(170, 100),$ and $(170, 200).$

You must now translate these back into values for the original variables $a$ and $b.$ The graph is simply a tool to help you find possible critical points. For our case, we have these possible points:

1) $a = 120, b = 80;$

2) $a = 200, b = 80;$

3) $a = 100, b = 100;$

4) $a = 100, b = 170;$

5) $a = 200, b = 170.$

Plugging these pairs into the optimization equation, we find that $P$ is maximized when $\boxed{a = 170, b = 100}.$

0
On

how do I know which one is y and which one is x?

You can use any consistent set of variable names. You can name your axis whatever you want as long as you are consistent and don't make an error.

Here I assume that the horizontal access is "a" and the vertical access is "b" - To draw the constraints I did this:

Note: I am only showing how I draw the constraints since your question did not include the objective function. I am assuming that both a and b are greater than or equal to zero.

$2a+3b <=30$

To plot this inequality write it in a form of a line:

$b = (30-2a)/3$

put $a=0$ to get $b$ intercept which is $b=10$

put $b=0$ to get $a$ intercept which is $a=15$

for the constraint $a+b<15$

To plot this inequality write it in a form of a line:

$b=15-a$

put $a=0$ to get $b$ intercept so that $b=15$

put $b=0$ to get $a$ intercept so that $a=15$

The shaded area is the feasible area in the following plot:

enter image description here

0
On

To plot a constraint such as

$2a+3b <=30$

there is no need to express one variable as a function of the other. Just put each in turn equal to zero to calculate the other's intercept - in this case it's obvious that the "a" intercept is one half of 30 and the "b" intercept is one third of 30.