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.
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| y | 1 | 3 | 5 | 7 |
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.
- Step 1: Slope: (11 − 5) ÷ (4 − 1) = 6 ÷ 3 = 2.
- Step 2: Plug the point (1, 5) into y = 2x + b: 5 = 2 × 1 + b, so b = 3.
- Step 3: The equation is y = 2x + 3.
- Check: Plug in the other point (4, 11). 2 × 4 + 3 = 11, which is correct.
- Step 1: The starting amount (when x = 0) is 200, so the y-intercept is 200.
- Step 2: It decreases by 8 L every 1 minute, so the slope is −8. The equation is y = −8x + 200.
- Step 3: The tank is empty when y = 0: 0 = −8x + 200, 8x = 200, x = 25.
- Check: In 25 minutes, 8 × 25 = 200 L drains out, the same as the starting amount.
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.
- Step 1: Slope: (3 − 7) ÷ (4 − (−2)) = −4 ÷ 6 = −2/3.
- Step 2: Plug the point (−2, 7) into y = −2/3 x + b: 7 = (−2/3) × (−2) + b = 4/3 + b.
- Step 3: b = 7 − 4/3 = 21/3 − 4/3 = 17/3.
- Check: Plugging in the other point (4, 3) gives (−2/3) × 4 + 17/3 = −8/3 + 17/3 = 9/3 = 3, which is correct.
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."
- Step 1: Write the equations: A is y = 30,000, and B is y = 2,500x + 10,000 (x in GB).
- Step 2: Where they are equal: 2,500x + 10,000 = 30,000 → 2,500x = 20,000 → x = 8.
- 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.
- 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.
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
🔁 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.
Answer
Type whole numbers, decimals or fractions (e.g. 12, 0.75, 3/4, −2/3, 1 3/4). A fraction answer also counts as a decimal correct to three places. Your streak resets if you look at the solution first or get one wrong; only your best streak is saved, in this browser.
🤖 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.
- Standard middle school math textbook content (functions, linear functions and their graphs)
Reached every goal above? Mark the lesson complete.
Storage is unavailable in this browser, so this lasts only for this page.📐 Math Basics
- 1Numbers and Operations: Fractions and Decimals Revisited
- 2Ratios and Rates: Reading Percentages Correctly
- 3Equations: A Balance for Finding Unknown Numbers
- 4Functions and Graphs: An Eye for Change
- 5Exponents and Logarithms: A World That Grows by Multiplying
- 6Geometry Basics: Area and Pythagoras
- 7Probability: Putting Numbers on Uncertainty
- 8Statistics: Mean, Median, and Variance
- 9Reading Data: The Traps in Graphs
- 10The Math for Understanding AI