Math formulas and cheat sheets for Lines in two dimensions

## Lines in two dimensions

### Line forms

Slope y-intercept form:

 y=mx+b

Two point form:

 y−y1=y2−y1x2−x1(x−x1)

Point slope form:

 y−y1=m(x−x1)

Intercept form

 xa+yb=1 , (a,b≠0)

Normal form:

 x⋅cosΘ+y⋅sinΘ=p

Parametric form:

 xy=x1+t⋅cosα=y1+t⋅sinα

Point direction form:

 x−x1A=y−y1B

where (A,B)$(A,B)$ is the direction of the line and P1(x1,y1)$P_1(x_1, y_1)$ lies on the line.

General form:

 Ax+By+C=0 , (A≠0 or B≠0)

### Distance

The distance from Ax+By+C=0$A\,x + B\,y + C = 0$ to P1(x1,y1)$P_1(x_1, y_1)$ is

 d=|Ax1+By1+C|A2+B2−−−−−−−√

### Concurrent lines

Three lines

 A1x+B1y+C1A2x+B2y+C2A3x+B3y+C3=0=0=0

are concurrent if and only if:

 ∣∣∣∣A1A2A3B1B2B3C1C2C3∣∣∣∣=0

### Line segment

A line segment P1P2$P_1P_2$ can be represented in parametric form by

 xy=x1+(x2−x1)t=y1+(y2−y1)t0≤t≤1

Two line segments P1P2$P_1P_2$ and P3P4$P_3P_4$ intersect if any only if the numbers

 s=∣∣∣x2−x1x3−x1y2−y1y3−y1∣∣∣∣∣∣x2−x1x3−x4y2−y1y3−y4∣∣∣  and  t=∣∣∣x3−x1x3−x4y3−y1y3−y4∣∣∣∣∣∣x2−x1x3−x4y2−y1y3−y4∣∣∣

satisfy 0s1$0 \leq s \leq 1$ and 0t1$0 \leq t \leq 1$.