Skip to content

Linear function

A linear function is a straight line. Enter the slope and the y-intercept — or two points — and see the line, the table and the intercepts.

The explanation is shown. Quick: a and b or two points. Advanced: also the line of best fit through many points, the slope in several forms and a forecast.

Your numbers

What do you know?
More options: axes
Axes from − to +

Answer

The equation

y = 2x − 1

x-intercept

(0.5 ; 0)

y-intercept

(0 ; -1)

xy-10-10-5-5551010

How to work it out

  1. 1y = 2x − 1
  2. 2x-intercept: 0 = 2x + -1 ⇒ x = 0.5
  3. 3y-intercept: (0 ; -1)

The formula

y = a · x + b

a is the slope: how much y rises when x increases by 1. b is where the line crosses the y-axis.

a = (y₂ − y₁) / (x₂ − x₁)

The slope from two points on the line.

a = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)², b = ȳ − a · x̄

The line of best fit through many points (least squares method — linear regression).

Table

x-3-2-10123
y-7-5-3-1135
In depth: more numbers and “what if”

The slope in several forms

SizeValue
Slope a2
As a percentage200 %
Angle of inclination63.4°
Slope of a perpendicular line-0.5

More: Equations and functions

6