Linear Function Value Calculator

Enter slope a, intercept b and argument x. The calculator computes y = a·x + b. For a = 2, b = 3 and x = 4 the result is 11; for a = −2, b = 3 and x = 4 it is −5. The panel also shows the root −b/a when a ≠ 0. This is not building the formula from two points.

Input

Result

Enter a, b and x.

Field order: a, b, x (the third field id ends with …-c). This is not interpolation from two points — a and b are already known.

How it works

How y is computed for a = 2, b = 3, x = 4
a·x2·4 = 8
+ b+ 3
y11

The value of a linear function at x is the number y = a·x + b, where a is the slope (directional coefficient) and b is the y-intercept. This is the standard affine form on ℝ — the schoolbook linear function whose graph is a straight line. The calculator uses three numbers you enter: a (the “a” field), b (the “b” field), and x (the “x” field), and computes y = a·x + b.

With a = 2, b = 3 and x = 4 you get 2·4 + 3 = 11. With a = 1, b = 0 and x = 5 the result is 5 (a line through the origin). With a = 0, b = 7 and x = 10 the result is 7 — zero slope, so y is constant and equals b for every x. With a = −2, b = 3 and x = 4 the result is −5: negative a means a decreasing function.

Geometry. The point (0, b) lies on the graph. A step Δx = 1 changes y by a. The root (when a ≠ 0) is x = −b/a, because then a·(−b/a) + b = 0. When a = 0 and b ≠ 0 there is no root; when a = b = 0 every real number is a root (y ≡ 0).

What this calculator does not compute. It does not recover a and b from two points — that is the neighbouring linear interpolation page. It does not solve equation systems or fit a regression. A period and a comma are equivalent.

Mathematical model: linear / affine function y = ax + b (school and university standard; MathWorld — Linear Function; Wikipedia — Linear function). The calculator is ordinary multiply-and-add in the browser’s floating-point arithmetic.

Formula

y = a · x + b

Root (when a ≠ 0): x = −b / a. Y-intercept: (0, b).

Mathematical model: linear / affine function y = ax + b. Computation: multiply-and-add in the browser.

Theory, derivation and domain

Definition

In the school sense, a linear function is a map f: ℝ → ℝ given by f(x) = ax + b, where a, b ∈ ℝ are fixed coefficients. The function value at x is the number y = f(x) = ax + b. The coefficient a is the slope (directional coefficient): it says how much y changes when x increases by 1. The coefficient b is the intercept: f(0) = b, so the graph meets the y-axis at (0, b).

In linear algebra, “linear map” is often reserved for maps satisfying f(αx+βy)=αf(x)+βf(y), i.e. the homogeneous case b = 0. The form ax + b with arbitrary b is then called affine. On this page — and in a typical secondary-school syllabus — “linear function” means exactly y = ax + b. The definition matches elementary analysis textbooks and the MathWorld (Linear Function) / Wikipedia (Linear function) articles.

Domain and codomain are ℝ. The graph {(x, ax + b) : x ∈ ℝ} is a straight line in the Cartesian plane. The only input assumption is that a, b, x are finite floating-point numbers in the browser.

Historical and conceptual context

Euclidean geometry describes a line without coordinates. The modern writing y = ax + b arrives with analytic geometry (Descartes, Fermat) and becomes the basic model of proportionality with a shift: constant rate of change plus a constant reference level. In economics the same form is total cost = fixed cost + unit cost · quantity; in physics it approximates many locally linear laws (Hooke’s law in the elastic range, v = v₀ + at under constant acceleration).

Conceptually, separate three tasks students often mix. First: the value y at one x (this page). Second: the root, i.e. solving ax + b = 0. Third: recovering a and b from two points on the graph — the inverse task, handled by linear interpolation (lerp), not by substituting into a ready formula.

The calculator does not smooth data, compute Pearson correlation, or draw confidence bands. It shows only the arithmetic result y = ax + b and the panel companions (a·x, intercept, root, monotonicity character).

Formal properties

Input: a, b, x ∈ ℝ. Output: y ∈ ℝ. The map x ↦ ax + b is continuous and differentiable with derivative f′(x) = a (constant). It is injective if and only if a ≠ 0; bijective ℝ → ℝ when a ≠ 0, with inverse x = (y − b)/a.

Monotonicity: a > 0 ⇒ f increasing; a < 0 ⇒ f decreasing; a = 0 ⇒ f constant equal to b. Parity: f is neither even nor odd except in special cases (e.g. b = 0 yields an odd map). The composition of two linear functions is again linear (affine); the maps x ↦ ax + b with a ≠ 0 form the one-dimensional affine group.

Useful identities: f(x + 1) − f(x) = a; f(0) = b; if a ≠ 0 then f(−b/a) = 0. When a = 0 the equation has infinitely many roots exactly when b = 0; otherwise it has none.

Full derivation

Step 1. Define f(x) := ax + b by multiplication and addition of reals. This is a definition, not a theorem — it needs no further “existence proof” beyond the field axioms of ℝ.

Step 2 (value at a point). Substitute a concrete x₀: y₀ = a·x₀ + b. The calculator performs exactly that: first the product a·x, then the sum with b. For a = 2, b = 3, x = 4: a·x = 8, y = 8 + 3 = 11.

Step 3 (root). Seek x such that ax + b = 0. When a ≠ 0, subtract b and divide: x = −b/a. Check: a(−b/a) + b = −b + b = 0. When a = 0 the equation reduces to b = 0; it is either an identity (every x) or a contradiction (no x).

Step 4 (link to two points). If (x₁, y₁) and (x₂, y₂) are known with x₂ ≠ x₁, then a = (y₂ − y₁)/(x₂ − x₁) and b = y₁ − a·x₁. This page assumes a and b are already known; recovering them from nodes belongs to linear interpolation.

Step 5 (computation). The calculator computes y = a · x + b. Field order is a, b, x.

Special cases

a = 0, b = 7, x = 10 → y = 7 (constant). a = 1, b = 0, x = 5 → y = 5 (proportionality y = x). a = −2, b = 3, x = 4 → y = −5 (decreasing). a = 2.5, b = 3, x = 4 → y = 13. a = 2, b = −6, x = 3 → y = 0 (the point lies on the x-axis; the root equals 3).

When |a| and |x| are huge, the product may leave the floating-point arithmetic range (±≈1.8·10³⁰⁸) and become ±Infinity — the panel then shows infinity, without an artificial clamp.

Numerical notes

Float64 multiply-add is exact for typical school numbers (small integers and short binary decimals). Fractions such as 0.1 have no finite binary expansion — hence tiny noise far past the decimal point on unlucky inputs; the calculator formats sensibly but does not pretend arbitrary-precision decimal arithmetic.

Comma and period are equivalent in the parser. An empty field leaves the result blank — zero is not substituted for a missing entry.

The diagram draws the line y = ax + b, the point P(x, y), and the intercept (0, b). Scale follows the inputs; it is not a separate “visual unit” of the result.

Related notions and sources

Related: linear interpolation (line from two nodes), the linear equation ax + b = 0, quadratic functions, absolute value (piecewise lines). Least-squares linear regression is a different model — fitting a, b to many points with error.

Sources: Wikipedia — Linear function; MathWorld — Linear Function; elementary algebra / analysis textbooks (slope–intercept form). Educational tool.

How to use

  1. Enter a, b and x, for example 2, 3 and 4.
  2. Click Calculate or wait for the live result. 2, 3 and 4 give y = 11.
  3. Check the panel: a·x, intercept (0, b), the root and the line diagram.
  4. 1, 0 and 5 give 5. 0, 7 and 10 give 7. −2, 3 and 4 give −5.
  5. A line from two points lives on linear interpolation — here a and b are inputs.

Symbol glossary

y = ax + b. For a = 2, b = 3 and x = 4 you get y = 11. The panel also shows the root and the y-intercept.

a
Slope. Change in y per Δx = 1. Field wartosc-funkcji-liniowej-a.
b
Intercept; f(0) = b. Field wartosc-funkcji-liniowej-b.
x
Argument. Field wartosc-funkcji-liniowej-c.
y
a·x + b — the primary result.
−b/a
Root when a ≠ 0.

Examples

Example 1

  • a = 2, b = 3, x = 4

11

What is y for a=2, b=3, x=4? 11.

Example 2

  • a = 1, b = 0, x = 5

5

What is y for a=1, b=0, x=5? 5 (y=x).

Example 3

  • a = 0, b = 7, x = 10

7

What is y for a=0, b=7, x=10? 7 (constant).

Example 4

  • a = −2, b = 3, x = 4

−5

What is y for a=−2, b=3, x=4? −5.

Example 5

  • a = 2.5, b = 3, x = 4

13

What is y for a=2.5, b=3, x=4? 13.

Example 6

  • a = 2, b = −6, x = 3

0

What is y for a=2, b=−6, x=3? 0 (root = 3).

Related calculators

Common questions

What does this calculator compute?

It evaluates the linear function y = a·x + b for the entered a, b and x. For a = 2, b = 3 and x = 4 the result is 11. One substitution — not fitting a line from two points.

What is the formula, and what do a, b, x mean?

The formula is y = a·x + b. Symbol a is the slope, b is the y-intercept, and x is the argument. The third form field has id …-c historically, but it means x.

What is y when a = 2, b = 3 and x = 4?

The result is 11, because 2·4 + 3 = 11. That is the first example on the page and the same result after “Fill this example”.

What happens when a = 0?

The function is constant: y = b for every x. For a = 0, b = 7 and x = 10 the result is 7. There is no root when b ≠ 0; when b = 0, y ≡ 0 and every x is a root.

How is the root computed?

From ax + b = 0. When a ≠ 0, x = −b/a. The panel shows that value beside y. When a = 0, the panel states that there is no root or that every x is a root (y ≡ 0).

How is this different from linear interpolation?

Here you enter ready a and b plus one x. On interpolation you build the line from two nodes (x₀, y₀), (x₁, y₁). Both models describe a line, but the input fields differ.

Is a negative a allowed?

Yes. Negative a means a decreasing function. Example: a = −2, b = 3, x = 4 gives y = −5.

Must x lie in some interval?

No. The algebra ax + b does not ask for a segment. Any finite x is allowed; the result may lie arbitrarily far on the line.

Do a comma and a period work the same way?

Yes. 2.5 and 2,5 are the same number. For a = 2.5, b = 3 and x = 4 the result is 13.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on a, b and x. The currency and unit settings in the page header do not affect this result.

What happens with an empty field?

An empty a, b or x leaves the result blank. The calculator does not substitute zero for a missing entry.

Where do I recover a and b from two points?

On the linear interpolation page. There you enter two nodes and a query x; here you assume slope and intercept are already known.

How do I calculate a linear function value?

Substitute into y = a·x + b. For a = 2, b = 3 and x = 4: y = 2·4 + 3 = 11.

What is y for y = 2x + 3 at x = 4?

11. That is the first example on this page: a = 2, b = 3, x = 4.

What is y for a = −2, b = 3 and x = 4?

−5. Fourth example: a decreasing line −2·4 + 3 = −5.

What is the root when a = 2 and b = −6?

x = 3, because −b/a = 6/2 = 3. The sixth example gives y = 0 exactly at that point.

Does this find a and b from two points?

No. Here you enter ready a, b and one x. Building the formula from two points lives on the linear interpolation page.

The result is y = a·x + b: for a = 2, b = 3 and x = 4 it equals 11. The root and line diagram are in the panel. A line from two points lives on linear interpolation.

Knowledge sources

The definition, slope–intercept form and root below come from established sources.

Page updated November 3, 2026.