Linear Functions

A function whose graph is a straight line; a is the slope and b the y-intercept.

y = ax + b

Each time x increases by 1, y changes by a. A negative a gives a line that falls to the right.

The x-intercept (where y = 0) is −b ÷ a when a is not 0.

Calculator

Change a value and the result and picture update instantly.

Result

y5
x-intercept0.5

Animated picture

The picture follows your values. Some points and shapes can be dragged.

Use in game development

Use it for values that change at a constant rate: XP per level, scrolling with time, a health bar width.

Code example (JavaScript)

const y = slope * x + offset; // e.g. XP needed for each level

What the symbols mean

SymbolMeaning
aSlope a
bIntercept b
xx
yy
x0x-intercept

More formulas in this category

Frequently asked questions

What is the formula for Linear Functions?
The formula for Linear Functions is y = ax + b. A function whose graph is a straight line; a is the slope and b the y-intercept.

Math Formula Quiz Numbers, Algebra & Functions

Sources

Checked: 2026-11-29