Back to homeMathematics · High School Year 1 · Change subject
Start for free
Prep 1 · Mathematics
Functions · Elementary functions

Linear Functions y = mx + b

Before you start, make sure you know: First-degree equations (Secondary Year 3)
Before you start, make sure you know: Linear and affine functions (Secondary Year 3)

A taxi in Mexico City charges a fixed amount when you get in (the base fare) and then an amount for each kilometer. If you know where you are going, can you work out how much you will pay before you get in? With a linear function, yes. At the end of the page we come back to the taxi.

The linear function y = mx + b

On this page we write $b$ for the y-intercept (some books use $n$). There are three special cases:

  • Direct proportionality: $b = 0$, that is $y = mx$. The line passes through the origin $(0,0)$.

  • Linear function with nonzero y-intercept: $m \neq 0$, $b \neq 0$. It does not pass through the origin.

  • Constant function: $m = 0$, that is $y = b$. A horizontal line.

Why does $b$ matter? If $b=0$, doubling $x$ doubles $y$. If $b\neq 0$, the fixed term does not double, and direct proportionality is lost.

Three lines: one that passes through the origin, one that crosses the Y-axis above the origin, and a horizontal one. y = 0.8x y = 0.5x + 40 y = 70 O

Move the sliders and see what each number does:

Practice★☆☆Not started
Identify the gradient $m$ and the y-intercept $n$ of the following linear functions: a) $y = -4x + 7$ b) $y = \frac{2}{5}x$ c) $y = -3$

Identify the gradient $m$ and the y-intercept $n$ of the following linear functions:

  1. a) $y = -4x + 7$
  2. b) $y = \frac{2}{5}x$
  3. c) $y = -3$
Solve
Practice★☆☆Not started
Write the equation of the line that has a gradient of $5$ and whose y-intercept is $-2$.

Write the equation of the line that has a gradient of $5$ and whose y-intercept is $-2$.

Solve
Practice★☆☆Not started
Classify the following functions into direct proportion (strictly linear) function, linear function (affine function), or constant function: a) $f(x) = 3x - 1$ b)…

Classify the following functions into direct proportion (strictly linear) function, linear function (affine function), or constant function:

  1. a) $f(x) = 3x - 1$
  2. b) $g(x) = \frac{x}{4}$
  3. c) $h(x) = 8$
Solve

Evaluating, belonging to the graph, and intercepts with the axes

Finding the image of $a$ means evaluating $f(a)$: substitute $x$ with $a$. To find for which $x$ we have $f(x)=c$, you solve the equation $mx+b=c$.

A point $P(p, q)$ belongs to the graph if and only if $f(p)=q$: you substitute and compare.

Intercepts with the axes. With the $Y$-axis, $x=0$, so the point is $(0, b)$. With the $X$-axis, $y=0$, and you solve $mx+b=0$.

Practice★☆☆Not started
A taxi fare is given by the function $C(x) = 30x + 60$, where $C(x)$ is the cost in pesos and $x$ is the distance traveled in kilometers. How much will a trip of $8$…

A taxi fare is given by the function $C(x) = 30x + 60$, where $C(x)$ is the cost in pesos and $x$ is the distance traveled in kilometers. How much will a trip of $8$ kilometers cost?

Solve
Practice★☆☆Not started
Calculate the points of intersection with the coordinate axes (x-axis and y-axis) of the line $y = 3x - 12$.

Calculate the points of intersection with the coordinate axes (x-axis and y-axis) of the line $y = 3x - 12$.

Solve
Practice★☆☆Not started
Check algebraically whether the points $A(2, 5)$ and $B(-1, -3)$ lie on the graph of the function $y = 2x + 1$.

Check algebraically whether the points $A(2, 5)$ and $B(-1, -3)$ lie on the graph of the function $y = 2x + 1$.

Solve

Finding the equation of a line

A line is determined by two independent pieces of information: a slope and a point, or two points. A single point is not enough: infinitely many lines pass through it.

Slope from two points. $$m = \frac{y_2 - y_1}{x_2 - x_1}$$ It is the vertical change divided by the horizontal change; if you flip the quotient, you change the steepness.

Slope and one point. Substitute the point into $y = mx + b$ and solve for $b$.

Parallel lines. They have the same slope. For a line parallel to $y=3x-2$ that passes through $(-1, 4)$: $m=3$ and $4 = 3(-1)+b$, so $b=7$.

Parameters. If a point is on the line, substitute it and solve. For example, $y = kx+5$ passes through $(3,-4)$ when $-4 = 3k+5$, that is $k=-3$.

Two lines that intersect. Set the $y$ values equal: from $4x-5 = -2x+7$ we get $6x=12$, $x=2$, and then $y=3$. They intersect at $(2, 3)$.

Practice★☆☆Not started
Find the equation of the line that has gradient $m = -2$ and passes through the point $(1, 4)$.

Find the equation of the line that has gradient $m = -2$ and passes through the point $(1, 4)$.

Solve
Practice★★☆Not started
Find the equation of the line passing through the points $A(-2, 5)$ and $B(4, -7)$.

Find the equation of the line passing through the points $A(-2, 5)$ and $B(4, -7)$.

Solve
Practice★★☆Not started
Find the equation of the line that is parallel to $y = 3x - 2$ and passes through the point $(-1, 4)$.

Find the equation of the line that is parallel to $y = 3x - 2$ and passes through the point $(-1, 4)$.

Solve
Practice★★☆Not started
Determine the value of the parameter $k$ such that the line with equation $y = kx + 5$ passes through the point $(3, -4)$.

Determine the value of the parameter $k$ such that the line with equation $y = kx + 5$ passes through the point $(3, -4)$.

Solve
Practice★★☆Not started
Find algebraically the point of intersection of the lines $y = 4x - 5$ and $y = -2x + 7$. Check that your result matches the point indicated on the following graph.

Find algebraically the point of intersection of the lines $y = 4x - 5$ and $y = -2x + 7$. Check that your result matches the point indicated on the following graph.

X Y ? ?
Solve

From the graph to the equation, and area with the axes

To read a line from a graph, find where it crosses the $Y$-axis (that is $b$) and measure how much $y$ rises or falls for each unit that $x$ advances (that is $m$). Two clear points on the grid also work.

If a line crosses the axes at $(a, 0)$ and $(0, c)$ in the first quadrant, it forms a right triangle with legs $a$ and $c$, and its area is $\dfrac{a\,c}{2}$.

Line that crosses the Y-axis at 3 and the X-axis at 4, forming a right triangle with the axes. (0, 3) (4, 0)

A line that passes through $(0, 5)$ and forms a triangle of area $10$: the vertical leg is $5$, so $\frac{5a}{2}=10$ and $a=4$. It crosses the $X$-axis at $(4, 0)$ and its slope is $\frac{0-5}{4-0}=-\frac54$.

Practice★☆☆Not started
From the following graphical representation, determine the gradient, the y-intercept and the equation of the line.

From the following graphical representation, determine the gradient, the y-intercept and the equation of the line.

X Y 2 −4
Solve
Practice★★☆Not started
Calculate the area of the triangle formed by the line $y = -\frac{3}{4}x + 3$ intersecting the coordinate axes in the first quadrant.

Calculate the area of the triangle formed by the line $y = -\frac{3}{4}x + 3$ intersecting the coordinate axes in the first quadrant.

Solve
Practice★★★Not started
Find the equation of the line that passes through the point $(0, 5)$ and forms a right-angled triangle with the coordinate axes of area $10$ square units in the first…

Find the equation of the line that passes through the point $(0, 5)$ and forms a right-angled triangle with the coordinate axes of area $10$ square units in the first quadrant.

Solve

Modeling with linear functions

When reading a problem, look for two things: what is already there at the start or is paid only once (that is $b$) and what changes per unit (that is $m$). If the quantity decreases, $m$ is negative.

Profit. If the cost is $C(x)$ and the revenue is $R(x)$, the profit is $R(x)-C(x)$. For "profit of at least $G$" you set up $R(x)-C(x)\geq G$ and solve for $x$ (note: this is a linear inequality).

Inverse function. If $y=mx+b$ and you want $x$ as a function of $y$, solve for it: $x = \dfrac{y-b}{m}$. With $L = 15 + 0.2p$ we get $p = \dfrac{L-15}{0.2}$; for $L=22$, $p=35$ g.

Two different rules. When a situation changes rule (for example, a rate with tiers), you write a piecewise function, one linear expression for each tier.

Practice★★☆Not started
A plumber charges $600$ pesos for a call-out fee, plus $300$ pesos for each hour of work. Write the algebraic expression of the function relating the cost to the time…

A plumber charges $600$ pesos for a call-out fee, plus $300$ pesos for each hour of work. Write the algebraic expression of the function relating the cost to the time worked and calculate how much he will charge for a repair taking $3.5$ hours.

Solve
Practice★★☆Not started
A water tank initially contains $800$ liters and is being emptied at a constant rate of $20$ liters per minute. Write the function relating the volume of water in the…

A water tank initially contains $800$ liters and is being emptied at a constant rate of $20$ liters per minute. Write the function relating the volume of water in the tank to the time elapsed and calculate in which minute the tank will be completely empty.

Solve
Practice★★☆Not started
The relationship between temperature in degrees Celsius ($^\circ C$) and degrees Fahrenheit ($^\circ F$) is linear. Water freezes at $0^\circ C$, which is equivalent to…

The relationship between temperature in degrees Celsius ($^\circ C$) and degrees Fahrenheit ($^\circ F$) is linear. Water freezes at $0^\circ C$, which is equivalent to $32^\circ F$, and boils at $100^\circ C$, which is equivalent to $212^\circ F$. Find the linear function to convert degrees Celsius ($x$) to degrees Fahrenheit ($y$).

Solve
Practice★★★Not started
A sneaker factory has monthly fixed costs of $100\,000$ pesos. In addition, producing each pair of sneakers costs $300$ pesos. If the company sells each pair for $800$…

A sneaker factory has monthly fixed costs of $100\,000$ pesos. In addition, producing each pair of sneakers costs $300$ pesos. If the company sells each pair for $800$ pesos, write the cost $C(x)$ and revenue $R(x)$ functions. How many pairs of sneakers must they sell per month to make a profit of at least $40\,000$ pesos?

Solve
Practice★★★Not started
A parking lot charges $50$ pesos for the first hour (or fraction thereof). After the first hour, it charges $1$ peso for each additional minute. Write the piecewise…

A parking lot charges $50$ pesos for the first hour (or fraction thereof). After the first hour, it charges $1$ peso for each additional minute. Write the piecewise function $C(t)$ representing the total cost in pesos as a function of time $t$ in minutes that a vehicle is parked.

Solve
Practice★★★Not started
The length $L$ of an elastic spring, measured in centimeters, is given by the function $L(p) = 15 + 0.2p$, where $p$ is the suspended weight in grams. Find the…

The length $L$ of an elastic spring, measured in centimeters, is given by the function $L(p) = 15 + 0.2p$, where $p$ is the suspended weight in grams. Find the expression for the inverse function $p(L)$ and use it to calculate what weight was suspended if the spring measures exactly $22$ cm.

Solve
Practice★★★Not started
The following graph shows the distance of a cyclist from home as a function of time. Determine the piecewise algebraic expression of the function $d(t)$ and calculate…

The following graph shows the distance of a cyclist from home as a function of time. Determine the piecewise algebraic expression of the function $d(t)$ and calculate the constant speed of the cyclist during the return journey.

t (h) d (km) 2 3 5 40
Solve

Problems with parameters

Sometimes the equation has unknown letters. The idea is always the same: set slopes and y-intercepts equal or substitute a point.

Practice★★★Not started
The line $r$ passes through the points $(1, 2)$ and $(3, 8)$. The line $s$ is parallel to $r$ and its y-intercept is half the y-intercept of $r$. Determine the equation…

The line $r$ passes through the points $(1, 2)$ and $(3, 8)$. The line $s$ is parallel to $r$ and its y-intercept is half the y-intercept of $r$. Determine the equation of the line $s$.

Solve
Practice★★★Not started
Given the lines $y = (2m - 1)x + 5$ and $y = 3x - n$, determine the values of the parameters $m$ and $n$ such that both equations represent exactly the same line…

Given the lines $y = (2m - 1)x + 5$ and $y = 3x - n$, determine the values of the parameters $m$ and $n$ such that both equations represent exactly the same line (coincident lines).

Solve
Practice★★★Not started
Find the values of $a$ and $b$ such that the line $y = ax + b$ simultaneously satisfies two conditions: being parallel to the line $y = \frac{1}{2}x$ and passing through…

Find the values of $a$ and $b$ such that the line $y = ax + b$ simultaneously satisfies two conditions: being parallel to the line $y = \frac{1}{2}x$ and passing through the point of intersection of the lines $y = 2x - 4$ and $y = -x + 5$.

Solve

Summary

See all the exercises in this section