How to Calculate the Equation of a Line

By Amanda Maguire; Updated April 24, 2017
Make calculations easier for yourself by using a calculator

Math can be a tricky subject. When studying algebra in high school, it may seem like a subject you'll never need in the real world. However, finding the slope of a line can be useful in real life situations. Slope describes the grade, steepness or incline of something. It can be used to find how steep a road or hill is when traveling. It can also be used to calculate business trends when the slope is used to find the equation of a line.

Use the points (1,3) and (2,1) to find the equation of an example line. The first number in the pair is the x coordinate the second number in the pair is the y coordinate. Insert both points of the line in the slope formula(m=(y2-y1)/(x2-x1)). Either y-coordinate can be y1 and y2, as long as the x-coordinates for the second part of the equation correspond. For example if y2 equals 3, then x2 must equal 1 in this example.

Insert the formula into a calculator (you can also solve the problem manually if you prefer). Subtract y1 from y2 (in our problem, solve 3 minus 1). Subtract x1 from x2 (In our problem, solve 1 minus 2). In this problem the solution is 2 divided by -1. When you divide the quantity in this problem you are left with -2. So the slope of the line equals -2.

Use the slope to find the y-intercept of a line. The y-intercept is represented by the letter b in the equation of a line. Solve for b using the equation y=mx+b. To find b, substitute the slope you found in the previous step (-2) for m. Then substitute one of the points on the line for y and x in the problem. We'll use the point (2,1). Now your problem is 1=-2x2+b.

Multiply -2 and 2, which equals -4. Now your problem is 1=-4+b.

Add -4 to both sides of the problem to get b alone. 1+-4 equals -3. So you're left with b=-3.

Substitute your solutions for m and b into the slope intercept equation (y=mx+b). This gives you y equals 2 multipled by x +-3. Now you can substitute any x point on the line and get the y intercept that corresponds to it.


Points with simple numbers may seem easy to calculate manually but sometimes it is easy to make a simple sign mistake. To avoid this it's best to use a calculator.

About the Author

Amanda Maguire has been a writer since 2005. She is the managing editor of and has also been published on and in the "Asbury Park Press." She is currently working to get her Bachelor of Arts in journalism at Rutgers University in New Jersey