Updated · By Pete Bromfield, former Head of Maths with IB examining experience

IA modelling, step by step · Cubic and polynomials

Cubic and polynomial models — and why a perfect fit can be the worst model

AA SLAA HLAI SLAI HL

Adding terms to a polynomial always lowers the sum of squared residuals on the data you fitted — until a curve of degree n − 1 passes through every point. This page fits four polynomials to the same data and shows why the ‘perfect’ one is useless.

Example data, invented for this guide. The context is realistic, but the numbers were made up to show the method. Use your own measured or sourced data in your IA.

When to use it

The shape of the data

  • A cubic: one rise and one fall with an asymmetric shape, or a point of inflection.
  • More turning points than a quadratic can have — but ask whether the context really has them.

The context

  • Volume-type relationships (a box, a container) where x³ appears naturally.
  • An asymmetric rise and fall where a quadratic is clearly too symmetric.
  • Never just because a higher degree gives a higher R².

Course fit: Cubic models are AI SL; polynomial functions are AA (especially HL). Discussing overfitting is excellent reflection at any level.

The example data

A family car's trip computer shows fuel economy after driving at each steady speed on a flat road for 5 minutes.

Example data: fuel economy and steady speed
ix: Steady speed (km/h)y: Fuel economy (km/L)
13011.6
24014.9
35016.1
46017.4
57016.8
68016.3
79014.6
810013.4
911011.2
Scatter graph of fuel economy against steady speed for the example data
Step 1 of any modelling IA: plot the data and describe the shape before fitting anything.

Degree 1: a straight line

The data clearly rise and fall, so a line should fail. It is still worth fitting: it is the baseline every other model must beat.

Step 2 · Gradient

m = (nΣXY − ΣX ΣY) / (nΣX² − (ΣX)²)

m = (9 × 9159 − 630 × 132.3) / (9 × 50100 − 630²) = −918 / 54000 = −0.01700

Here X = x and Y = y.

Step 3 · Intercept

X̄ = ΣX/n = 70.000,   Ȳ = ΣY/n = 14.700

c = Ȳ − m X̄ = 14.700 − (−0.01700) × 70.000 = 15.89

The line of best fit always passes through the mean point (X̄, Ȳ).

Graph of the data with the fitted straight line (least squares) (line)
A straight line: the fitted curve over the example data.

In the full worked example

  • The rest of the method: steps 3 to 5
  • Degree 2: a quadratic
  • Degree 3: a cubic
  • Degree 8: a curve through every point
  • Comparing the methods: SSR, R² and RMSE side by side
  • What the model tells you, in context
  • GDC key sequences: TI-84 Plus CE, TI-Nspire CX and Casio fx-CG50
  • Desmos regression syntax
  • How to write it up in your IA
  • Common mistakes
  • Is this good enough for Criterion E? The checklist

Evaluate this model

Questions to answer in your own words, about your own data. They are prompts, not sentences to copy.

  • Is there a reason in the context for a cubic (or higher degree), or are the extra parameters fitting noise?
  • How does the polynomial behave just beyond the data? Does a lower degree predict held-out points as well?

Then work through the general questions on evaluating a model (extrapolation, the parameters, residuals, comparing models, outliers, assumptions and improvements) and the notes on accuracy and rounding. In the free Grapher, fit the model with ~ and open “What this model means” for the same prompts with your own numbers.

IA ideas that use a cubic and polynomials model

Explorations from our idea list whose mathematics includes this model. Each research question is a starting point to make your own.

  • What is the volume of an egg?: How accurately can the volume of a hen's egg be found by modelling its profile with a function and using a volume of revolution, compared with measuring it by water displacement?
  • Where should the 125 ml line go on a glass?: Using a volume of revolution of a fitted profile, at what height should the 125 ml and 175 ml lines be marked on a particular glass, and how accurate is the prediction?
  • Modelling the Keeling curve: trend plus seasons: Can monthly Mauna Loa CO₂ be modelled as a smooth trend (quadratic or exponential) plus a sine wave with a one-year period, and how well does a model fitted to 1960–2010 predict the last decade?

How this earns marks

A cubic and polynomials model can earn marks under every criterion: the fit and its explanation under Criterion E, your judgement of it (residuals, the domain, what the parameters mean) under Criterion D, and the reasons you chose it under Criterion C. What examiners look for, criterion by criterion and the mistakes that cost marks are on the modelling guide.

Get feedback on your write-up Self-check your draft Model my data

Frequently asked questions

Is a higher R² always a better model?

No. For polynomials, R² can only go up as you add terms, even when the extra terms fit noise. Choose the simplest model whose shape makes sense in the context and that predicts well on data it was not fitted to.

Next steps

Related models: Quadratic: three points, completing the square, regression · Piecewise models · Choosing and comparing models. Or model your own data, and see what the IA package adds.

Free: the IA checklist, criterion by criterion

Every check for Criteria A–E in a 4-page PDF, the mistakes that cost the most marks and a self-assessment grid. We'll email it to you, and for three weeks your weekly email carries one IA tip, timed to your deadline if you give it. Free — no account, no payment.