freeCodeCamp/guide/english/mathematics/equation-of-a-line/index.md

788 B

title
Equation of a Line

Equation of a Line

For a Given Slope and y-intercept (Standard Form):

Let m be the slope of the line and b be the y-intercept. (Note that the y-intercept is the point at which the given line crosses the y-axis). Then the equation of a line is:

y = mx+b

For a Given Slope and One Point through which the Line Passes (Point-Slope Form):

Let m be the slope of the line and (x1, y1) be the co-ordinate of the point through which the given line passes. Then the equation of a line is:

(y - y1) = m(x - x1)

For Two Points through which the Line Passes:

Let (x1, y1) and (x2, y2) be the co-ordinates of two points through which the given line passes. Then the equation of a line is:

(y - y1)(x2 - x1) = (y2 - y1)(x - x1)