We consider rectangular geometric coordinates that are regular (with equal unit distances in the horizontal x direction, equal to the unit distances in the vertical y direction):

In this rectangular coordinate geometry, a line is a straight direction connecting points that are exactly in that straight direction, with both ends of the line extending infinitely. All points on the line are said to be collinear.

The slope of a line is the rise over run of the line.

For example, a line that advances 4 units horizontally, for every 3 vertical units advanced, has a slope of 3/4 or 0.75.

Likewise, a line that advances −3 units vertically (drops 3 units), for every 4 horizontal units advanced, has a slope of −3/4 or −0.75:

The
y-intercept
of a line specifies where the line intercepts the y-axis.
For example, if the y-intercept is 3,
the line intercepts the y-axis at

Likewise, the
x-intercept
of a line specifies where the line intercepts the x-axis.
For example, if the x-intercept is 4,
the line intercepts the x-axis at

A line can be identified with an equation that specifies the location and orientation of the line. There are various equations of a line, all derivable from each other.

The general (standard) form of the equation of a line is:

\[ Ax + By + C = 0 \]

where A, B and C are coefficients. The slope of the line is −(A/B), the x-intercept is −(C/A), and the y-intercept is −(C/B). (Note: the coefficients could be lower case (a,b,c) instead of upper case; we will use upper case.)

A variation of the general form of the equation of a line is:

\[ Ax + By = C \]

In that case, the slope of the line would be −(A/B) as before, but with y-intercept C/B instead of −C/B.

The intercept form of the equation of a line is:

\[ \frac{x}{a}+\frac{y}{b} = 1 \]

where a and b are the x and y intercepts respectively:

The slope y-intercept (or simply slope-intercept) form of the equation of a line is:

\[ y = mx + b \]

where m is the slope, and b is the y-intercept.

Note: In some countries, slope and y-intercept are denoted k and m respectively:

y = kx + m

We use y = mx + b in this article.

For a line with slope m, and point P1 = (x1, y1) on the line, the point-slope form of the equation of the line is:

\[ y - y_1 = m(x - x_1) \]

For a line with two points P1 = (x1, y1) and P2 = (x2, y2) on the line, the two-point form of the equation of the line is:

\[ \frac{y - y_1}{x - x_1} = \frac{y_2 - y_1}{x_2 - x_1} \]

A useful property of the slope of a line is that the negative reciprocal of the slope will be the slope of a line perpendicular to the line: a line with slope m is perpendicular to a line with slope −1/m.

To find the intersection point of two nonparallel lines, we can substitute the equation of one of the lines into the equation of the other line.

Given two lines:

\begin{align} A_1x + B_1y + C_1 & = 0 \\ A_2x + B_2y + C_2 & = 0 \end{align}

The lines are parallel if A1B2 = A2B1 and are perpendicular if A1A2 = −B1B2.

If the lines are parallel, there is no intersection. If either line is horizontal or vertical, the constant coordinate is a coordinate of the intersection, which can be substituted into the other line equation to find the other coordinate.

For example, if one of the lines is the vertical line x = 5, then 5 is the x-coordinate of the intersection, and substituting 5 for x in the other line equation produces the y value of the intersection.

Continuing with nonparallel lines that are non-vertical and non-horizontal, we can convert the line equations from general form to slope-intercept form.

Denoting slope and y-intercept as m and b respectively:

\[ m_1 = -\frac{A_1}{B_1} \]

\[ b_1 = -\frac{C_1}{B_1} \]

and

\[ m_2 = -\frac{A_2}{B_2} \]

\[ b_2 = -\frac{C_2}{B_2} \]

The slope-intercept form of the line equations are:

\begin{align} y & = m_1x + b_1 \\ y & = m_2x + b_2 \end{align}

Since the y-coordinate of the intersection point will be the same for both lines, substitute one of the equations for y in the other equation:

\[ m_1x + b_1 = m_2x + b_2 \]

Solving for x:

\begin{align} m_1x - m_2x & = b_2 - b_1 \\ x(m_1 - m_2) & = b_2 - b_1 \\ x & = (b_2 - b_1) / (m_1 - m_2) \end{align}

The x-coordinate can then be substituted into either line equation to find the y-coordinate of the intersection.

\[ y = m_1x + b_1 \]

\[ y = m_1\frac{(b_2 - b_1)}{(m_1 - m_2)} + b_1 \]

To convert back to the general equation of a line (Ax + By + C = 0), substitute −A/B for m, and −C/B for b:

\[ x = \frac{(b_2 - b_1)}{(m_1 - m_2)} \]

\[ x = \frac{(-C_2/B_2 + C_1/B_1)}{(-A_1/B_1 + A_2/B_2)} \]

\[ x = \frac{(C_1/B_1 - C_2/B_2)}{(A_2/B_2 - A_1/B_1)} \]

\[ x = \frac{B_1B_2(C_1B_2 - C_2B_1)}{B_1B_2(A_2B_1 - A_1B_2)} \]

\[ x = \frac{(C_1B_2 - C_2B_1)}{(A_2B_1 - A_1B_2)} \]

\[ x = \frac{(B_2C_1 - B_1C_2)}{(A_2B_1 - A_1B_2)} \]

and

\[ y = m_1\frac{(b_2 - b_1)}{(m_1 - m_2)} + b_1 \]

\[ y = (-A_1/B_1)\frac{(-C_2/B_2 + C_1/B_1)}{(-A_1/B_1 + A_2/B_2)} - C_1/B_1 \]

\[ y = -\frac{A_1(C_1/B_1 - C_2/B_2)}{B_1(A_2/B_2 - A_1/B_1)} - C_1/B_1 \]

\[ y = -\frac{A_1(C_1/B_1 - C_2/B_2)}{B_1(A_2/B_2 - A_1/B_1)} \frac{B_1B_2}{B_1B_2} - C_1/B_1 \]

\[ y = -\frac{A_1(B_2C_1 - B_1C_2)}{B_1(A_2B_1 - A_1B_2)} - \frac{C_1}{B_1} \]

Find the intersection of two nonparallel lines that are not vertical or horizontal, without converting to the slope-intercept form of the line equation.

Solution: As before, the y-coordinate of the intersection will be the same for both equations, so we substitute one equation for the y-coordinate in the other equation:

\begin{align} A_2x + B_2y + C_2 & = 0 \\ B_2y & = -(A_2x + C_2) \\ y & = -(A_2x + C_2)/B_2 \\ -(A_1x + C_1)/B_1 & = -(A_2x + C_2)/B_2 \\ (A_1x + C_1)/B_1 & = (A_2x + C_2)/B_2 \\ B_2(A_1x + C_1) & = B_1(A_2x + C_2) \\ A_1B_2x + B_2C_1 & = A_2B_1x + B_1C_2 \\ A_1B_2x - A_2B_1x & = B_1C_2 - B_2C_1 \\ x(A_1B_2 - A_2B_1) & = B_1C_2 - B_2C_1 \\ x & = (B_1C_2 - B_2C_1) / (A_1B_2 - A_2B_1) \end{align}

Multiplying by −1/−1 gives the same result as above:

\[ x = \frac{(B_2C_1 - B_1C_2)}{(A_2B_1 - A_1B_2)} \]

To solve for y, substitute x into either line equation:

\begin{align} A_1x + B_1y + C_1 & = 0 \\ B_1y & = -(A_1x + C_1) \\ y & = -(A_1x + C_1)/B_1 \\ y & = -A_1x/B_1 - C_1/B_1 \end{align}

\[ y = -\frac{A_1}{B_1} \frac{(B_2C_1 - B_1C_2)}{(A_2B_1 - A_1B_2)} - \frac{C_1}{B_1} \]