## Graphing Vertical and Horizontal Lines

Contents

Can we graph an equation with only one variable? Just \(x\) and no \(y,\) or just \(y\) without an \(x?\) How will we make a table of values to get the points to plot?

Let’s consider the equation \(x=-3.\) The equation says that \(x\) is always equal to \(-3,\) so its value does not depend on \(y.\) No matter what \(y\) is, the value of \(x\) is always \(-3.\)

To make a table of solutions, we write \(-3\) for all the \(x\) values. Then choose any values for \(y.\) Since \(x\) does not depend on \(y,\) you can chose any numbers you like. But to fit the size of our coordinate graph, we’ll use \(1,2,\) and \(3\) for the \(y\)-coordinates as shown in the table.

\(x=-3\) | ||
---|---|---|

\(x\) | \(y\) | \(\left(x,y\right)\) |

\(-3\) | \(1\) | \(\left(-3,1\right)\) |

\(-3\) | \(2\) | \(\left(-3,2\right)\) |

\(-3\) | \(3\) | \(\left(-3,3\right)\) |

Then plot the points and connect them with a straight line. Notice in the figure below that the graph is a **vertical line**.

### Definition: Vertical Line

A vertical line is the graph of an equation that can be written in the form \(x=a.\)

The line passes through the \(x\)-axis at \(\left(a,0\right)\).

## Example

Graph the equation \(x=2.\) What type of line does it form?

### Solution

The equation has only variable, \(x,\) and \(x\) is always equal to \(2.\) We make a table where \(x\) is always \(2\) and we put in any values for \(y.\)

\(x=2\) | ||
---|---|---|

\(x\) | \(y\) | \(\left(x,y\right)\) |

\(2\) | \(1\) | \(\left(2,1\right)\) |

\(2\) | \(2\) | \(\left(2,2\right)\) |

\(2\) | \(3\) | \(\left(2,3\right)\) |

Plot the points and connect them as shown.

The graph is a vertical line passing through the \(x\)-axis at \(2.\)

What if the equation has \(y\) but no \(x\)? Let’s graph the equation \(y=4.\) This time the \(y\)-value is a constant, so in this equation \(y\) does not depend on \(x.\)

To make a table of solutions, write \(4\) for all the \(y\) values and then choose any values for \(x.\)

We’ll use \(0,2,\) and \(4\) for the \(x\)-values.

\(y=4\) | ||
---|---|---|

\(x\) | \(y\) | \(\left(x,y\right)\) |

\(0\) | \(4\) | \(\left(0,4\right)\) |

\(2\) | \(4\) | \(\left(2,4\right)\) |

\(4\) | \(4\) | \(\left(4,4\right)\) |

Plot the points and connect them, as shown in the figure below. This graph is a **horizontal line** passing through the \(y\text{-axis}\) at \(4.\)

### Definition: Horizontal Line

A horizontal line is the graph of an equation that can be written in the form \(y=b.\)

The line passes through the \(y\text{-axis}\) at \(\left(0,b\right).\)

## Example

Graph the equation \(y=-1.\)

### Solution

The equation \(y=-1\) has only variable, \(y.\) The value of \(y\) is constant. All the ordered pairs in the table have the same \(y\)-coordinate, \(-1\). We choose \(0,3,\) and \(-3\) as values for \(x.\)

\(y=-1\) | ||
---|---|---|

\(x\) | \(y\) | \(\left(x,y\right)\) |

\(-3\) | \(-1\) | \(\left(-3,-1\right)\) |

\(0\) | \(-1\) | \(\left(0,-1\right)\) |

\(3\) | \(-1\) | \(\left(3,-1\right)\) |

The graph is a horizontal line passing through the \(y\)-axis at \(–1\) as shown.

The equations for vertical and horizontal lines look very similar to equations like \(y=4x.\) What is the difference between the equations \(y=4x\) and \(y=4?\)

The equation \(y=4x\) has both \(x\) and \(y.\) The value of \(y\) depends on the value of \(x.\) The \(y\text{-coordinate}\) changes according to the value of \(x.\)

The equation \(y=4\) has only one variable. The value of \(y\) is constant. The \(y\text{-coordinate}\) is always \(4.\) It does not depend on the value of \(x.\)

The graph shows both equations.

Notice that the equation \(y=4x\) gives a slanted line whereas \(y=4\) gives a horizontal line.

## Example

Graph \(y=-3x\) and \(y=-3\) in the same rectangular coordinate system.

### Solution

Find three solutions for each equation. Notice that the first equation has the variable \(x,\) while the second does not. Solutions for both equations are listed.

The graph shows both equations.