Finding Equations of Horizontal & Vertical Lines

Instructor: Stephanie Matalone

Stephanie taught high school science and math and has a Master's Degree in Secondary Education.

The lesson will go over the definition of horizontal and vertical lines. It will also discuss the process of writing the equations of these lines, and some examples of each.

Writing Equations

So you think you're a math wizard? You can write equations, and you know all about y = mx + b. Give you two points and you'll have the equation down in the blink of an eye! That is until you saw a line that went straight up and down. All the sudden, you're stumped! You know what to do when the line is diagonal, but this is some weird line... Your confidence is shot.

Not to worry! That line that goes straight up and down is just a vertical line and writing the equation is quite easy!

Before we begin, let's review the basics of linear equations. Linear equations are functions like y = 2x + 1 that graph to form a straight line. Not too hard to remember! They are typically in the form y = mx + b where m is the slope and b is the y intercept. Slope is rate of change or the change in y divided by the change in x. The y intercept is where the line crosses the y axis.

Linear Equation

Horizontal Lines

Let's start with horizontal lines because they are a bit easier. We will start by looking at the line y = 2. You can see that the line goes left to right which makes it a horizontal line. Think about the sun setting on the horizon to help you remember. Formally, a horizontal line is one in which all the y values for each point are the same. In our line, all the y coordinates will be 2, no matter what point you choose.

Graph of y = 2

Let's think about how we would write this equation. We know that y = mx + b is the format we need to follow. Its pretty easy to see that the y intercept is 2. This makes our equation y = mx + 2.

Now the question is what the slope is. Well, let's take two points and try to find the slope. We will use (1, 2) and (3, 2) just to keep things simple. To find the slope, we subtract the y values (2 - 2) to get 0. Then, we subtract the x values (3 - 1) to get 2. Divide 0 by 2 because slope is change in y over change in x. When we do this, we get 0 because 0 divided by anything is 0.

This means our equation is now y = 0x + 2. Multiply out 0 and x to get 0. Now we have y = 0 + 2. Simplify this and we have our equation of y = 2.

You do not have to go through this process each time if you do not want to. Just remember that horizontal lines will always be in the form of y = b.

Vertical Lines

Now we will look at the trickier of the two lines. We will examine the graph of x = 4. You can see that this graph's line goes straight up and down. Formally, a vertical line is one where all the x values for a line are the same. Take any point on this graph, and its x coordinate will be 4.

Graph of x = 4

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account