2.1 Linear Functions

1. Basic Notions on Coordinate Geometry

Given two points $A(x_1,y_1)$ and $B(x_2,y_2)$ on a Cartesian plane, the change in $x$ is called the run, and the change in $y$ is called the rise: $$\Delta x=x_2-x_1,\qquad \Delta y=y_2-y_1.$$

The gradient, or slope, of the line segment $AB$ is $$m=\dfrac{\Delta y}{\Delta x}=\dfrac{y_2-y_1}{x_2-x_1},\qquad x_1\neq x_2.$$

The slope indicates the inclination of the line. Moving in the positive direction of the $x$-axis:

  • If the line is increasing, then $m>0$.
  • If the line is decreasing, then $m<0$.
  • If the line is horizontal, then $m=0$.
  • If the line is vertical, then $m$ is undefined.
  • The slope also satisfies $m=\tan\theta$, where $\theta$ is the angle between the line and the positive $x$-axis.
Distance between two points: $$d_{AB}=\sqrt{(\Delta x)^2+(\Delta y)^2} =\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}.$$
Midpoint of a line segment: If $M(x,y)$ is the midpoint of $AB$, then $$x=\dfrac{x_1+x_2}{2},\qquad y=\dfrac{y_1+y_2}{2}.$$ Therefore, $$M\left(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2}\right).$$

EXAMPLE 1

For each pair of points, find the slope, distance, and midpoint.

(a) Given $A(1,4)$ and $B(7,12)$: $$ m=\dfrac{12-4}{7-1} =\dfrac{8}{6} =\dfrac{4}{3}. $$ $$\begin{aligned} d_{AB} &=\sqrt{(7-1)^2+(12-4)^2}\\ &=\sqrt{6^2+8^2}\\ &=\sqrt{36+64}\\ &=10. \end{aligned}$$ $$M\left(\dfrac{1+7}{2},\dfrac{4+12}{2}\right)=M(4,8).$$
(b) Given $A(1,8)$ and $B(5,8)$:
  • The $y$-coordinates are equal, so the line is horizontal.
  • The slope is $m=0$.
  • The distance is $d=5-1=4$.
  • The midpoint is $M(3,8)$.
(c) Given $A(1,5)$ and $B(1,7)$:
  • The $x$-coordinates are equal, so the line is vertical.
  • The slope is undefined.
  • The distance is $d=7-5=2$.
  • The midpoint is $M(1,6)$.

2. The Equation of a Line

A straight line can be written in slope-intercept form as $$y=mx+c,$$ where $m$ is the gradient, or slope, and $c$ is the $y$-intercept.

  • $m$ controls the steepness and direction of the line.
  • $c$ is the $y$-intercept, so the graph crosses the $y$-axis at $(0,c)$.
  • A horizontal line has equation $y=c$ and slope $m=0$.
  • A vertical line has equation $x=c$ and has no slope.
  • A vertical line is not a function of $x$, so it is not a special case of $y=mx+c$.

EXAMPLE 2

Look at the graphs of $$L_1:y=2x,\qquad L_2:y=-2x.$$

Line $L_1$ has slope $2$, so $y$ increases by $2$ units for every $1$ unit increase in $x$.
Line $L_2$ has slope $-2$, so $y$ decreases by $2$ units for every $1$ unit increase in $x$.
Both lines pass through the origin, so in both cases $c=0$.

EXAMPLE 3

Look at the graphs of $$L_1:y=2x+3,\qquad L_2:y=-2x+3.$$

Line $L_1$ has slope $2$.
Line $L_2$ has slope $-2$.
Both lines have $y$-intercept $3$, so both pass through $(0,3)$.

EXAMPLE 4

Look at the graphs of $$L_1:y=5,\qquad L_2:x=5.$$

The line $y=5$ is horizontal and has slope $0$.
The line $x=5$ is vertical and has undefined slope.

3. Parallel and Perpendicular Lines

Consider two lines $$L_1:y=m_1x+c_1,\qquad L_2:y=m_2x+c_2.$$

  • Parallel lines: $$L_1\parallel L_2\quad\Longleftrightarrow\quad m_1=m_2.$$ Example: $$y=3x+5\qquad\text{and}\qquad y=3x+8$$ are parallel.
  • Perpendicular lines: $$L_1\perp L_2\quad\Longleftrightarrow\quad m_1m_2=-1.$$ Equivalently, $$m_2=-\dfrac{1}{m_1},\qquad m_1\neq 0.$$ Example: $$y=3x+5\qquad\text{and}\qquad y=-\dfrac{1}{3}x+8$$ are perpendicular.

EXAMPLE 5

Compare the following pairs of lines.

(a) $$y=3x+5,\qquad y=3x+8.$$ Both lines have slope $3$, so the lines are parallel.
(b) $$y=3x+5,\qquad y=-\dfrac{1}{3}x+8.$$ The slopes are $3$ and $-\dfrac{1}{3}$, and $$3\left(-\dfrac{1}{3}\right)=-1.$$ Therefore, the lines are perpendicular.

4. Alternative Formula: General Form

A straight line can also be written in the general coordinate form $$Ax+By=C.$$ In this form, $A$, $B$, and $C$ are usually taken to be integers.

  • If $B\neq 0$, then we can solve for $y$ and obtain the usual form $y=mx+c$.
  • If $B=0$, then $Ax=C$, so $$x=\dfrac{C}{A}.$$ This is a vertical line.
  • If $A=0$, then $By=C$, so $$y=\dfrac{C}{B}.$$ This is a horizontal line.
Form Equation Main use
Slope-intercept form $y=mx+c$ Read the slope and $y$-intercept quickly.
General form $Ax+By=C$ Use integer coefficients and include vertical lines.
Point-slope form $y-y_0=m(x-x_0)$ Use when a point and slope are known.

EXAMPLE 6

Convert between general form and slope-intercept form.

(a) Express $2x+3y=5$ in the usual form $y=mx+c$. $$ 2x+3y=5 \implies 3y=-2x+5 \implies y=-\dfrac{2}{3}x+\dfrac{5}{3}. $$
(b) Express $y=-3x+7$ in general form. $$ y=-3x+7 \implies 3x+y=7. $$
(c) Express $y=\dfrac{1}{2}x+\dfrac{2}{3}$ in general form with integer coefficients. $$ y=\dfrac{1}{2}x+\dfrac{2}{3} \implies -\dfrac{1}{2}x+y=\dfrac{2}{3} \implies -3x+6y=4. $$
(d) Express $y=5$ and $x=5$ in general form. $$y=5\quad\Longleftrightarrow\quad 0x+y=5,$$ and $$x=5\quad\Longleftrightarrow\quad x+0y=5.$$

5. Given a Point and a Slope

The line passing through a point $P(x_0,y_0)$ with slope $m$ is given by the point-slope formula: $$y-y_0=m(x-x_0).$$

EXAMPLE 7

Find the equation of the line passing through $P(1,2)$ with slope $m=3$.

Using point-slope form: $$y-2=3(x-1).$$
Convert to slope-intercept form: $$\begin{aligned} y-2&=3(x-1)\\ y-2&=3x-3\\ y&=3x-1. \end{aligned}$$
Convert to general form: $$ y=3x-1 \implies 3x-y=1. $$ Equivalently, $$3x-y-1=0.$$

6. Given Two Points

The line passing through two distinct points $P(x_1,y_1)$ and $Q(x_2,y_2)$ has slope $$m=\dfrac{y_2-y_1}{x_2-x_1},\qquad x_1\neq x_2.$$ Its equation is then found using $$y-y_1=m(x-x_1).$$

Special cases:

  • If $x_1=x_2$, the line is vertical and has equation $x=x_1$.
  • If $y_1=y_2$, the line is horizontal and has equation $y=y_1$.

EXAMPLE 8

Find the line passing through $P(1,2)$ and $Q(4,7)$. Express your answer in the form $ax+by=c$, where $a,b,c\in\mathbb{Z}$.

First find the slope: $$m=\dfrac{7-2}{4-1}=\dfrac{5}{3}.$$
Use point-slope form with $P(1,2)$: $$y-2=\dfrac{5}{3}(x-1).$$
Convert to general form: $$\begin{aligned} y-2&=\dfrac{5}{3}(x-1)\\ 3(y-2)&=5(x-1)\\ 3y-6&=5x-5\\ -5x+3y&=1. \end{aligned}$$
Therefore, the equation is $$-5x+3y=1.$$

EXAMPLE 9 (Horizontal and Vertical Cases)

(a) Find the line passing through $A(3,5)$ and $B(3,-2)$.
  • The $x$-coordinates are equal: $x_1=x_2=3$.
  • The slope is undefined because $$\dfrac{-2-5}{3-3}=\dfrac{-7}{0}.$$
  • Therefore, the line is vertical: $$x=3.$$
(b) Find the line passing through $C(-4,6)$ and $D(8,6)$.
  • The $y$-coordinates are equal: $y_1=y_2=6$.
  • The slope is $$m=\dfrac{6-6}{8-(-4)}=\dfrac{0}{12}=0.$$
  • Therefore, the line is horizontal: $$y=6.$$