A linear function is a function whose graph is a straight line. You can write it as f(x) = mx + b, where m is the slope, or constant rate of change, and b is the y-intercept. Each time x increases by 1, the output changes by the same amount, m.
In Spanish
función lineal
Also called
linear relationship, straight-line function, first-degree function
The same constant change shows up twice: in the table the outputs go up by 2 each row, and on the graph every run of 1 has a rise of 2. That constant rate is what makes the graph a straight line.
Formal definition and notation
A functionf is linear if it can be written as f(x) = mx + b for constants m and b and every real numberx. Equivalently, equal changes in the input always give equal changes in the output: f(x2) − f(x1)x2 − x1 = m for any inputs x1 ≠ x2. If m > 0 the function is increasing, if m < 0 it is decreasing, and if m = 0 it is the constant function f(x) = b. A vertical line x = a fails the vertical line test, so it is not a linear function.
Symbol
Read it as
Meaning
f(x)
f of x
the output of the function f for the input x; it plays the role of y
m
m
the slope: the change in output for each 1-unit increase in input
b
b
the y-intercept, or initial value: the output when x = 0
Key facts
In a table with equally spaced inputs, the outputs change by the same amount every step. For f(x) = 3x − 2 and x = 0, 1, 2, 3: −2, 1, 4, 7.
The highest power of x is 1. Functions like f(x) = x2 or f(x) = 1x are not linear.
m > 0: the line rises left to right. m < 0: it falls. m = 0: it is flat (a constant function).
Linear functions model a fixed start plus a constant rate: a taxi ride that costs 3 dollars plus 2 dollars per mile is f(x) = 2x + 3.
Linear function formula
Linear function formula
f(x) = mx + b
x
the input (independent variable)
f(x)
the output (dependent variable)
m
the slope, m = y2 − y1x2 − x1 for any two points on the line
b
the starting value, where the line crosses the y-axis at (0, b)
To build the function from two points, find m first, then substitute one point into y = mx + b and solve for b. In a table, b is the output in the row where x = 0.
Try it: feed the machine
Interactive
This machine runs the linear function f(x) = 3x − 2. Type more inputs, such as 4, 5 or −1, and press Run. Check that the outputs change by 3 for every step of 1 in the input.
This interactive needs JavaScript. The worked examples below show the same ideas step by step.
Linear Function examples, step by step
Example 1: Evaluate a linear function
Warm-up
For f(x) = 4x − 7, find f(5).
Replace x with 5: f(5) = 4(5) − 7.
Multiply first: 4 × 5 = 20.
Subtract: 20 − 7 = 13.
Answer:f(5) = 13.
Example 2: Write the function from two points
Core
A linear function passes through (2, 5) and (6, −3). Write it in the form f(x) = mx + b.
Check with the other point: −2(6) + 9 = −3. Correct.
Answer:f(x) = −2x + 9.
Example 3: A linear model with a starting fee
Test-style
A gym charges a 50-dollar sign-up fee plus 25 dollars per month. Write the total cost C as a function of the number of months m. How much do 8 months cost, and after how many months will the total reach 375 dollars?
The fee is the starting value and 25 is the rate: C(m) = 25m + 50.
For 8 months: C(8) = 25(8) + 50 = 200 + 50 = 250.
Set the cost to 375: 25m + 50 = 375.
Subtract 50: 25m = 325. Divide by 25: m = 13.
Answer:C(m) = 25m + 50. Eight months cost 250 dollars, and the total reaches 375 dollars after 13 months.
Common mistakes
✗ MistakeReading the slope of f(x) = 4 + 3x as 4.
✓ InsteadThe slope is the number multiplied by x: m = 3, and b = 4.
The order of the terms does not matter. The slope is always the coefficient of x.
✗ MistakeCalling a table linear because the outputs keep increasing: x = 0, 1, 2, 3 gives 1, 2, 4, 8.
✓ InsteadThe changes are +1, +2, +4. They are not equal, so the function is not linear (it doubles each time).
Linear means the change is constant, not just that the outputs go up.
✗ MistakeWith inputs 0, 1, 3 and outputs 2, 5, 8, saying the rate is 3 because each output goes up by 3.
✓ InsteadDivide by the input change: 5 − 21 − 0 = 3 but 8 − 53 − 1 = 1.5. The rates differ, so the function is not linear.
The rate of change is change in output divided by change in input. When the input steps are not equal, you must divide.
✗ MistakeCalling the vertical line x = 3 a linear function.
✓ Insteadx = 3 is a line, but not a function: the input 3 has infinitely many outputs.
A function gives each input exactly one output, so a vertical line fails the vertical line test.
A linear equation is any equation whose graph is a line, such as 2x + 3y = 6 or x = 4. A linear function is a rule f(x) = mx + b that gives one output per input, so vertical lines are left out.
Slope-intercept form, y = mx + b, is one way to write a linear function. The same function can also be written in point-slope or standard form.
Linear Functionvs.Nonlinear function
A nonlinear function has a graph that curves, because its rate of change is not constant. f(x) = x2 gives 0, 1, 4, 9, with changes 1, 3, 5.
Quick check: 3 questions
Question 1 of 3
Which function is linear?
Show answer and explanation
Answer: B.f(x) = 5 − 2x is mx + b with m = −2 and b = 5. The others have x squared, x as an exponent, or x in a denominator, so their graphs curve.
Question 2 of 3
A table shows x = 0, 1, 2, 3 and outputs 7, 4, 1, −2. Which function matches?
Show answer and explanation
Answer: D. The outputs drop by 3 each step, so m = −3, and the output at x = 0 is 7, so b = 7. The other choices flip the sign, swap m and b, or use the last output as b.
Question 3 of 3
A linear function has f(0) = 4 and f(2) = 10. What is f(5)?
Show answer and explanation
Answer: A. The slope is 10 − 42 − 0 = 3 and b = 4, so f(5) = 3(5) + 4 = 19. 25 treats 10 for 2 as proportional, 15 forgets the starting value 4, and 14 just adds 4 and 10.
Linear Function: frequently asked questions
How can you tell if a function is linear?
Look for a constant rate of change. In an equation, the function is linear if it can be written as f(x) = mx + b, with no x2, no x in an exponent and no x in a denominator. In a table, the outputs change by the same amount for equal input steps. On a graph, the points lie on one straight, non-vertical line.
Is a linear function the same as a linear equation?
Not quite. Every linear function f(x) = mx + b gives a linear equation y = mx + b. But some linear equations are not functions: the vertical line x = 4 gives the input 4 infinitely many outputs. So linear functions are the linear equations whose graphs are not vertical lines.
Is a horizontal line a linear function?
Yes. A horizontal line such as f(x) = 6 is mx + b with slope m = 0 and b = 6. It is called a constant function because every input gives the same output, 6. A vertical line is different: it is not a function at all, because one input has many outputs.
Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS 8.F.A.3, CCSS 8.F.B.4, CCSS HSF-LE.A.1.b
Cite this entry
Effortless Math Team. “Linear Function.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/linear-function/
Flashcard
TermLinear Functionf(x) = mx + b
DefinitionA function whose graph is a straight line; the output changes by the same amount m for each 1-unit step in x. Example: f(x) = 2x + 1.
FunctionA function is a rule that gives exactly one output for each input. If you put in one x-value, a function gives back one y-value. In f(x) = 2x + 1, the input 3 gives the output 7. Two inputs may share an output, but one input can never have two different outputs.Functions · Grade 8, Algebra 1, Algebra 2Real NumberA real number is any number that can be placed on the number line. The real numbers are all the rational numbers (fractions, integers, terminating and repeating decimals) together with all the irrational numbers (such as √2 and π). Square roots of negative numbers, like √−4, are not real.Number System · Grade 8, Algebra 1Vertical Line TestThe vertical line test is a way to tell from a graph whether it shows a function: if any vertical line crosses the graph more than once, it is not a function. If every vertical line crosses it at most once, each input x has only one output y, so the graph is a function.Functions · Grade 8, Algebra 1, Algebra 2SlopeSlope is a number that measures how steep a line is: the change in y divided by the change in x between any two points on the line, often called rise over run. A positive slope rises from left to right, a negative slope falls, and a horizontal line has slope 0.Algebra · Grade 8, Algebra 1Y-InterceptThe y-intercept is the point where a graph crosses the y-axis. Every point on the y-axis has x = 0, so you find the y-intercept by putting x = 0 into the equation. In y = mx + b, the y-intercept is b, written as the point (0, b).Algebra · Grade 8, Algebra 1PowerA power is a number written as a base with an exponent, such as 53, or the value that results, 53 = 5 × 5 × 5 = 125. We say 125 is the third power of 5, or “5 to the third power”. The second power is called the square and the third power the cube.Number System · Grade 5, Grade 6, Grade 7Proportional RelationshipA proportional relationship is a relationship between two quantities in which one is always the same multiple of the other, so y = kx for a fixed number k. The ratio yx is the same for every pair, and the graph is a straight line through the origin. Example: at 3 dollars per pound, cost = 3 × pounds.Ratios and Proportions · Grade 7, Grade 8, Algebra 1OriginThe origin is the point where the x-axis and the y-axis cross on the coordinate plane. Its coordinates are (0, 0), and it is labeled O. Every ordered pair tells how far to move from the origin: (4, 3) means 4 units right, then 3 units up.Geometry · Grade 5, Grade 6, Grade 8Constant of ProportionalityThe constant of proportionality is the constant ratio between two proportional quantities, k = yx. It is the k in y = kx and stays the same for every pair of values, which makes the graph a straight line through the origin. If 3 notebooks cost 9 dollars, k = 3 dollars per notebook.Ratios and Proportions · Grade 7, Grade 8, Algebra 1MileA mile (mi) is a US customary unit of length for long distances, equal to 5,280 feet or 1,760 yards. One mile is about 1.61 kilometers, so it is longer than a kilometer. Road distances and speed limits in the United States use miles and miles per hour.Measurement · Grade 4, Grade 5, Grade 6SubstituteSubstitute means to replace a variable with a number or with an equal expression. In 4x − 1, substituting 3 for x gives 4(3) − 1. You substitute to evaluate expressions, to check whether a number is a solution, and to solve systems of equations by swapping in an equal expression.Algebra · Grade 6, Grade 7, Grade 8NumberA number is an amount or value used to count, measure, order and compare. We write numbers with digits (7), words (seven) or other symbols, but the number itself is the amount: 7 dots, the word seven and the numeral 7 all show the same number. Numbers include whole numbers, fractions, decimals and negatives.Number System · Kindergarten, Grade 1, Grade 2CoefficientA coefficient is the number multiplied by a variable in a term. In 4a the coefficient is 4, in −3x it is −3, and in x it is 1, because x = 1x. The sign in front belongs to the coefficient. A number standing alone, with no variable, is a constant instead.Algebra · Grade 6, Grade 7, Grade 8Rate of ChangeA rate of change tells how much an output changes for each 1-unit change in the input: the change in y divided by the change in x. If a phone plan costs 15 dollars more for every extra hour, its rate of change is 15 dollars per hour. For a straight line, the rate of change equals the slope.Functions · Grade 8, Algebra 1, Algebra 2Linear EquationA linear equation is an equation whose graph is a straight line. In one variable, it usually has a variable to the first power, like 3x + 2 = 14. In two variables, it can be written in forms like y = mx + b, where m is the slope. No variable is squared, multiplied by another variable or in a denominator.Algebra · Grade 7, Grade 8, Algebra 1Slope-Intercept FormSlope-intercept form is the linear equation form y = mx + b, where m is the slope and b is the y-intercept. You can read both values directly from the equation without rearranging: in y = 2x + 5, the slope is 2 and the line crosses the y-axis at (0, 5).Algebra · Grade 8, Algebra 1Standard FormStandard form of a number is the usual way of writing it with digits, such as 4,306, with each digit in its place-value position. It is the short form you get from expanded form (4,000 + 300 + 6) or from word form (four thousand, three hundred six). Zeros hold any empty places.Number System · Grade 2, Grade 3, Grade 4ExponentAn exponent tells how many times to use a base as a factor. It is the small raised number to the upper right of the base: in 53, the base is 5 and the exponent is 3, so 53 = 5 × 5 × 5 = 125. Any nonzero number with an exponent of 0 equals 1.Algebra · Grade 6, Grade 7, Grade 8System of EquationsA system of equations is a set of two or more equations that use the same variables and are solved together. Its solution is the values that make every equation true at the same time. For two linear equations, that is the point where the two lines cross. A system can have one solution, none, or infinitely many.Algebra · Grade 8, Algebra 1Mathematical ModelA mathematical model represents a real situation using numbers, equations, diagrams, or graphs, well enough to make predictions. The equation C = 15 + 9m can model the cost of a subscription after m months. Every model simplifies, and knowing what a model leaves out is as important as knowing what it includes.Problem Solving · Grade 6, Grade 7, Grade 8Arithmetic SequenceAn arithmetic sequence is a list of numbers in which you add the same amount each time to get the next term. That fixed amount is the common difference, d. In 4, 7, 10, 13, … the common difference is 3. The nth term is an = a1 + (n − 1)d.Functions · Grade 8, Algebra 1, Algebra 2Point-Slope FormPoint-slope form is a way to write the equation of a line from its slope m and one point (x1, y1) on it: y − y1 = m(x − x1). It is the fastest form to use when you know a point and the slope, or two points. Multiplying it out gives slope-intercept form.Algebra · Grade 8, Algebra 1