A line in two-dimensional Cartesian space has the form \(Ax + By + C = 0\), where \(A\) and \(B\) are not both 0. Solving for \(y\) yields $$ y = -{A \over B}x - {C \over B},~~ B \ne 0 $$ This is sometimes called the slope-intercept form of the line because \( -{A \over B} \) represents the slope, and \( -{C \over B} \) represents the \(y\)-intercept of the line. (Note that if \( B = 0 \), the line has no \(y\)-intercept. It is a vertical line that passes through \(x = -{C \over A}\) on the \(x\) axis. If \(C = 0\) as well, then \(x = 0\), a vertical line that passes through every point on the \(y\) axis.) The slope-intercept form of the line is often written as $$ y = mx + b $$ where \(m\) represents the slope, and \(b\) represents the \(y\)-intercept.

The slope of a line describes how much the line slants and in what direction. A horizontal line has no slope (\(m = 0\)). A vertical line has infinite slope (\(m = {\infty}\)). A line with positive slope (\(m \gt 0\)) ascends from left to right. A line with negative slope (\(m \lt 0\)) descends from left to right. The slope is the ratio between the change in \(y\) and the corresponding change in \(x\). For example, a line with a slope of 2 (\(m = 2\)) rises 2 steps for every 1 step to the right. Likewise, a line with a slope of −⅓ (\(m = -{1 \over 3}\)) falls 1 step for every 3 steps to the right.

Graph of two lines

Since the slope is the change in \(y\) over the change is \(x\), we can use any two points on the line to find it. Given any two points \(P = (x_1, y_1)\) and \(Q = (x_2, y_2)\), the slope of the line containing those points will be $$ m = {{y_1 - y_2} \over {x_1 - x_2}},~~ (x_1 - x_2 \ne 0) $$ Once we know the slope, the \(y\)-intercept follows immediately. $$ b = y_1 - mx_1 $$

For example, Given the points \(P = (6, 0)\) and \(Q = (0, 2)\), then \(m = {{0 - 2} \over {6 - 0}}, m = -{1 \over 3}\) and \(b = 0 + {1 \over 3} \times 6, b = 2\). The equation of the line is therefore $$ y = -{1 \over 3}x + 2 $$ or in terms of the original form we started with, $$ x + 3y - 6 = 0 $$