Skip to the content

Topics Covered

Bivariate Data Least Squares k-th Degree Polynomial Straight Line Parabola Exponential Curves Power Curve Normal Equations Derived Coding x Worked Problems
On this page
  1. 1. Bivariate Data & Curve Fitting
  2. 2. Principle of Least Squares
  3. 3. Fitting of \(k\)-th Degree Polynomial
  4. 4. Fitting of a Straight Line
  5. 5. Fitting of Second-Degree Polynomial (Parabola)
  6. 6. Fitting of Family of Exponential Curves
  7. 7. Fitting of Power Curve
  8. Worked Problems on Curve Fitting
  9. Key Take-aways

1. Bivariate Data & Curve Fitting

DEFINITION

When data are recorded on two variables simultaneously — say \(X\) (independent) and \(Y\) (dependent) — they are called bivariate data: \((x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n)\).

Curve fitting is the process of finding a mathematical curve that best describes the relationship between \(X\) and \(Y\).

Once a curve is fitted, it can be used to estimate future values (interpolation / extrapolation) and to understand the trend in the data.

0 Least-squares fitted line Sum of squared vertical distances is minimum
Fig 1.1 — Best-fit line minimises the sum of squared residuals

2. Principle of Least Squares

STATEMENT

Among all possible curves \(Y = f(X)\) of a given form, the best-fit curve is the one for which the sum of squares of the residuals (vertical distances between observed and predicted values) is a minimum:

\[ S \;=\; \sum_{i=1}^{n}\bigl(y_i - f(x_i)\bigr)^2 \;=\; \min. \]

Setting \(\partial S/\partial(\text{parameter}) = 0\) for each parameter gives a system of normal equations whose solution provides the optimal parameter values.

Residuals, and where the principle comes from

For each observation the fitted curve gives an estimated value \(\hat y_i = f(x_i)\). The difference \(e_i = y_i - \hat y_i\) is the residual. Positive and negative residuals would cancel in a plain sum, so the principle squares them first. The method was published by A.-M. Legendre in 1805; C. F. Gauss, who had used it earlier, gave its probability justification.

Why the normal equations give a minimum

For the straight line, \(E(a, b) = \sum (y_i - a - bx_i)^2\). Setting the first partial derivatives to zero finds a stationary point; the second derivatives show it is a minimum:

\[ \frac{\partial^2 E}{\partial a^2} = 2n, \qquad \frac{\partial^2 E}{\partial b^2} = 2\sum x_i^2, \qquad \frac{\partial^2 E}{\partial a\,\partial b} = 2\sum x_i . \]

The test for a minimum needs \(\frac{\partial^2 E}{\partial a^2} > 0\) and

\[ \frac{\partial^2 E}{\partial a^2}\cdot\frac{\partial^2 E}{\partial b^2} - \Big(\frac{\partial^2 E}{\partial a\,\partial b}\Big)^2 = 4\Big[n\sum x_i^2 - \big(\textstyle\sum x_i\big)^2\Big] = 4n\sum (x_i - \bar x)^2 > 0, \]

which holds whenever the \(x_i\) are not all equal. Since \(E\) is a sum of squares it has no maximum, and the single stationary point is the least value. The same holds for every curve whose parameters enter linearly.

3. Fitting of \(k\)-th Degree Polynomial

Suppose we wish to fit \(Y = a_0 + a_1 X + a_2 X^2 + \cdots + a_k X^k\) to bivariate data. The least-squares normal equations are:

\[ \begin{aligned} \sum y &= n a_0 + a_1 \sum x + a_2 \sum x^2 + \cdots + a_k \sum x^k \\ \sum xy &= a_0 \sum x + a_1 \sum x^2 + \cdots + a_k \sum x^{k+1} \\ \sum x^2 y &= a_0 \sum x^2 + a_1 \sum x^3 + \cdots + a_k \sum x^{k+2} \\ &\;\;\vdots \\ \sum x^k y &= a_0 \sum x^k + a_1 \sum x^{k+1} + \cdots + a_k \sum x^{2k} \end{aligned} \]

This is a system of \(k + 1\) linear equations in the \(k + 1\) unknowns \(a_0, a_1, \ldots, a_k\).

4. Fitting of a Straight Line

Form: \(Y = a + bX\).

NORMAL EQUATIONS \[ \sum y \;=\; n a + b \sum x, \qquad \sum xy \;=\; a \sum x + b \sum x^2. \]

Solving for \(a\) and \(b\):

\[ b \;=\; \dfrac{n \sum xy - \sum x \sum y}{n \sum x^2 - (\sum x)^2}, \qquad a \;=\; \bar y - b \bar x. \]

Deriving the normal equations

  1. With respect to \(a\): \(\dfrac{\partial E}{\partial a} = 2\sum [y_i - (a + bx_i)](-1) = 0\), so \(\sum y_i - na - b\sum x_i = 0\), that is, \(\sum y = na + b\sum x\).
  2. With respect to \(b\): \(\dfrac{\partial E}{\partial b} = 2\sum [y_i - (a + bx_i)](-x_i) = 0\), so \(\sum x_iy_i - a\sum x_i - b\sum x_i^2 = 0\), that is, \(\sum xy = a\sum x + b\sum x^2\).
  3. Solve. Dividing the first equation by \(n\) gives \(\bar y = a + b\bar x\): the fitted line always passes through the point of means \((\bar x, \bar y)\). Putting \(a = \bar y - b\bar x\) into the second gives \[ b = \frac{\sum xy - n\bar x\bar y}{\sum x^2 - n\bar x^2} = \frac{n\sum xy - \sum x\sum y}{n\sum x^2 - (\sum x)^2} . \]

The first normal equation also says \(\sum (y_i - \hat y_i) = 0\): the residuals of a least-squares line add to zero. That gives a quick arithmetic check on any fit.

EXAMPLE 1

Fit a straight line to the data:

x12345
y37132131

\(\sum x = 15,\; \sum y = 75,\; \sum xy = 295,\; \sum x^2 = 55,\; n = 5\).

\(b = (5 \cdot 295 - 15 \cdot 75)/(5 \cdot 55 - 225) = (1475 - 1125)/(275 - 225) = 350/50 = 7\).

\(a = \bar y - b\bar x = 15 - 7 \cdot 3 = -6\). Fitted line: \(Y = -6 + 7X\).

EXAMPLE 2

Sales (₹ '000) of a company in 5 years are 12, 15, 18, 22, 25. Fit a linear trend (use \(x = 1, 2, 3, 4, 5\)).

\(\sum x = 15, \sum y = 92, \sum xy = 309, \sum x^2 = 55\).

\(b = (5 \cdot 309 - 15 \cdot 92)/50 = (1545 - 1380)/50 = 165/50 = 3.3\).

\(a = 18.4 - 3.3(3) = 8.5\). Trend line: \(\hat y = 8.5 + 3.3 x\). Predicted Year-6 sales \(= 8.5 + 3.3(6) = 28.3\), i.e. ₹28 300.

5. Fitting of Second-Degree Polynomial (Parabola)

Form: \(Y = a + bX + cX^2\).

NORMAL EQUATIONS \[ \sum y = n a + b \sum x + c \sum x^2 \] \[ \sum xy = a \sum x + b \sum x^2 + c \sum x^3 \] \[ \sum x^2 y = a \sum x^2 + b \sum x^3 + c \sum x^4 \]

Deriving the normal equations

With \(E = \sum [y_i - (a + bx_i + cx_i^2)]^2\), each partial derivative brings down the factor that multiplies its parameter: \(-1\) for \(a\), \(-x_i\) for \(b\), and \(-x_i^2\) for \(c\):

\[ \frac{\partial E}{\partial a} = -2\sum [y_i - (a + bx_i + cx_i^2)] = 0, \] \[ \frac{\partial E}{\partial b} = -2\sum x_i[y_i - (a + bx_i + cx_i^2)] = 0, \] \[ \frac{\partial E}{\partial c} = -2\sum x_i^2[y_i - (a + bx_i + cx_i^2)] = 0 . \]

Multiplying out and moving the unknowns to the right gives the three normal equations above. The pattern is the general rule: multiply the equation of the curve by each term that carries a parameter (\(1, x, x^2\)) and add over the data.

EXAMPLE 1

Fit parabola to data:

x01234
y11.81.32.56.3

\(\sum x = 10\), \(\sum y = 12.9\), \(\sum x^2 = 30\), \(\sum x^3 = 100\), \(\sum x^4 = 354\), \(\sum xy = 37.1\), \(\sum x^2 y = 130.3\).

Solve the 3×3 system:

Solution (by elimination): \(a \approx 1.42,\; b \approx -1.07,\; c \approx 0.55\).
Fitted parabola: \(Y \approx 1.42 - 1.07 X + 0.55 X^2\). Worked Problem 4 below carries out the elimination step by step.

EXAMPLE 2

For data with \(x = -2, -1, 0, 1, 2\) (centred origin), normal equations simplify because \(\sum x = \sum x^3 = 0\). The parabola \(Y = a + bx + cx^2\) reduces to:

This trick (centred \(x\)) is widely used in time-series trend fitting.

6. Fitting of Family of Exponential Curves

6.1 Type I: \(Y = a b^X\)

Take logarithms: \(\log Y = \log a + X \log b\). Let \(Y' = \log Y, A = \log a, B = \log b\). Then \(Y' = A + B X\) — fit a straight line.

\[ B \;=\; \dfrac{n \sum x Y' - \sum x \sum Y'}{n \sum x^2 - (\sum x)^2}, \qquad A \;=\; \overline{Y'} - B \bar x. \]

Then \(a = \text{antilog}(A),\; b = \text{antilog}(B)\).

6.2 Type II: \(Y = a e^{bX}\)

Same idea: \(\ln Y = \ln a + bX\). Fit straight line in \((x, \ln y)\).

With common logarithms. \(\log_{10} Y = \log_{10} a + (b\log_{10} e)X\). Put \(A = \log_{10} a\) and \(B = b\log_{10} e\); fit \(\log_{10} y = A + Bx\) as a straight line, then

\[ a = \text{antilog}(A), \qquad b = \frac{B}{\log_{10} e} = \frac{B}{0.4343} . \]

Both routes give the same \(a\) and \(b\). Natural logarithms are the shorter route when a calculator is at hand.

What the log transformation minimises

For curves fitted through logarithms (sections 6 and 7) the least-squares principle is applied to \(\log y\), not to \(y\). The fit minimises \(\sum (\log y_i - \log \hat y_i)^2\), so it controls relative errors, \(y_i/\hat y_i\), rather than the residuals \(y_i - \hat y_i\). It is the standard textbook method and is easy to compute, but the curve is not the least-squares curve in the original units. Always compare the fitted values with the data.

EXAMPLE 1

Fit \(Y = a b^X\) to:

x1234
y24816

\(\log y\) values: 0.301, 0.602, 0.903, 1.204. \(\sum x = 10,\; \sum \log y = 3.010,\; \sum x \log y = 9.030,\; \sum x^2 = 30\).

\(B = (4 \cdot 9.030 - 10 \cdot 3.010)/(4 \cdot 30 - 100)\) \(= (36.12 - 30.10)/20 = 0.301\); \(A = 3.010/4 - 0.301 \cdot 2.5\) \(= 0.7525 - 0.7525 = 0\).

\(\Rightarrow a = 10^0 = 1,\; b = 10^{0.301} = 2\). Fitted: \(Y = 1 \cdot 2^X = 2^X\). ✓

EXAMPLE 2

Population (in lakhs) of a city for 4 years:

Year (x)1234
Pop (y)1011.613.515.7

Fit \(y = ae^{bx}\). Step 1. \(\ln y\) = 2.3026, 2.4510, 2.6027, 2.7537, so \(\sum \ln y = 10.1099\), \(\sum x\ln y = 26.0273\), with \(\sum x = 10\), \(\sum x^2 = 30\), \(n = 4\).

Step 2. \(b = \dfrac{4(26.0273) - 10(10.1099)}{4(30) - 10^2} = \dfrac{3.0102}{20} = 0.1505\), and \(\ln a = (10.1099 - 10 \times 0.1505)/4 = 2.151\), so \(a = e^{2.151} = 8.60\).

Step 3. \(\hat y = 8.60\,e^{0.1505x}\). Each year multiplies the population by \(e^{0.1505} = 1.162\), a growth of about 16.2% a year; the fitted values 9.99, 11.61, 13.50, 15.69 match the data.

7. Fitting of Power Curve

Form: \(Y = a X^b\). Take logs: \(\log Y = \log a + b \log X\). Let \(X' = \log X,\; Y' = \log Y\):

\[ Y' \;=\; A + b X', \quad A = \log a. \]

Apply linear least squares to \((X', Y')\).

EXAMPLE 1

Fit \(Y = a X^b\) to:

x12345
y1491625

\(\log x\): 0, 0.301, 0.477, 0.602, 0.699; \(\log y\): 0, 0.602, 0.954, 1.204, 1.398.

Sums: \(\sum X' = 2.0792\), \(\sum Y' = 4.1584\), \(\sum X'^2 = 1.1693\), \(\sum X'Y' = 2.3386\), \(n = 5\). Then \(b = \dfrac{5(2.3386) - 2.0792(4.1584)}{5(1.1693) - 2.0792^2} = \dfrac{3.0469}{1.5234} = 2.000\) and \(A = (4.1584 - 2 \times 2.0792)/5 = 0\), so \(a = 10^0 = 1\) and \(Y = X^2\). ✓ (Every \(Y'\) is exactly \(2X'\), so the fit is exact.)

EXAMPLE 2

Allometric relation: weight \(W\) and length \(L\) of fish often follow \(W = aL^b\). Logs and least squares yield estimates of \(a\) and \(b\) (typically \(b \approx 3\) for isometric growth).

Worked Problems on Curve Fitting

Eight problems, grouped by the curve fitted. Each one sets up the normal equations, builds the table of sums, solves the equations step by step and checks the result. Constants are carried at full precision and rounded only when written: a small rounding in a coefficient that multiplies a large \(x^2\) can move an estimate a long way.

A. Straight Line

WORKED PROBLEM 1 — a line through eight points

Fit a straight line \(y = a + bx\) to:

\(x\)\(y\)\(x^2\)\(xy\)
2244
3399
542520
764942
866448
10810080
129144108
1310169130
6048564441

Normal equations with \(n = 8\), \(\sum x = 60\):

\[ 48 = 8a + 60b \quad\text{(i)}, \qquad 441 = 60a + 564b \quad\text{(ii)} . \]

Eliminate \(a\). Multiply (i) by \(7.5\): \(360 = 60a + 450b\). Subtract from (ii): \(81 = 114b\), so \(b = 0.7105\) \(= 27/38\).

Back-substitute. From (i), \(8a = 48 - 60 \times 0.7105 = 5.3684\), so \(a = 0.6711\).

Result. \(\hat y = 0.6711 + 0.7105x\). Check: \(\bar x = 7.5\), \(\bar y = 6\), and \(0.6711 + 0.7105 \times 7.5 = 6\): the line passes through \((\bar x, \bar y)\), as it must.

WORKED PROBLEM 2 — six evenly spaced points

Fit a straight line \(y = a + bx\) to:

\(x\)\(y\)\(x^2\)\(xy\)
1717
312936
5162580
72249154
92581225
1131121341
36113286843

Normal equations with \(n = 6\), \(\sum x = 36\):

\[ 113 = 6a + 36b \quad\text{(i)}, \qquad 843 = 36a + 286b \quad\text{(ii)} . \]

Eliminate \(a\). Multiply (i) by \(6\): \(678 = 36a + 216b\). Subtract from (ii): \(165 = 70b\), so \(b = 2.3571\) \(= 33/14\).

Back-substitute. From (i), \(6a = 113 - 36 \times 2.3571 = 28.1429\), so \(a = 4.6905\).

Result. \(\hat y = 4.6905 + 2.3571x\). Check: \(\bar x = 6\), \(\bar y = 18.8333\), and \(4.6905 + 2.3571 \times 6 = 18.833\): the line passes through \((\bar x, \bar y)\), as it must.

WORKED PROBLEM 3 — estimating beyond the data

Fit a straight line \(y = a + bx\) and estimate \(y\) at \(x = 7\) to:

\(x\)\(y\)\(x^2\)\(xy\)
122122
248496
3719213
48816352
59925495
610436624
21432911802

Normal equations with \(n = 6\), \(\sum x = 21\):

\[ 432 = 6a + 21b \quad\text{(i)}, \qquad 1802 = 21a + 91b \quad\text{(ii)} . \]

Eliminate \(a\). Multiply (i) by \(3.5\): \(1512 = 21a + 73.5b\). Subtract from (ii): \(290 = 17.5b\), so \(b = 16.5714\) \(= 116/7\).

Back-substitute. From (i), \(6a = 432 - 21 \times 16.5714 = 84\), so \(a = 14\).

Result. \(\hat y = 14 + 16.5714x\). Check: \(\bar x = 3.5\), \(\bar y = 72\), and \(14 + 16.5714 \times 3.5 = 72\): the line passes through \((\bar x, \bar y)\), as it must.

At \(x = 7\): \(\hat y = 14 + 16.5714 \times 7 = 130\).

A caution. \(x = 7\) lies outside the data, and the data are levelling off (88, 99, 104). The residuals \(-8.6, 0.9, 7.3, 7.7, 2.1, -9.4\) run negative, positive, negative: the points lie below the line at both ends and above it in the middle, the sign of a curve. A parabola fitted to the same data, \(\hat y = -11.5 + 35.696x - 2.732x^2\), has a residual sum of squares of 1.6 against the line's 280.3, and estimates 104.5 at \(x = 7\). Fig 1.2 shows both.

0 1 2 3 4 5 6 7 0 40 80 120 160 x y line: 130.0 parabola: 104.5 ŷ = 14 + 16.571x ŷ = -11.5 + 35.696x − 2.732x² ● observed
Fig 1.2 — Worked Problem 3. The least-squares line (blue) and, for comparison, the least-squares parabola (green), with the dashed parts extended to \(x = 7\). The data level off, so the line misses them in a pattern and its estimate at \(x = 7\) is too high; the parabola's residual sum of squares is 1.6 against the line's 280.3.

B. Second-degree Parabola

WORKED PROBLEM 4 — solving the three normal equations

Fit \(y = a + bx + cx^2\) to:

\(x\)\(y\)\(x^2\)\(x^3\)\(x^4\)\(xy\)\(x^2y\)
02.100000
11.61111.61.6
22481648
33.2927819.628.8
45.3166425621.284.8
1014.23010035436.4123.2
\[ 14.2 = 5a + 10b + 30c \;\text{(i)}, \qquad 36.4 = 10a + 30b + 100c \;\text{(ii)}, \] \[ 123.2 = 30a + 100b + 354c \;\text{(iii)} . \]
  1. Remove \(a\) from (ii): (ii) \(- 2\times\)(i) gives \(8 = 10b + 40c\) (iv).
  2. Remove \(a\) from (iii): (iii) \(- 6\times\)(i) gives \(38 = 40b + 174c\) (v).
  3. Remove \(b\): (v) \(- 4\times\)(iv) gives \(6 = 14c\), so \(c = 0.4286\).
  4. Back-substitute: from (iv), \(10b = 8 - 40(0.4286) = -9.1429\), so \(b = -0.9143\); from (i), \(5a = 14.2 - 10(-0.9143) - 30(0.4286) = 10.4857\), so \(a = 2.0971\).

Result. \(\hat y = 2.0971 - 0.9143x + 0.4286x^2\) (coefficients to four decimals). Check: the fitted values 2.1, 1.61, 1.98, 3.21, 5.3 add to 14.2, the same as \(\sum y\), as the first normal equation requires.

WORKED PROBLEM 5 — fuel use of a car

Fit a parabola to a car's fuel use \(y\) (litres per 100 km) at speed \(x\) km/hr, and estimate the fuel use at 150 km/hr.

Speed \(x\)30507090110130
Fuel \(y\)6.86.16.37.28.911.4

Code the speeds. With \(u = (x - 80)/10\) the speeds become \(u = -5, -3, -1, 1, 3, 5\), so \(\sum u = \sum u^3 = 0\) and the three normal equations nearly separate:

\(u\)−5−3−1135Total
\(uy\)−34−18.3−6.37.226.75732.3
\(u^2y\)17054.96.37.280.1285603.5

With \(\sum u^2 = 70\) and \(\sum u^4 = 1414\), the normal equations for \(y = A + Bu + Cu^2\) are

\[ 46.7 = 6A + 70C, \qquad 32.3 = 70B, \qquad 603.5 = 70A + 1414C . \]
  1. The middle equation alone gives \(B = 32.3/70 = 0.46143\).
  2. Multiply the first by \(70/6\): \(544.833 = 70A + 816.667C\). Subtract from the third: \(58.667 = 597.333C\), so \(C = 0.098214\).
  3. Then \(6A = 46.7 - 70(0.098214) = 39.825\), so \(A = 6.6375\).

Back to \(x\). Substituting \(u = (x - 80)/10\) and collecting powers of \(x\): \(a = A - 8B + 64C = 9.2318\), \(b = B/10 - 1.6C = -0.111\), \(c = C/100 = 0.0009821\). So

\[ \hat y = 9.2318 - 0.111x + 0.0009821x^2 , \]

which reproduces the data closely (6.79, 6.14, 6.27, 7.2, 8.91, 11.4).

Estimate at 150 km/hr (\(u = 7\)): \(A + 7B + 49C = 6.6375 + 3.23 + 4.8125 = 14.68\) litres per 100 km. Because \(c\) multiplies \(150^2 = 22\,500\), rounding it to two significant figures would move the estimate by about 0.05. And 150 km/hr is beyond the fastest speed observed, so the estimate assumes the parabola continues.

C. Power Curve

WORKED PROBLEM 6 — fitting \(y = ax^b\)

Fit \(y = ax^b\) to:

\(x\)\(y\)\(X = \log x\)\(Y = \log y\)\(X^2\)\(XY\)
18200.00002.91380.00000.0000
26100.30102.78530.09060.8384
34300.47712.63350.22761.2564
41600.60212.20410.36251.3271
5950.69901.97770.48861.3824
6400.77821.60210.60561.2468
Total2.857414.11651.77496.0511

Normal equations for \(Y = A + bX\), \(A = \log a\):

\[ 14.1165 = 6A + 2.8574b, \qquad 6.0511 = 2.8574A + 1.7749b . \]

Solve. \(b = \dfrac{6(6.0511) - 2.8574(14.1165)}{6(1.7749) - 2.8574^2} = \dfrac{-4.0299}{2.4847} = -1.6219\), and \(A = (14.1165 - (-1.6219)(2.8574))/6 = 3.1252\).

Result. \(a = \text{antilog}(3.1252) \approx 1334\), so \(\hat y = 1334\,x^{-1.622}\).

How good is the fit? The fitted values are 1334, 433, 225, 141, 98, 73 against 820, 610, 430, 160, 95, 40: too high at both ends and too low in the middle (Fig 1.3). The calculation is right, but a power law does not describe these data well. Plotting \(\log y\) against \(\log x\) first, to see whether the points lie near a line, would have shown that.

0 1 2 3 4 5 6 0 350 700 1050 1400 x y ŷ = 1334 x^(−1.622) ● observed ┆ residual
Fig 1.3 — Worked Problem 6. The fitted power curve against the data, with the residuals dashed. The curve is the best fit on the log scale, but it misses the data in a clear pattern (too high at the ends, too low in the middle): a power law is not a good description of these figures.

D. Exponential Curves

WORKED PROBLEM 7 — fitting \(y = ab^x\)

Fit \(y = ab^x\) to:

\(x\)\(y\)\(Y = \log y\)\(x^2\)\(xY\)
11.40.146110.1461
21.90.278840.5576
32.50.397991.1937
43.60.5563162.2252
54.80.6812253.4060
66.70.8261364.9566
79.00.9542496.6794
812.61.1004648.8032
364.941020427.9678

Normal equations for \(Y = A + Bx\), \(A = \log a\), \(B = \log b\): \(4.9410 = 8A + 36B\) and \(27.9678 = 36A + 204B\).

Solve. \(B = \dfrac{8(27.9678) - 36(4.9410)}{8(204) - 36^2} = \dfrac{45.8664}{336} = 0.13651\), and \(A = (4.9410 - 36 \times 0.13651)/8 = 0.0033\).

Result. \(a = \text{antilog}(0.0033) = 1.008\) and \(b = \text{antilog}(0.13651) = 1.369\), so \(\hat y = 1.008\,(1.369)^x\): \(y\) grows by about 37% for each unit of \(x\). The fitted values (1.38, 1.89, 2.59, 3.54, 4.85, 6.64, 9.10, 12.46) follow the data closely.

WORKED PROBLEM 8 — fitting \(y = ae^{bx}\)

Fit \(y = ae^{bx}\) to:

\(x\)\(y\)\(Y = \log y\)\(x^2\)\(xY\)
12.30.361710.3617
25.10.707641.4152
312.21.086493.2592
427.91.4456165.7824
5661.8195259.0975
61502.17613613.0566
217.59699132.9726

Normal equations for \(Y = A + Bx\), with \(A = \log a\) and \(B = b\log_{10} e\):

\[ 7.5969 = 6A + 21B, \qquad 32.9726 = 21A + 91B . \]

Solve. \(B = \dfrac{6(32.9726) - 21(7.5969)}{6(91) - 21^2} = \dfrac{38.3007}{105} = 0.36477\), and \(A = (7.5969 - 21 \times 0.36477)/6 = -0.0105\).

Back-transform. \(a = \text{antilog}(-0.0105) = 0.976\) and \(b = B/\log_{10} e = 0.36477/0.43429 = 0.840\). So \(\hat y = 0.976\,e^{0.840x}\): the fitted values are 2.3, 5.2, 12.1, 28.1, 65.1, 150.7. Natural logarithms give the same \(a\) and \(b\) directly.

Key Take-aways