What Makes a Linear Function: Equation and Graph

A linear function is any function that produces a straight line when graphed and changes at a constant rate. In its most common form, it’s written as y = mx + b, where m is the slope (how steep the line is) and b is the y-intercept (where the line crosses the vertical axis). If a function meets these criteria, it’s linear. If the graph curves at any point, it’s not.

The Constant Rate of Change

The single most important feature of a linear function is that it changes by the same amount during every equal interval. If you earn $15 per hour, your total pay after 1 hour is $15, after 2 hours is $30, after 3 hours is $45. The increase is always $15 per hour, no matter where you are on the timeline. That constant increase is what makes the relationship linear.

This constant rate of change is the slope, calculated as rise divided by run. Pick any two points on the line, measure how much the output changes (the rise) and divide it by how much the input changes (the run). For a linear function, you’ll get the same number no matter which two points you choose. The moment that ratio starts changing between different pairs of points, you’re dealing with a curve, not a line.

The Standard Equation: y = mx + b

Most linear functions are written in slope-intercept form: y = mx + b. Here, m tells you the slope and b tells you where the line crosses the y-axis. For example, in the function y = 2x + 3, the slope is 2 (the output increases by 2 for every 1-unit increase in x) and the line crosses the y-axis at the point (0, 3).

A positive slope means the line angles upward from left to right. A negative slope means it angles downward. The larger the absolute value of the slope, the steeper the line. So y = 5x + 1 is much steeper than y = 0.5x + 1, even though both are linear.

There’s also a stricter mathematical definition worth knowing. In pure math, a linear function is specifically f(x) = ax, with no added constant. This version always passes through the origin (0, 0) and satisfies two rules: doubling the input doubles the output, written as f(2x) = 2f(x), and applying the function to a sum of inputs equals the sum of the function applied to each input individually, written as f(x + y) = f(x) + f(y). In algebra classes, though, “linear function” almost always includes the y = mx + b form, which mathematicians technically call an “affine” function.

What the Graph Looks Like

A linear function always produces a perfectly straight line on a coordinate plane. No bends, no curves, no sudden changes in direction. The y-intercept, the point (0, b), is where the line meets the vertical axis. If the equation is y = -3x + 9, for instance, the line crosses the y-axis at (0, 9) and slopes downward with a steepness of 3.

One edge case to watch for: vertical lines like x = 4. These are straight, but they aren’t functions. A vertical line assigns multiple y-values to the same x-value, which fails the vertical line test. Horizontal lines like y = 5, on the other hand, are valid linear functions. They have a slope of zero, meaning the output never changes regardless of the input.

For a typical linear function (one that isn’t horizontal), both the domain and range include all real numbers. You can plug in any value of x and get a valid output, and the line extends infinitely in both directions. A horizontal line like y = 5 still accepts any x-value, but its range is limited to the single value 5.

How to Spot a Non-Linear Function

If the variable has an exponent other than 1, the function isn’t linear. So y = x² + 2 is non-linear because x is squared. The same goes for variables inside a square root (like y = √x) or variables in the denominator (like y = 1/x). Each of these produces a curve rather than a straight line.

You can also check a table of values. If x increases by 1 each row, look at how much y changes between consecutive rows. If that difference is the same every time, the function is linear. If the differences keep changing, it’s not. For example:

  • Linear: x = 1, y = 4; x = 2, y = 7; x = 3, y = 10. The y-value increases by 3 each time.
  • Non-linear: x = 1, y = 1; x = 2, y = 4; x = 3, y = 9. The y-value increases by 3, then 5. That’s y = x².

Linear Functions in Everyday Life

Linear functions show up constantly in practical situations where something changes at a steady rate. A college student who has $3,500 in savings and spends $400 per week has a balance described by f(x) = 3500 – 400x, where x is the number of weeks. The slope is -400 (the balance drops by $400 each week) and the y-intercept is 3,500 (the starting amount).

Loan payoff schedules work the same way when there’s no interest. Someone repaying a $1,000 loan at $250 per month has a balance of f(x) = 1000 – 250x. After 4 months, the balance hits zero. The relationship is perfectly linear because the payment amount never changes.

Comparing costs is another common use. Imagine choosing between two truck rental companies: one charges $20 upfront plus $0.59 per mile, and the other charges $16 upfront plus $0.63 per mile. Each company’s total cost is a linear function of miles driven. Graphing both lines reveals exactly where they cross, telling you the mileage at which one option becomes cheaper than the other.

Business costs follow the pattern too. A doughnut company with $25,000 in fixed expenses and a production cost of $0.25 per doughnut has a total cost function of f(x) = 25000 + 0.25x. Every additional doughnut adds exactly the same amount to the total, keeping the relationship linear no matter how many they produce.

Quick Checklist for Linearity

If you’re trying to determine whether a specific function is linear, run through these checks:

  • Equation check: Every variable should have an exponent of 1. No squares, cubes, roots, or variables in denominators.
  • Graph check: The graph should be a perfectly straight line. Any curve disqualifies it.
  • Table check: Equal increases in x should produce equal changes in y, every single time.
  • Slope check: Calculate the slope between multiple pairs of points. If you get the same value each time, the function is linear.

Any one of these tests is sufficient on its own. If a function passes one, it will pass all of them.