Linear Equation from a Table of Values Calculator

Linear Equation from a Table of Values Calculator

Growing AI Skill PRO

Enter Calculation

Formula

y=mx+bwhere{m=y2−y1x2−x1b=y1−mx1\begin{gathered} y = mx + b \\[1.5em] \text{where}\quad \left\{ \begin{aligned} m &= \frac{{{\text{y}_2}} - {{\text{y}_1}}}{{{\text{x}_2}} - {{\text{x}_1}}} \\ b &= {{\text{y}_1}} - m\,{{\text{x}_1}} \end{aligned} \right. \end{gathered}
Usage stats

Advertisement

Results

Equation of the Line
y = 3x - 1
slope-intercept form
Slope (m) 3
Y-intercept (b) -1

Report an error on this page

What This Calculator Does

A table of values lists pairs of inputs and outputs for a function. When those values fall on a straight line, you can describe the entire relationship with one linear equation, \(y = mx + b\). This calculator takes any two distinct points from your table and produces the exact slope, y-intercept, and the finished equation.

How to Use It

Pick any two rows from your table and enter their coordinates as \((x_1, y_1)\) and \((x_2, y_2)\). The calculator divides the change in y by the change in x to get the slope, then uses one point to solve for the y-intercept. The result is shown in slope-intercept form, ready to graph or substitute.

The Formula Explained

The slope m measures how much y changes for each one-unit increase in x: $$m = \frac{y_2 - y_1}{x_2 - x_1}$$ Once you know m, plug one point back into \(y = mx + b\) and solve for b: $$b = y_1 - m\cdot x_1$$ If both x-values are equal the line is vertical and has no slope, so the calculator reports \(x = \text{constant}\) instead.

Advertisement
Line graph showing two points, rise and run forming slope, and the y-intercept
Slope m is the rise over run between two points; b is where the line crosses the y-axis.

Worked Example

Suppose your table gives the points \((1, 2)\) and \((3, 8)\). The slope is $$\frac{8 - 2}{3 - 1} = \frac{6}{2} = 3$$ Then \(b = 2 - 3\cdot 1 = -1\). The linear equation is \(y = 3x - 1\). Checking: at \(x = 3\), \(y = 3\cdot 3 - 1 = 8\). Correct.

More Worked Examples: Negative, Fractional and Zero Slopes

Each example uses two rows of a table of values, the slope formula \(m = \frac{y_2 - y_1}{x_2 - x_1}\) and the intercept formula \(b = y_1 - m x_1\).

Example 1: Negative slope

Rows: (2, 7) and (5, 1).

  1. Slope: \(m = \frac{1 - 7}{5 - 2} = \frac{-6}{3} = -2\).
  2. Intercept: \(b = 7 - (-2)(2) = 7 + 4 = \) 11.
  3. Equation: \(y = -2x + 11\).
  4. Check: at x = 2, \(-2(2) + 11 = 7\) ✓; at x = 5, \(-2(5) + 11 = 1\) ✓.

Example 2: Fractional slope

Rows: (-2, 1) and (4, 4).

  1. Slope: \(m = \frac{4 - 1}{4 - (-2)} = \frac{3}{6} = \frac{1}{2} = 0.5\).
  2. Intercept: \(b = 1 - 0.5(-2) = 1 + 1 = 2\).
  3. Equation: \(y = 0.5x + 2\).
  4. Check: at x = -2, \(0.5(-2) + 2 = 1\) ✓; at x = 4, \(0.5(4) + 2 = 4\) ✓.

Example 3: Horizontal line (zero slope)

Rows: (1, 5) and (6, 5).

  1. Slope: \(m = \frac{5 - 5}{6 - 1} = \frac{0}{5} = 0\).
  2. Intercept: \(b = 5 - 0 \cdot 1 = 5\).
  3. Equation: \(y = 5\).
  4. Check: y is 5 at both x = 1 and x = 6 ✓.

Interpreting the Slope and Y-Intercept

What the slope tells you

  • Positive slope (m > 0): y increases as x increases.
  • Negative slope (m < 0): y decreases as x increases.
  • Zero slope (m = 0): y stays constant, giving a horizontal line.
  • Size of |m|: a larger absolute value means a steeper line. For example, m = -3 is steeper than m = 0.5.

What the y-intercept tells you

The y-intercept b is the value of y when x = 0, which is the point where the line crosses the y-axis. In the equation \(y = -2x + 11\), the line crosses the y-axis at (0, 11). If your table has no x = 0 row, b is still defined by the line. It is found by extending the pattern back to x = 0.

How to verify a table is linear

  1. Compute the rate of change \(\frac{y_2 - y_1}{x_2 - x_1}\) between every pair of rows. If any pair gives a different value, the data is not linear.
  2. If the x-values change by equal steps, the y-values must also change by equal amounts. For example, x = 0, 1, 2, 3 with y = 4, 7, 10, 13 has a constant difference of 3, so it is linear.

Note that a calculator using only two rows will always return a line. It cannot tell you whether the other rows follow that line, so check them yourself.

Reading the slope as a unit rate

In context, the slope is the change in y per one unit of x. If x is the number of items and y is the total cost, then m = 2.5 means each additional item costs 2.5 currency units. The intercept b is then a fixed cost, such as a delivery or setup fee, that applies even when x = 0.

Advertisement

Key Terms: Slope, Intercept and Rate of Change

  • Table of values: a list of paired x and y values, where each row is a point (x, y) on a function or graph.
  • Slope (m): a number describing how steeply a line rises or falls. It is the change in y divided by the change in x: \(m = \frac{y_2 - y_1}{x_2 - x_1}\).
  • Rise and run: the rise is the vertical change \(y_2 - y_1\), and the run is the horizontal change \(x_2 - x_1\) between two points. Slope is rise divided by run.
  • Y-intercept (b): the y-value where the line crosses the y-axis, at x = 0.
  • Slope-intercept form: the equation \(y = mx + b\), which shows the slope m and y-intercept b directly.
  • Rate of change: how much one quantity changes per unit change in another. For a linear function it is constant and equals the slope.
  • Vertical line (undefined slope): a line with the same x-value in every row (\(x_1 = x_2\)). The run is 0, so division by zero makes the slope undefined. Its equation is \(x = c\), which cannot be written as \(y = mx + b\).
  • Linear function: a function whose graph is a straight line and whose rate of change is constant. It has the form \(y = mx + b\).

FAQ

Which two points should I choose? Any two distinct rows work for a truly linear table; they all give the same line. Picking points with simple numbers makes mental checking easier.

What if my table is not perfectly linear? Then no single straight line fits all rows. This tool computes the exact line through the two points you enter; use a linear regression calculator for a best-fit line.

What does a slope of zero mean? A zero slope means y never changes — the line is horizontal and the equation is simply \(y = b\).

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators