1. Transformation of Curves and Data Fitting

At HL, the study of functions extends beyond algebraic manipulation to fitting mathematical models to real-world data. Technology (GDC, GeoGebra, Desmos) is essential for this topic.

Fitting Models to Data

Given a scatter plot or dataset, we select an appropriate function type and use regression to find the best-fit parameters:

Pattern in DataSuggested ModelForm
Straight line trendLinear$y = mx + c$
Rapid growth/decayExponential$y = ab^x$ or $y = ae^{kx}$
Power relationshipPower$y = ax^n$
Oscillating / periodicSinusoidal$y = A\sin(Bx+C)+D$
S-shaped growth curveLogistic$y = \frac{L}{1+e^{-k(x-x_0)}}$
GDC Tip: Use the regression functions on your GDC to find model parameters. Always check the $r^2$ value (coefficient of determination) — closer to 1 indicates a better fit. For IB exams, always state which regression model you used.

2. Smoothing Data — Moving Averages

Real data is often noisy — it has random fluctuations that obscure the underlying trend. A moving average smooths the data by replacing each value with the average of neighboring values.

Moving Average Formulas

3-point moving average (centred at point $i$):

$$\bar{y}_i = \frac{y_{i-1} + y_i + y_{i+1}}{3}$$

5-point moving average (centred at point $i$):

$$\bar{y}_i = \frac{y_{i-2} + y_{i-1} + y_i + y_{i+1} + y_{i+2}}{5}$$

Note: You lose data points at the ends — a 3-point MA of $n$ values gives $n-2$ smoothed values.

Seasonal Variation and Trend Lines

In time series data (e.g., monthly sales, quarterly temperatures), the overall direction is the trend. Periodic fluctuations (summer highs, winter lows) are seasonal variation.

Worked Example 1

3-Point Moving Average for Monthly Sales

Monthly sales (units): Jan=120, Feb=95, Mar=140, Apr=110, May=155, Jun=130. Calculate the 3-point moving average.

1
Apply formula centred at each middle value:
  • Feb: $\frac{120+95+140}{3} = \frac{355}{3} \approx 118.3$
  • Mar: $\frac{95+140+110}{3} = \frac{345}{3} = 115.0$
  • Apr: $\frac{140+110+155}{3} = \frac{405}{3} = 135.0$
  • May: $\frac{110+155+130}{3} = \frac{395}{3} \approx 131.7$
2
Interpretation: The smoothed values (118.3, 115.0, 135.0, 131.7) show a gradual upward trend, despite the month-to-month fluctuations. Jan and Jun have no centred moving average (boundary effect).

3. Linearization of Non-Linear Models

An exponential model $y = ab^x$ is not linear, making it hard to fit by eye. We can linearize it by taking logarithms, transforming it into a linear relationship.

Linearizing $y = ab^x$

Take $\ln$ of both sides:

$$\ln y = \ln a + x \ln b$$

Let $Y = \ln y$, $c = \ln a$, $m = \ln b$. Then: $Y = c + mx$ (linear!)

For $y = ax^n$: take $\log$ of both sides: $\log y = \log a + n \log x$. Plot $\log y$ vs $\log x$ — gradient = $n$, intercept = $\log a$.

Worked Example 2

Linearizing Exponential Data

A bacterial culture data: $t$ (hours) = 0, 1, 2, 3, 4 and count $N$ = 100, 165, 272, 449, 740. Test whether this fits $N = ab^t$ and find $a$ and $b$.

1
Compute $\ln N$: $\ln 100 = 4.605$, $\ln 165 = 5.106$, $\ln 272 = 5.605$, $\ln 449 = 6.107$, $\ln 740 = 6.606$
2
Check linearity: Differences in $\ln N$: $0.501, 0.499, 0.502, 0.499$ — nearly constant! This confirms an exponential model with gradient $m \approx 0.500$.
3
Find parameters: $b = e^{0.500} \approx 1.649$. At $t=0$: $\ln N = 4.605$, so $a = e^{4.605} = 100$. Model: $N = 100 \times (1.649)^t$.

4. Sinusoidal Models

Many natural phenomena are periodic: temperature, tides, daylight hours, sound waves. The general sinusoidal model is:

General Sinusoidal Model

$$y = A\sin(Bx + C) + D$$
ParameterMeaningHow to Find
$A$Amplitude (half the range)$A = \frac{y_{\max} - y_{\min}}{2}$
$B$Controls period$B = \frac{2\pi}{\text{period}}$
$C$Horizontal (phase) shiftFrom first maximum or zero
$D$Vertical shift (midline)$D = \frac{y_{\max} + y_{\min}}{2}$
Worked Example 3

Fitting a Sinusoidal Model to Temperature Data

Average monthly temperatures (°C) in a city: Jan=−3, Apr=8, Jul=22, Oct=10. Fit a sinusoidal model.

1
Find $A$ and $D$: Max = 22 (July), Min = −3 (January). $$A = \frac{22-(-3)}{2} = \frac{25}{2} = 12.5, \quad D = \frac{22+(-3)}{2} = \frac{19}{2} = 9.5$$
2
Find $B$: Period = 12 months. $B = \frac{2\pi}{12} = \frac{\pi}{6}$.
3
Find $C$: Maximum occurs in July (month 7). For $\sin$, max at $Bx + C = \frac{\pi}{2}$: $$\frac{\pi}{6}(7) + C = \frac{\pi}{2} \implies C = \frac{\pi}{2} - \frac{7\pi}{6} = -\frac{2\pi}{3}$$
4
Model: $T = 12.5\sin\!\left(\frac{\pi}{6}x - \frac{2\pi}{3}\right) + 9.5$, where $x = 1$ is January.

5. Piecewise Functions

A piecewise-defined function uses different formulas for different parts of the domain.

Common Piecewise Functions

Sign function: $$\text{sgn}(x) = \begin{cases} -1 & x < 0 \\ 0 & x = 0 \\ 1 & x > 0 \end{cases}$$

Floor function (greatest integer function): $\lfloor x \rfloor$ = greatest integer $\leq x$

$\lfloor 3.7 \rfloor = 3$, $\lfloor -1.2 \rfloor = -2$

Ceiling function: $\lceil x \rceil$ = smallest integer $\geq x$

6. Recurrence Relations and Iteration

A recurrence relation defines a sequence where each term is expressed in terms of previous terms.

Types of Recurrence Relations

First-order linear: $u_{n+1} = au_n + b$ (arithmetic if $a=1$; geometric if $b=0$)

General solution:

Iteration (cobweb/staircase diagrams): Graphically trace $u_{n+1} = f(u_n)$ using $y = f(x)$ and $y = x$.

Practice Problems

1. Quarterly profits (£000s): Q1=45, Q2=62, Q3=78, Q4=54, Q1=49, Q2=67, Q3=83. Calculate the 4-point centred moving average for Q2 and Q3 of year 1.

Show Solution

4-point MA: Average 4 consecutive values, then centre by averaging adjacent 4-point averages.

4-pt MAs: $(45+62+78+54)/4 = 59.75$; $(62+78+54+49)/4 = 60.75$; $(78+54+49+67)/4 = 62.00$

Centred at Q2: $(59.75+60.75)/2 = 60.25$

Centred at Q3: $(60.75+62.00)/2 = 61.375$

2. Data suggests $y = ax^n$. When plotted on a log-log graph, the line has gradient 2.5 and $y$-intercept 1.2. Find $a$ and $n$.

Show Solution

From $\log y = \log a + n \log x$: gradient $= n = 2.5$, $y$-intercept $= \log a = 1.2$.

Therefore $a = 10^{1.2} \approx 15.85$ and $n = 2.5$.

Model: $y \approx 15.85 x^{2.5}$

3. A sinusoidal model has $y_{\max} = 14$ and $y_{\min} = 2$, with period 8. Write the model in the form $y = A\sin(Bx) + D$ (assuming max at $x=2$).

Show Solution

$A = (14-2)/2 = 6$, $D = (14+2)/2 = 8$, $B = 2\pi/8 = \pi/4$.

Max at $x=2$: $\sin(\frac{\pi}{4}\cdot 2 + C) = 1 \Rightarrow \frac{\pi}{2} + C = \frac{\pi}{2} \Rightarrow C = 0$.

$\mathbf{y = 6\sin\!\left(\frac{\pi}{4}x\right) + 8}$ (shift already satisfied if we use cosine: $y = 6\cos\!\left(\frac{\pi}{4}(x-2)\right)+8$)

Continue Learning

Explore other IB Math AI HL topics

Back to IB Hub Further Statistics →