Slope, y-intercept, and line equation
Slope is defined as the rise divided by the run: the change in y divided by the change in x between two points. A positive slope means the line rises from left to right; a negative slope means it falls. A slope of zero means the line is horizontal. A vertical line has an undefined slope because the change in x is zero and division by zero is undefined.
The y-intercept is the value of y when x equals zero, found by rearranging the slope formula: b = y1 - m*x1. The slope-intercept form of the line equation is y = mx + b. This form is the most common way to write a linear equation because the slope and y-intercept can be read directly from the equation.
m = (y2 - y1) / (x2 - x1)
Slope equals the vertical change (rise) divided by the horizontal change (run) between two points.
b = y1 - (m × x1)
The y-intercept is found by substituting one known point and the slope into the rearranged line equation.
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
The straight-line distance between two points is calculated using the Pythagorean theorem.
angle = arctan(m) x (180 / pi)
The angle the line makes with the positive x-axis in degrees, derived from the inverse tangent of the slope.