Skip to main content

Least squares: y = ax + b + c/x

Short answer

Minimize S = sum(y_i - a x_i - b - c/x_i)^2. The normal equations are a sum x^2 + b sum x + cn = sum xy, a sum x + bn + c sum(1/x) = sum y, and an + b sum(1/x) + c sum(1/x^2) = sum(y/x). Solve for a, b, c; the illustration gives y = 1.9304x + 3.3318 + 0.6507/x.

The following data are provided; use least-squares method to fit these data with the following model, y = ax + b + c/x. [The data table is not given in the printed paper.]

The data table is not printed in the question, so the method is given in general form and then applied to an assumed data set to show the numbers.

Normal equations for y = ax + b + c/x

The model is linear in the unknowns a, b, c. Minimise

S = Σ (yᵢ − a xᵢ − b − c/xᵢ)²

Setting ∂S/∂a = ∂S/∂b = ∂S/∂c = 0:

a Σx²  + b Σx    + c·n     = Σxy        ... (1)
a Σx   + b·n     + c Σ(1/x) = Σy        ... (2)
a·n    + b Σ(1/x) + c Σ(1/x²) = Σ(y/x)  ... (3)

(Here x·(1/x) = 1, so the Σ of that cross term is n.)

Procedure

  1. Tabulate x, y, 1/x, 1/x², x², xy, y/x and find the sums.
  2. Substitute the sums in (1), (2), (3).
  3. Solve the three equations by Gauss elimination for a, b, c.

Illustration with assumed data (n = 5)

xy1/x1/x²x²xyy/x
15.91.00001.000015.905.9000
27.60.50000.2500415.203.8000
39.20.33330.1111927.603.0667
411.30.25000.06251645.202.8250
513.10.20000.04002565.502.6200
Σ=1547.12.28331.463655159.418.2117
55a     + 15b      + 5c      = 159.4
15a     + 5b       + 2.2833c = 47.1
5a      + 2.2833b + 1.4636c = 18.2117

Solving: a = 1.9304, b = 3.3318, c = 0.6507.

Answer: y = 1.9304x + 3.3318 + 0.6507/x for the assumed data; for the actual paper, insert its own x, y values in the same sums.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 4 questions →