Graphing Linear Equations

Slope-Intercept Form

  • A linear function of two variables can be written in slope-intercept form: y=ax+b
    • y is the dependent variable (on the vertical axis)
    • x is the independent variable (on the horizontal axis)
    • a is the slope of the line
      • a=riserun=change in ychange in x=ΔxΔy
      • you may have been taught the slope as “m”, this is just personal taste, but again, get used to using different letters!
    • b is the vertical-intercept, a constant number where the line crosses the vertical axis
      • if y is the dependent variable, this is the “y-intercept”, y where x=0
  • Any point on the line has an x-coordinate and y-coordinate (xi,yi)

Other Forms

  • A linear function can equivalently be expressed in the following form: a1x1+a2x2=c
    • x2 is the dependent variable (on the vertical axis)
    • x1 is the independent variable (on the horizontal axis)
    • c is a constant
  • This is a valid equation, but is difficult to visualize in the traditional graph as above. Simply solve for the dependent variable on the vertical axis (x2 as if you were solving for y):

a1x1+a2x2=cOriginala2x2=ca1x1Subtracting x1 termx2=ca2a1a2x1Dividing by a2

  • The vertical intercept is ca2

  • The horizontal intercept is ca1

  • The slope is a1a2

  • This is extremely useful for dealing with constraints in constrained optimization problems: budget constraints and isocost lines

Drawing a Graph From an Equation

If we already have a linear equation that we would like to graph, we can follow these steps:

  1. Take the equation and plug in two values, e.g. if we have:

p=12q+4

  1. We can find two points on the graph. The easiest one to find is the vertical-intercept, where the line crosses the vertical axis, where q=0, so plug in q=0:

p=12(0)+4p=4

Thus, one point is (0,4). Note that the constant in the function itself is the pintercept! So one valid point will always be (0,b)!

  1. For our second point, let’s plug in q=2:

p=12(2)+4p=5

Thus, another point is (2,5)

  1. Now, plot the two points on the graph, and connect them with a line

Note: A quick shortcut to plot a line is to find the vertical intercept and plot that, and then find the next point using the slope. Here, start our line at 4 on the vertical axis, and then, as the slope is 12, for every one unit increase in q, p increases by 12. Our second point, (2,5), is a 2 unit increase in q resulting in a 1 unit increase in p.

Finding an Equation from a Graph

In order to find the equation of an existing line, we follow these steps:

  1. First, take two points on the line and find the slope, a, between them. Let’s pick (1,6) and (3,2).

Slope=riserun=(p2p1)(q2q1)=(26)(31)=42=2

There is a shortcut that we can use to find the slope faster by eye-balling the graph: When q changes by 1, how many units does p change? If we move from (1,6) to (2,5), q increases by 1, but p falls by 2. So the slope is 2. For every one unit increase in q, p changes by -2.

  1. Now with the slope, we need to find the vertical intercept, or b, we solve this by plugging in the slope and any point on the graph, we will use (1,6):

p=aq+b(6)=2(1)+b6=2+b8=b

Note, there is another easy way to eye-ball what this value is. It is simply that p value where q=0, or at what p value the graph crosses the vertical axis. We can see it is at 8.

  1. Thus, we have the slope and the intercept, so our equation is: p=2q+8