Variables and Expressions

How to Build Your Own Formula From a Table of Values

Test differences, ratios and products to find a linear, quadratic, exponential or inverse rule that matches a table.

Key takeaways

  • Check differences, second differences, ratios and products to identify the likely family of rule.
  • These quick difference and ratio tests assume the inputs go up in equal steps.
  • Test any formula on rows you did not use to build it.
  • A finite table never proves a rule, because different formulas can match the same entries.

To build a formula from a table, look for something that stays constant as the input changes. Constant differences point to a linear rule. Constant second differences point to a quadratic. Constant ratios suggest an exponential rule, and constant products suggest inverse variation.

Once you know the family, you use a few rows of the table to find the specific numbers in the formula, then test the result on every remaining row. This article walks through each case, including what to do when nothing is exactly constant.

Set up the table before you hunt

Put the input, usually x, in the first column in increasing order, with the output y beside it. Know which quantity depends on which. If you record the cost of renting a boat for different numbers of hours, hours are the input and cost is the output. The distinction is discussed in dependent and independent variables.

Next, look at the steps in x. If they are all equal, the tests below apply directly. If they are uneven, you need to divide each change in y by the matching change in x.

Finally, think about what the numbers describe. A story often hints at the rule: a fixed fee plus a per-hour charge suggests a line, and something that doubles regularly suggests an exponential. Use the context as a clue and the arithmetic as the test.

Constant differences mean a linear rule

Here is a table with inputs rising by 1.

x 1 2 3 4 5
y 7 10 13 16 19

Each y is 3 more than the one before. A constant change per unit step is the signature of y = mx + b, where m is that change. So m = 3. To find b, use any row: 7 = 3(1) + b gives b = 4. The rule is y = 3x + 4, and x = 5 gives 19.

You can also find b by stepping backward to x = 0, where y would be 7 - 3 = 4.

For uneven inputs, compute rates. Suppose x is 2, 5, 9 and y is 11, 23, 39. From the first to second row, y rises 12 while x rises 3, a rate of 4. From second to third, y rises 16 while x rises 4, again 4. So m = 4, and 11 = 4(2) + b gives b = 3. The rule y = 4x + 3 produces 23 and 39 as required.

Constant second differences mean a quadratic

If first differences change, take the differences of the differences.

x 1 2 3 4 5
y 4 9 18 31 48
first differences 5 9 13 17
second differences 4 4 4

A constant second difference means y = ax² + bx + c. When x steps by 1, the second difference equals 2a. Here 2a = 4, so a = 2.

Now subtract 2x² from each y and study what remains.

x:          1    2    3    4    5
y:          4    9   18   31   48
2x²:        2    8   18   32   50
y - 2x²:    2    1    0   -1   -2

The leftover drops by 1 each step, so it is linear: -x + 3. Therefore y = 2x² - x + 3. At x = 4 this gives 32 - 4 + 3 = 31. The general idea extends to higher degrees, as shown in the method of finite differences.

Constant ratios mean exponential growth or decay

x 0 1 2 3
y 5 15 45 135

The differences are 10, 30 and 90, which never settle. Dividing instead gives 15/5 = 45/15 = 135/45 = 3. A constant ratio signals y = a · bˣ. The ratio is b = 3, and the value at x = 0 is a = 5, so y = 5 · 3ˣ.

A ratio between 0 and 1 means decay. Outputs of 80, 40, 20, 10 halve each step, giving y = 80 · (1/2)ˣ if the first row is x = 0.

If the table starts at x = 1, divide the first output by b once to find the value at x = 0, or write the rule as y = (first output) · bˣ⁻¹. More on this test appears in recognizing constant ratios.

Constant products mean inverse variation

Consider pairs where one value falls as the other rises.

x 2 3 4 6
y 18 12 9 6

Multiply across each column: 36 every time. So xy = 36, and the rule is y = 36/x, defined for x ≠ 0. This test does not require equal steps in x.

Similarly, if y/x is the same in every column, then y = kx, a direct proportion, which is a linear rule passing through the origin.

What stays constant in the table?
Differences Equal x steps: y = mx + b Second differences Equal x steps: y = ax² + bx + c Ratios Equal x steps: y = a · bˣ Products x · y Any x steps: y = k/x Differences Equal x steps: y = mx + b Second differences Equal x steps: y = ax² + bx + c Ratios Equal x steps: y = a · bˣ Products x · y Any x steps: y = k/x

When the pattern comes from a picture

Tables often arise from geometric patterns, such as matchsticks arranged into a row of squares. One square takes 4 sticks, and each additional square adds 3. The table of squares n and sticks s reads 4, 7, 10, 13, so s = 3n + 1.

The picture explains the formula: there is one starting stick, then a group of 3 for each square. An explanation like this is stronger than the table alone, because it shows why the pattern must continue for every n. Rules for growing tile patterns develops this habit.

Try to find a second explanation too. You might see 4 sticks for the first square and 3 for each of the remaining n - 1 squares, giving 4 + 3(n - 1). Expanding it returns 3n + 1.

Using two or three rows to solve for constants

When you know the family but the numbers are not obvious, substitute rows into the general form and solve. For a line, two rows give two equations. Suppose y = mx + b passes through (4, 17) and (10, 41).

17 = 4m + b
41 = 10m + b
24 = 6m              (subtract the first from the second)
m = 4, so b = 1

The rule is y = 4x + 1. A quadratic has three unknown constants, so it needs three rows with different x values. If one of them is x = 0, the work is shorter, because that row gives c immediately.

Say the rows are (0, 5), (1, 6) and (3, 20). Then c = 5. The second row gives a + b = 1, and the third gives 9a + 3b = 15, which simplifies to 3a + b = 5. Subtracting a + b = 1 leaves 2a = 4, so a = 2 and b = -1. The rule y = 2x² - x + 5 returns 5, 6 and 20.

These constants will reproduce the rows used to find them by design, so agreement there tells you nothing new. A fourth row is what actually tests the choice of family.

Why a table cannot prove a rule

Take the entries x = 1, 2, 3 with y = 1, 2, 4. The rule y = 2ˣ⁻¹ fits all three. So does y = (x² - x + 2)/2. At x = 4 the first predicts 8 and the second predicts 7. Both are perfectly good formulas for the data you saw.

This is why you should hold back at least one row to test your rule, and why knowledge of the situation matters. If the quantity doubles because every cell splits in two, you have a reason to prefer the exponential. Without a reason, your formula is a well-supported guess.

Be especially careful about using a formula far outside the table. A rule that fits inputs from 1 to 5 may fail badly at 500. What a formula assumes looks at that problem directly.

Dealing with measured, noisy data

Measurements rarely give perfectly constant differences. Suppose differences come out as 2.9, 3.1, 3.0 and 2.8. That is consistent with a roughly linear relationship with a slope near 3, though it does not demonstrate one.

You might plot the points and draw a line that passes close to them, or use a spreadsheet or calculator regression tool. Then look at the residuals, the differences between measured and predicted values. Residuals scattered randomly above and below zero support the model, while a curved pattern suggests a different family. See residuals and linear fit.

State your result with an honest symbol, such as y ≈ 3x + 4, and report the input range the data covered.

A checklist for building a rule

  1. Order the table by input and note the step sizes.
  2. Compute differences. If constant, write a linear rule.
  3. If not, compute second differences, then ratios, then products.
  4. Use the necessary rows to solve for the constants.
  5. Test every other row, including one you saved.
  6. Say what the letters mean, their units and the input values for which you trust the rule.

If none of the tests works, try combinations. Subtract a suspected piece, as we did with 2x², and test the remainder. Compare the outputs with squares, cubes, powers of 2 or triangular numbers 1, 3, 6, 10. Outputs of 2, 5, 10, 17, for example, are each one more than a square, so y = x² + 1 for x = 1 to 4.

Writing a formula is the reverse of evaluating one, and it trains you to see structure in numbers. For choosing among function families more broadly, continue with identifying a function family from data.

Common questions

What if the table does not include x = 0?

You do not need it. Substitute any known row into the general form and solve for the missing constant, or step the pattern backward until you reach zero. Stepping backward is only a bookkeeping device, so it is fine even when zero makes no sense in the story.

Which should I try first, differences or ratios?

Start with differences, because subtraction is quick and linear rules are common in introductory problems. If the outputs keep multiplying, growing faster and faster, switch to ratios. Powers of 2 have a special tell: their differences are again powers of 2, so taking more differences never reaches a constant.

What if the outputs go up and down?

None of the four basic tests may fit. Look for alternation, such as a factor of (-1)ˣ with whole number inputs, or a cycle that repeats after a fixed number of rows. For outputs 3, -3, 3, -3 starting at x = 0, the rule y = 3 · (-1)ˣ works.

Should my formula use the row number or the measured input?

Use the real input whenever it has meaning. If measurements were taken at 5, 10 and 15 minutes, a rule written in minutes is easier to read and less likely to be misused than one written in terms of first, second and third reading.

Written for 4Algebra with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 35 articles in Variables and Expressions →

Latest news on this topic