Linear Function Calculator

Find slope, intercepts, equation, and values for a linear function. This educational calculator shows the formula, result, and step-by-step interpretation.

High SchoolAlgebraFunctions

Calculator

What this calculator teaches

Linear functions are the foundation for algebra, graphing, rates of change, and modeling.

Use the result as a learning aid. For classwork, still show the formula and intermediate reasoning so the final answer is not just a black-box number.

From Two Points to a Complete Linear Function

A nonvertical line is determined by two points with different x-coordinates. The slope m = (y2 − y1)/(x2 − x1) measures the change in y per unit change in x. Once m is known, substitute either original point into y = mx + b to obtain the y-intercept b = y1 − mx1.

The equation y = mx + b then answers several questions at once. Evaluating the function means substituting a requested x. The y-intercept occurs at x = 0, so its coordinate is (0,b). If m ≠ 0, the x-intercept occurs where y = 0, giving x = −b/m. A horizontal line has m = 0 and either has no x-intercept when b ≠ 0 or infinitely many when the equation is y = 0.

QuantityFormulaInterpretation
Slopem = (y₂-y₁)/(x₂-x₁)Output change per input unit
Interceptb = y₁-mx₁Value of y when x = 0
Function valuef(x)=mx+bOutput at a chosen input

If x1 = x2, the two points define a vertical line x = constant rather than a function of the form y = mx + b. That is why this calculator requires different x-coordinates.

The same line can also be written in point-slope form, y−y1=m(x−x1). This form is especially convenient immediately after finding m because it uses a known point directly and reduces the chance of mixing coordinates while solving for b.

In applied problems, slope carries units. A slope of 2 dollars per item or -3 meters per second is more informative than the bare number because it states how the dependent variable changes with the independent variable.

Formula & Symbols

ConceptFormula or rule
Slopem = (y₂-y₁)/(x₂-x₁)
Liney = mx + b

Worked example

Example: Points (1,3) and (5,11) give slope 2 and equation y = 2x + 1.
Example 2: Through (1,3) and (4,9), m = 6/3 = 2 and b = 3 − 2(1) = 1. The line is y = 2x + 1, so f(6) = 13.
Example 3: Through (-2,5) and (2,-3), m = -8/4 = -2 and b = 1. The line y = -2x + 1 crosses the x-axis at x = 0.5.
Example 4: Through (0,-4) and (5,6), m = 2 and b = -4, so y = 2x - 4 and the x-intercept is 2.
Example 5: Through (2,7) and (6,7), m = 0. The function is y = 7: it is horizontal and has no finite x-intercept.

Common mistakes

⚠️
Using the wrong input format

Keep lists comma separated, matrices as rows separated by semicolons, and modular inputs as integers.

⚠️
Ignoring assumptions

Some methods require positive probabilities, valid moduli, independent trials, or small educational input sizes.

⚠️
Mixing point coordinates

When computing slope, keep the subtraction order consistent: if the numerator is y₂−y₁, the denominator must be x₂−x₁.

⚠️
Using the evaluation x to find b

The intercept must be calculated from one of the known points on the line, not from an unrelated x value where you merely want to evaluate the function.

FAQ

Can I use decimals?
Most numerical calculators allow decimals, but modular arithmetic and coding-theory tools usually require integers or binary strings.
Is this for homework checking?
Yes. The page is designed to show both the answer and the reasoning pattern.
Why does the result sometimes say approximate?
Some probability, floating-point, and numerical methods naturally produce approximations.
Why are two points enough for a linear function?
Two distinct nonvertical points determine one slope, and that slope plus either point determines a unique intercept b.
What does a negative slope mean?
A negative slope means y decreases as x increases. For example, m = -2 means y falls by 2 units for every 1-unit increase in x.
Can a horizontal line be a function?
Yes. A horizontal line y = b has slope 0 and gives exactly one y-value for every x.
Why is a vertical line excluded?
For a vertical line, x₂−x₁ = 0 so the slope formula divides by zero. It also fails the vertical-line test for y as a function of x.

Related calculators

These links will work after the calculators are registered in the final Math layout update.

Formula Explorer connections

Interpretation: This formula describes an algebraic relationship among variables, functions, equations, roots or sequences. Assumption: Respect the expression’s domain and excluded values. Check roots in the original equation because transformations can introduce extraneous solutions.

Logarithm Calculator – Log, Ln, Any Base →Logarithmic Equation Solver Calculator →Modular Linear Equation Calculator →Math Formula Explorer →