Equation of a Line Calculator
Use this calculator to find the slope, y-intercept, and the equation of a straight line given any two points (x1, y1) and (x2, y2) on the line.
Understanding the Equation of a Line
A graphing calculator is an invaluable tool for visualizing mathematical functions. While a full interactive graphing tool is complex, understanding the fundamental components of a line is crucial. This calculator focuses on one of the most basic yet important aspects: finding the equation of a straight line when you know two points that lie on it.
The Slope-Intercept Form: y = mx + b
The most common way to represent a straight line is through its slope-intercept form: y = mx + b. Let's break down what each part means:
- y: The dependent variable, representing the vertical position on the graph.
- x: The independent variable, representing the horizontal position on the graph.
- m: The slope of the line. This value tells you how steep the line is and in which direction it's going. A positive slope means the line rises from left to right, a negative slope means it falls, and a zero slope means it's a horizontal line.
- b: The y-intercept. This is the point where the line crosses the y-axis (i.e., where x = 0).
Calculating the Slope (m)
The slope is defined as the "rise over run" – the change in y divided by the change in x between any two points on the line. If you have two points (x1, y1) and (x2, y2), the formula for the slope is:
m = (y2 - y1) / (x2 - x1)
It's important to note that if x2 - x1 equals zero, the line is vertical, and its slope is undefined. This calculator will identify such cases.
Calculating the Y-intercept (b)
Once you have the slope (m), you can find the y-intercept (b) by plugging one of your known points (x1, y1) and the calculated slope into the slope-intercept form (y = mx + b) and solving for b:
y1 = m * x1 + b
Rearranging this gives:
b = y1 - m * x1
Example Calculation
Let's say we have two points: (1, 2) and (3, 6).
- Calculate the slope (m):
m = (6 - 2) / (3 - 1) = 4 / 2 = 2 - Calculate the y-intercept (b) using point (1, 2):
2 = 2 * 1 + b
2 = 2 + b
b = 0 - Formulate the equation:
y = 2x + 0or simplyy = 2x
This calculator automates these steps, providing you with the slope, y-intercept, and the final equation of the line.