B Binance · The world's largest crypto exchangeBinance Sign up → AD OKX OKX · A leading global crypto exchangeOKX Sign up → AD
📐 Math Basics · Lesson 4 / 10

Functions and Graphs: An Eye for Change

A function is a rule that assigns exactly one output to each input, and the slope of a linear function is "how much the output changes when the input goes up by 1." Get hold of these two ideas, and graphs start talking to you.

⏱ About 18 min ✍️ 4 practice questions 🔁 Unlimited drills Updated 2026-10-08
🎯 By the end of this lesson you can
  • Explain what a function is in terms of inputs and outputs
  • Find the slope and y-intercept of a linear function in its equation and graph, and say what they mean
  • Find the equation of the line through two points
  • Find where two graphs intersect and judge which option is better

1.Functions: One Output for Each Input

Press button 1 on a vending machine and you always get the same drink. A relationship like this, where choosing one input x settles exactly one output y, is called a function. "Distance traveled by taxi → fare," "hours studied → predicted test score," and "temperature → predicted ice cream sales" are all relationships that can be expressed as functions.

On the other hand, if one input has several outputs, it is not a function. "Person aged 30 → that person's height" is not a function, because there are many 30-year-olds and their heights all differ. To decide whether something is a function, ask: "Does the same input always give the same output?"

Broadly speaking, an AI model is also a giant function. You input a sentence or a photo, and it outputs an answer or a classification. We'll come back to this view in Lesson 10.

2.The Linear Function y = ax + b

The simplest and most commonly used function is the linear function. It has the form y = ax + b, and its graph is a straight line. a is called the slope, and b the y-intercept.

The y-intercept b is the value of y when x = 0, that is, the height at which the graph meets the y-axis. For a phone plan, it is the base fee you pay even if you use nothing. The slope a tells you how much y changes when x goes up by 1. For a phone plan, it is the extra charge per 1GB. If a is positive, the line rises to the right; if a is negative, it falls to the right; and the larger its absolute value, the steeper the line.

Making a table for y = 2x + 1 shows the meaning of slope at a glance. Every time x goes up by 1, y always goes up by 2.

Slope = (change in y) ÷ (change in x)
y = 2x + 1 → slope 2, y-intercept 1
Values of y = 2x + 1
x0123
y1357

3.Finding the Equation from Two Points

Two points are enough to pin down a single straight line. First find the slope between the two points, then plug one point into the equation to find b. When you "find the speed of change from values at two points in time" in real data, this is exactly the calculation you are doing.

ExampleFind the equation of the line through the points (1, 5) and (4, 11).
  1. Step 1: Slope: (11 − 5) ÷ (4 − 1) = 6 ÷ 3 = 2.
  2. Step 2: Plug the point (1, 5) into y = 2x + b: 5 = 2 × 1 + b, so b = 3.
  3. Step 3: The equation is y = 2x + 3.
  4. Check: Plug in the other point (4, 11). 2 × 4 + 3 = 11, which is correct.
Answery = 2x + 3
ExampleA water tank holding 200 L of water loses 8 L of water every 1 minute. Write an equation for the amount of water y left after x minutes, and find when the tank will be empty.
  1. Step 1: The starting amount (when x = 0) is 200, so the y-intercept is 200.
  2. Step 2: It decreases by 8 L every 1 minute, so the slope is −8. The equation is y = −8x + 200.
  3. Step 3: The tank is empty when y = 0: 0 = −8x + 200, 8x = 200, x = 25.
  4. Check: In 25 minutes, 8 × 25 = 200 L drains out, the same as the starting amount.
Answery = −8x + 200; it is empty after 25 minutes
The point where a graph meets the x-axis (y = 0) is called the x-intercept. Questions like "When does it reach 0?" or "When is it all used up?" are usually asking for the x-intercept.

4.When the Slope Is Negative or a Fraction

Even when the slope is not a whole number, the method is the same. But mistakes with signs and fractions are common, so subtract in the same order for both coordinates, and always check with the other point at the end.

A slope of −2/3 means "when x goes up by 3, y goes down by 2." Reading a fractional slope this way, as "how many squares you move up or down for so many squares across," makes the graph easy to draw. With a slope of 1/2, you go up 1 square for every 2 squares to the right; with a slope of −3, you go down 3 squares for every 1 square to the right.

ExampleFind the equation of the line through the points (−2, 7) and (4, 3).
  1. Step 1: Slope: (3 − 7) ÷ (4 − (−2)) = −4 ÷ 6 = −2/3.
  2. Step 2: Plug the point (−2, 7) into y = −2/3 x + b: 7 = (−2/3) × (−2) + b = 4/3 + b.
  3. Step 3: b = 7 − 4/3 = 21/3 − 4/3 = 17/3.
  4. Check: Plugging in the other point (4, 3) gives (−2/3) × 4 + 17/3 = −8/3 + 17/3 = 9/3 = 3, which is correct.
Answery = −2/3 x + 17/3
As long as you subtract in the same order for both coordinates, the slope is the same no matter which point you put first. (7 − 3) ÷ (−2 − 4) = 4 ÷ (−6) = −2/3.

5.Intersections: Where Two Options Are Equal

The point where two lines meet is where the two equations give the same value. Seen on a graph, solving the systems of equations from Lesson 3 is exactly the job of finding this intersection. In everyday life, it tells you "from what point the other option becomes the better deal."

ExamplePlan A costs $30,000 a month regardless of how much data you use, and Plan B has a $10,000 base fee plus $2,500 per 1GB. From how many GB on is Plan A the better deal?
  1. Step 1: Write the equations: A is y = 30,000, and B is y = 2,500x + 10,000 (x in GB).
  2. Step 2: Where they are equal: 2,500x + 10,000 = 30,000 → 2,500x = 20,000 → x = 8.
  3. Step 3: If you use less than 8GB, B is cheaper; if you use more than 8GB, A is cheaper. At exactly 8GB, they are the same.
  4. Check: At 8GB, B = 2,500 × 8 + 10,000 = $30,000, the same as A. At 6GB, B is $25,000, and at 10GB, B is $35,000, which agrees with the conclusion.
AnswerIf you use more than 8GB, Plan A is the better deal

6.Reading Graphs: Slope Is Speed

When you look at a graph, first check what the two axes are and what their units are. Then read the slope. If the horizontal axis is time and the vertical axis is distance, the slope is speed. If the horizontal axis is usage and the vertical axis is cost, the slope is the unit price. The slope's unit is "vertical-axis unit ÷ horizontal-axis unit," as in km/h or $/GB.

Real-world graphs are usually not perfectly straight. Even so, if you zoom in on a short stretch, it looks like a straight line, and the slope of that stretch is the rate of change at that moment. If the slope keeps getting bigger, the change is speeding up; if the slope gets close to 0, the change is coming to a stop. This idea of "the slope at a single point" leads into gradient descent in Lesson 10.

  • Read the axis names and units first
  • Put the y-intercept (starting value) and the slope (rate of change) into words, one at a time
  • If there is a point where the slope changes, find out what changed
  • Don't casually extend the line beyond the range of the graph; there's no guarantee the relationship stays a straight line

📌 Key points

  • A function is a relationship in which each input settles exactly one output
  • In the linear function y = ax + b, a is the slope (change per 1 unit) and b is the y-intercept (starting value)
  • Slope = change in y ÷ change in x, and its unit is "vertical-axis unit / horizontal-axis unit"
  • Given two points, find the slope, then plug in one point to find b
  • The intersection of two lines is the point where the two options have the same value

✍️ Practice questions

Answer first, then open "Answer and explanation".

Q1. What is the slope of the line through the two points (2, 3) and (6, 11)?

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ② 2

(11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2. Reversing the order, (3 − 11) ÷ (2 − 6) = (−8) ÷ (−4), still gives 2.

Q2. Find the x-coordinate of the point where the graph of y = −2x + 6 meets the x-axis (the x-intercept).

Answer and explanation
Answer 3

Setting y = 0 gives 0 = −2x + 6, 2x = 6, x = 3. Check: −2 × 3 + 6 = 0.

Q3. If a taxi fare is simplified to y = 1,000x + 4,000 (x in km), what does 1,000 mean? (This is a made-up fare for illustration.)

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ② The fare increase per 1km

The coefficient of x, 1,000, is the slope: the fare goes up by $1,000 when the distance goes up by 1km. 4,000 is the y-intercept and corresponds to the base fare.

Q4. Which of these relationships is not a function?

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ④ A person weighing 60kg → that person's height

Many people weigh 60kg, and their heights differ, so the same input has several outputs. In the others, once the input is set, the output is settled as exactly one value.

🔁 Unlimited practice

Problems are generated endlessly. Type your answer and press "Check" to have it graded right away, or press "Show solution" to see a step-by-step solution in the same order as the lesson. You can choose the difficulty, and your streak of correct answers is counted.

  • Slope and y-intercept of the line through two points
  • x-intercept (the x where y = 0)
  • From medium up: the intersection of two lines
  • Hard: lines with a fractional slope

These drills are generated in your browser with JavaScript, which is not running right now. Use the examples and practice questions above, then reopen this page with JavaScript turned on.

🤖 Try asking AI like this

Copy a prompt and replace the [ ] parts with your own situation. Don't take the answer on trust — check it against this lesson.

When weighing which of two options is better

Plan A is [terms], and Plan B is [terms]. Write each one as an equation of the form y = ax + b, and show me, with the calculation, where the two equations are equal. Also make a table that plugs in one value before and one after that point to confirm which plan is cheaper.

When practicing interpreting graphs in words

Make 3 situations with made-up data where something changes over time as a linear function. For each one, show me only a table. I'll find the slope and y-intercept and explain what they mean in words, and you grade whether I'm right.
References
  • Standard middle school math textbook content (functions, linear functions and their graphs)

Reached every goal above? Mark the lesson complete.

📐 Math Basics

  1. 1Numbers and Operations: Fractions and Decimals Revisited
  2. 2Ratios and Rates: Reading Percentages Correctly
  3. 3Equations: A Balance for Finding Unknown Numbers
  4. 4Functions and Graphs: An Eye for Change
  5. 5Exponents and Logarithms: A World That Grows by Multiplying
  6. 6Geometry Basics: Area and Pythagoras
  7. 7Probability: Putting Numbers on Uncertainty
  8. 8Statistics: Mean, Median, and Variance
  9. 9Reading Data: The Traps in Graphs
  10. 10The Math for Understanding AI
📚 Worth reading
🧠What Generative AI Does and Where It Fails→ ✍️How to Write a Good Prompt→ 🔍Checking AI Answers→ 📚Using AI for Study and Work Without Plagiarism→
← Foundations for the AI Era