← All MathIsland labs
ax+bLinear Function Lab

Two numbers that predict every value still to come.

A $4.80 base fare plus $0.80 per kilometer — can you know the fare for a 12km ride in advance?

A relationship that changes at a constant speed — the linear function.

Experiment

Hands-on experiment

Predict first — base fare $4.80, plus $0.80 per km. What's the fare for 12km?

The meter — drive +1km at a time

So far

0km

Fare

$4.80

Read more — why it exists · insights · common mistakes · formulasExpand ▾

Why

Why does this exist?

Taxi fares, phone plans, car rentals — the structure 'base fee + usage × unit rate' covers half the contracts around us.

The defining feature of this structure is constancy. One more kilometer always costs exactly $0.80 more. No matter where you start, the speed of change never varies.

Compressing that constant change into the single line y = ax + b gives you the linear function. Know just two numbers — a (slope) and b (intercept) — and you can predict infinitely many cases.

Insight

Insights from the video

Slope is the seed of the derivative.

The slope of a linear function is 'how much y changes when x grows by 1'. Start asking that question at a single point on a curve, and you've invented the derivative. Understand linear functions and you understand half of calculus.

Most of the world's contracts are straight lines.

The base-fee-plus-rate structure is common because it's easy to compute and predict. A straight line is the friendliest relationship humans can handle — which is why even complicated curves get approximated by lines first.

Misconception

Common misconceptions

A bigger slope means a bigger y value.

Slope is speed, not size. A plan with a high base fee and a low unit rate (intercept ↑, slope ↓) starts out with the bigger y, but eventually gets overtaken — past the crossing point, the slope decides the winner.

The equation of a line only matters in graph problems.

Currency conversion, choosing a phone plan, budgeting, and even linear regression in machine learning — wherever there's 'change at a constant rate', linear functions are a working decision tool.

Formula

Writing it as math

The two sliders you moved in the pricing experiment are the whole of the linear function.

Standard form of a linear function

a is the slope (fare per km), b is the y-intercept (base fare). Two numbers completely determine one line.

Definition of slope

Pick any two points and this ratio is the same — that's the mathematical expression of 'constant change'.

Crossing point (break-even point)

Where the two plans cost the same. This is the point where the two lines met in the experiment, found with an equation.

In Real Life

Where you meet it in real life

Choosing a plan

High base fee with a cheap rate vs. the opposite — you only need to check one thing: is my usage above or below the crossing point?

Exchange rates and fees

Amount received = rate × foreign currency + fee. A fixed fee (intercept) plus a rate (slope) — the classic linear structure.

Depreciation

Straight-line depreciation means 'the same amount lost every year' — a linear function with a negative slope.

The starting point of machine learning

Linear regression is the problem of finding the a and b that best fit the data. AI's first step stands on the linear function.

Connection

Concepts connect

Previous concept

f(x)

Functions

Learn the input-output language of functions first, and the linear function is simply the most basic rule of all.

← Functions lab

Leads to next

Quadratic Functions

What if the assumption of constant change breaks? A world where the rate of change itself changes — the curve of a thrown ball awaits.

Go to the Quadratic Functions lab →