Least-Squares Regression and Calibration Curves

A working analyst almost never measures concentration directly. Instead, an instrument reports a signal. This could be an absorbance, a peak area, or a current. The analyst must translate that signal back into a concentration. This is done using a calibration curve built from standards of known composition. Every such curve is a claim about a straight line drawn through noisy points. The honest way to draw that line is the method of least squares. This matters because the calibration line is the single most heavily used piece of statistics in the analytical laboratory. A drug-quality assay, a blood-lead determination, a water-hardness test, a mass-spectrometer tune — all rest on a slope and an intercept. These come from five or six standards run once each. If the fitting procedure is sloppy, or if its assumptions are silently violated, every reported concentration downstream inherits the error. Often no one notices. The big picture is this: least-squares regression finds the line y=mx+by = mx + b. This line minimizes the sum of squared vertical deviations between observed signals and the line. It assumes the x-values (concentrations) are known essentially exactly. All the scatter is assumed to live in y (the signal). This asymmetry — treating x as fixed and y as random — is what makes the algebra tractable. It is also the method's most commonly forgotten assumption. From the fitted slope and intercept, and from the residuals about the line, we can compute several things. These include a correlation coefficient, standard errors on the slope and intercept, and eventually a standard error on a concentration predicted from an unknown's signal. This article builds the least-squares machinery from the minimization principle itself. It works three realistic calibration problems by hand. These are a UV-Vis absorbance calibration, a chromatographic peak-area calibration with an outlier, and a full worked confidence-interval problem. It then surveys where regression calibration is used across modern instrumental analysis. It assumes familiarity with the Standard Deviation and Variance and The Mean, Median and Mode. It also sets up the ideas needed for Uncertainty in Calibration Results and Limits of Detection.

Key takeaways
  • Least squares finds mm and bb in y=mx+by = mx + b by minimizing ∑(yi−mxi−b)2\sum (y_i - mx_i - b)^2, the sum of squared vertical residuals.
  • The normal equations give closed-form slope and intercept in terms of sums of xx, yy, xyxy, and x2x^2 — no iteration needed for a straight line.
  • The correlation coefficient rr measures how tightly points hug the line, but a high ∣r∣|r| does not certify linearity or accuracy.
  • Residual standard deviation srs_r quantifies scatter about the fitted line and feeds directly into standard errors on slope, intercept, and predicted concentration.
  • Standard least squares assumes constant variance (homoscedasticity) in yy across the whole concentration range; violating this calls for weighted least squares.
  • Key idea: the calibration line is a statistical estimate, not a geometric fact — every slope, intercept, and predicted concentration carries an uncertainty computed from the scatter of the calibration points themselves.

Where this lives today

Least-squares calibration is the invisible workhorse behind nearly every quantitative instrumental method. In pharmaceutical quality control, HPLC assays for drug potency are validated against forced-degradation and linearity studies that are, at their core, least-squares fits of peak area versus concentration across the specified working range, with acceptance criteria on r2r^2, residuals, and confidence intervals written directly into regulatory method validation protocols (ICH Q2). In clinical and environmental laboratories, blood-lead analysis by graphite-furnace atomic absorption, and water-quality determinations of nitrate, phosphate, or trace metals by ICP-MS, all report concentrations by inverting a freshly run least-squares calibration curve, often with an internal standard added specifically to reduce scatter and tighten srs_r. In modern chromatography and mass spectrometry, software packages perform weighted least-squares fits automatically, often defaulting to 1/x1/x or 1/x21/x^2 weighting to correct for the heteroscedastic ("funnel-shaped") variance typical of chromatographic peak areas across a wide dynamic range — a direct, software-embedded response to the trap described above. Genomic quantification by quantitative PCR (qPCR) relies on a least-squares fit of cycle threshold versus the logarithm of starting copy number, a calibration curve in essentially the same statistical sense as a UV-Vis absorbance curve. Biosensor and immunoassay development (ELISA, lateral-flow tests) likewise depends on fitting a working range — often with a nonlinear four-parameter logistic model rather than a straight line, but built on the same least-squares residual-minimization principle. And in metrology and standards laboratories, the propagated uncertainty of a calibration curve — the very sxus_{x_u} derived here — is a required, auditable component of any reported measurement uncertainty budget under ISO/IEC 17025 accreditation.

Ask the tutor: How do I decide whether my calibration data need weighted least squares instead of the ordinary unweighted fit?

The physical picture

Picture a UV-Vis calibration for an absorbing analyte: five standards of increasing concentration are placed in the spectrophotometer, and each gives an absorbance reading. Plotted on a graph with concentration xix_i on the horizontal axis and absorbance yiy_i on the vertical axis, the five points do not fall on a perfect line — the cuvette has small optical imperfections, the analyst's pipetting has small volume errors that manifest as signal noise, the detector has electronic noise, and stray light nudges each reading. What we want is the single straight line that best represents the underlying calibration relationship y=mx+by = mx + b, so that a future absorbance reading from an unknown sample can be inverted to a concentration. The key modeling decision is where the scatter lives. In nearly every calibration, the standard concentrations are prepared by careful volumetric dilution from a certified stock, so their uncertainty is small compared to the noise in the instrument's response. We therefore treat xix_i as fixed, known constants and treat yiy_i as random variables scattered around the true line y=mx+by = mx + b with some constant variance σ2\sigma^2. This is the ordinary (unweighted) least-squares model. The "best" line is defined as the one minimizing the sum of squared vertical distances from each point to the line — vertical, not perpendicular, because the error model puts all the randomness in yy. Once the line is fit, three numbers matter beyond mm and bb: the residual standard deviation srs_r (how much scatter is left after fitting), the correlation coefficient rr (how strongly xx and yy track together), and the standard errors of mm and bb (how precisely we know the line itself, given only a finite number of standards). All of these are computed from the same handful of sums: ∑xi\sum x_i, ∑yi\sum y_i, ∑xiyi\sum x_i y_i, ∑xi2\sum x_i^2, and ∑yi2\sum y_i^2.

Figure
Five calibration points with the least-squares line and vertical residuals
concentration, x (µg/mL) absorbance, y 0 2 4 6 8 y = mx + b standards

The core ideas

The least-squares problem is to choose mm and bb to minimize the sum of squared vertical residuals,

S=∑i=1n(yi−mxi−b)2S = \sum_{i=1}^{n} \left(y_i - m x_i - b\right)^2

where: yiy_i is the measured signal for standard ii, xix_i is its known concentration, nn is the number of calibration points, and SS is the objective function being minimized. Setting the partial derivatives of SS with respect to mm and bb to zero yields the closed-form least-squares estimates,

m=n∑xiyi−∑xi∑yin∑xi2−(∑xi)2m = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{n \sum x_i^2 - \left(\sum x_i\right)^2}

where: mm is the fitted slope (sensitivity, e.g. absorbance per µg/mL), and all sums run over the nn calibration points.

b=yˉ−mxˉb = \bar{y} - m\bar{x}

where: yˉ\bar y and xˉ\bar x are the means of the yy- and xx-values, so the fitted line is forced to pass through the centroid (xˉ,yˉ)(\bar x, \bar y) of the data. The scatter of points about the fitted line is captured by the residual standard deviation,

sr=∑i=1n(yi−mxi−b)2n−2s_r = \sqrt{\frac{\sum_{i=1}^n \left(y_i - m x_i - b\right)^2}{n-2}}

where: the divisor n−2n-2 reflects the two degrees of freedom used up in estimating mm and bb from the data; srs_r has the same units as yy and is sometimes called sy/xs_{y/x}. From srs_r we obtain the standard errors of the slope and intercept,

sm=sr∑(xi−xˉ)2,sb=sr∑xi2n∑(xi−xˉ)2s_m = \frac{s_r}{\sqrt{\sum (x_i - \bar x)^2}}, \qquad s_b = s_r\sqrt{\frac{\sum x_i^2}{n\sum (x_i-\bar x)^2}}

where: sms_m and sbs_b quantify how much mm and bb would be expected to vary if the calibration were repeated with fresh noise, holding the same xix_i design. Finally, the (Pearson) correlation coefficient measures the strength of the linear association,

r=n∑xiyi−∑xi∑yi[n∑xi2−(∑xi)2][n∑yi2−(∑yi)2]r = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{\sqrt{\left[n\sum x_i^2 - \left(\sum x_i\right)^2\right]\left[n\sum y_i^2 - \left(\sum y_i\right)^2\right]}}

where: rr ranges from −1-1 to +1+1; r2r^2 (the coefficient of determination) is the fraction of the variance in yy "explained" by the linear relationship with xx.

Reading these equations together: the slope mm is the calibration sensitivity — how much signal you gain per unit concentration — and it is exactly the quantity you later divide an unknown's net signal by to get a concentration. The intercept bb is the blank-level signal (ideally near zero, but rarely exactly zero due to background, scattering, or a small reagent blank). The residual standard deviation srs_r is the "noise floor" of the fit and drives essentially every downstream uncertainty statement, including detection limits. The correlation coefficient rr is often over-trusted: it can be very close to ±1\pm 1 even for a curved data set with only mild scatter, so a high rr is necessary, not sufficient, evidence of a good linear fit — always plot the residuals too.

Derivation ADeriving the normal equations by minimizing the sum of squared residuals

Goal. Starting from the objective function S=∑i(yi−mxi−b)2S = \sum_i (y_i - mx_i - b)^2, derive the closed-form expressions for mm and bb that minimize SS.

Step 1 — Set up the two partial derivatives. Since SS is a smooth quadratic function of the two unknowns mm and bb, its minimum occurs where both partial derivatives vanish simultaneously:

∂S∂b=−2∑i(yi−mxi−b)=0\frac{\partial S}{\partial b} = -2\sum_i (y_i - mx_i - b) = 0
∂S∂m=−2∑ixi(yi−mxi−b)=0\frac{\partial S}{\partial m} = -2\sum_i x_i(y_i - mx_i - b) = 0

These are called the normal equations. Dividing each by −2-2 and expanding the sums term by term gives two linear equations in the two unknowns mm and bb.

Step 2 — Solve the intercept equation. Expanding the first equation,

∑iyi−m∑ixi−nb=0\sum_i y_i - m\sum_i x_i - nb = 0

Dividing through by nn and rearranging,

b=yˉ−mxˉb = \bar y - m\bar x

This says the fitted line must pass through the centroid of the data — a useful sanity check on any regression output.

Step 3 — Substitute into the slope equation. Expanding the second normal equation,

∑ixiyi−m∑ixi2−b∑ixi=0\sum_i x_i y_i - m\sum_i x_i^2 - b\sum_i x_i = 0

Substitute b=yˉ−mxˉb = \bar y - m\bar x and ∑ixi=nxˉ\sum_i x_i = n\bar x:

∑ixiyi−m∑ixi2−(yˉ−mxˉ)(nxˉ)=0\sum_i x_i y_i - m\sum_i x_i^2 - (\bar y - m\bar x)(n\bar x) = 0
∑ixiyi−nxˉyˉ=m(∑ixi2−nxˉ2)\sum_i x_i y_i - n\bar x\bar y = m\left(\sum_i x_i^2 - n\bar x^2\right)

Step 4 — Isolate m and convert to raw sums. Solving for mm,

m=∑ixiyi−nxˉyˉ∑ixi2−nxˉ2m = \frac{\sum_i x_i y_i - n\bar x \bar y}{\sum_i x_i^2 - n\bar x^2}

Multiplying numerator and denominator by nn and using nxˉ=∑xin\bar x = \sum x_i, nyˉ=∑yin\bar y = \sum y_i, this becomes the standard computational form,

m=n∑xiyi−∑xi∑yin∑xi2−(∑xi)2m = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{n\sum x_i^2 - \left(\sum x_i\right)^2}

This is exactly the slope formula stated above; Step 2's result for bb, evaluated at this mm, completes the fit. Because SS is a positive-definite quadratic form in (m,b)(m,b) for any data set with at least two distinct xix_i values, this stationary point is guaranteed to be the unique global minimum, not merely a saddle point.

Go deeper · Derivation B · 1 minPropagating the fit's scatter into a standard error on a predicted concentration
Derivation BPropagating the fit's scatter into a standard error on a predicted concentration

Goal. Given the fitted line y^=mx+b\hat y = mx + b and residual standard deviation srs_r, derive the standard error in a concentration xux_u predicted from an unknown's measured signal yuy_u.

Step 1 — Invert the calibration line. An unknown gives a single measured signal yuy_u (or the mean of several replicate readings). Solving the fitted line for xx,

xu=yu−bmx_u = \frac{y_u - b}{m}

This value is an estimate, not an exact concentration, because both yuy_u (subject to measurement noise) and m,bm, b (subject to fitting uncertainty from the finite calibration set) carry error.

Step 2 — Identify the two contributing sources of variance. The full propagated variance in xux_u has a contribution from the noise in the unknown's own reading and a contribution from the uncertainty in the calibration line itself, which is least precise far from the centroid xˉ\bar x of the standards. The standard treatment (assuming MM replicate measurements of the unknown, each with the same variance sr2s_r^2 as the calibration residuals) gives:

sxu=srm1M+1n+(yu−yˉ)2m2∑i(xi−xˉ)2s_{x_u} = \frac{s_r}{m}\sqrt{\frac{1}{M} + \frac{1}{n} + \frac{(y_u - \bar y)^2}{m^2\sum_i (x_i - \bar x)^2}}

where MM is the number of replicate readings of the unknown and nn is the number of calibration standards.

Step 3 — Interpret each term physically. The 1/M1/M term shrinks as you average more replicate readings of the unknown — classic averaging behavior. The 1/n1/n term shrinks as you use more calibration standards. The third term grows the farther the unknown's signal yuy_u sits from the calibration centroid yˉ\bar y, which is the algebraic reason calibration curves are least trustworthy at their extremes: extrapolating (or even reading near the edges) always costs more in uncertainty than reading near the middle of the working range.

Step 4 — Confidence interval. Multiplying sxus_{x_u} by the appropriate Student's tt value at n−2n-2 degrees of freedom and the desired confidence level gives the confidence interval on the reported concentration,

xu±tn−2 sxux_u \pm t_{n-2}\, s_{x_u}

This formula is the direct bridge from a bare least-squares fit to a defensible, reported concentration-with-uncertainty — the subject taken up in full in Uncertainty in Calibration Results.

Worked examples

Example 1 — Foundational: fitting a five-point absorbance calibration by hand. A spectrophotometric calibration for a colored complex gives the following standard concentrations and absorbances:

xix_i (µg/mL)yiy_i (absorbance)
1.00.052
2.00.108
4.00.206
6.00.297
8.00.398

Compute the required sums with n=5n = 5:

∑xi=1.0+2.0+4.0+6.0+8.0=21.0\sum x_i = 1.0+2.0+4.0+6.0+8.0 = 21.0
∑yi=0.052+0.108+0.206+0.297+0.398=1.061\sum y_i = 0.052+0.108+0.206+0.297+0.398 = 1.061
∑xiyi=(1.0)(0.052)+(2.0)(0.108)+(4.0)(0.206)+(6.0)(0.297)+(8.0)(0.398)\sum x_i y_i = (1.0)(0.052)+(2.0)(0.108)+(4.0)(0.206)+(6.0)(0.297)+(8.0)(0.398)
∑xiyi=0.052+0.216+0.824+1.782+3.184=6.058\sum x_i y_i = 0.052+0.216+0.824+1.782+3.184 = 6.058
∑xi2=1.0+4.0+16.0+36.0+64.0=121.0\sum x_i^2 = 1.0+4.0+16.0+36.0+64.0 = 121.0

Now apply the slope formula:

m=n∑xiyi−∑xi∑yin∑xi2−(∑xi)2=5(6.058)−(21.0)(1.061)5(121.0)−(21.0)2m = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{n\sum x_i^2 - (\sum x_i)^2} = \frac{5(6.058) - (21.0)(1.061)}{5(121.0) - (21.0)^2}
m=30.290−22.281605.0−441.0=8.009164.0=0.04884 (absorbance per µg/mL)m = \frac{30.290 - 22.281}{605.0 - 441.0} = \frac{8.009}{164.0} = 0.04884 \text{ (absorbance per µg/mL)}

For the intercept, first find xˉ=21.0/5=4.20\bar x = 21.0/5 = 4.20 µg/mL and yˉ=1.061/5=0.2122\bar y = 1.061/5 = 0.2122:

b=yˉ−mxˉ=0.2122−(0.04884)(4.20)=0.2122−0.2051=0.0071b = \bar y - m\bar x = 0.2122 - (0.04884)(4.20) = 0.2122 - 0.2051 = 0.0071

So the fitted calibration line is y=0.0488x+0.0071y = 0.0488x + 0.0071 (slope to 3 sig figs, intercept to 2 sig figs given the noise level). This small positive intercept is typical — it reflects a slight reagent-blank absorbance or minor cell mismatch rather than a real signal from zero concentration. To get the residual standard deviation, compute the predicted y^i\hat y_i and residuals at each point:

xix_iyiy_iy^i=0.04884xi+0.0071\hat y_i = 0.04884x_i + 0.0071yi−y^iy_i - \hat y_i(yi−y^i)2(y_i-\hat y_i)^2
1.00.0520.0559−0.00391.52×10−51.52\times10^{-5}
2.00.1080.1048+0.00321.02×10−51.02\times10^{-5}
4.00.2060.2025+0.00351.23×10−51.23\times10^{-5}
6.00.2970.3002−0.00321.02×10−51.02\times10^{-5}
8.00.3980.3979+0.00011×10−81\times10^{-8}
∑(yi−y^i)2≈5.00×10−5\sum (y_i-\hat y_i)^2 \approx 5.00\times10^{-5}
sr=5.00×10−55−2=1.67×10−5=4.08×10−3s_r = \sqrt{\frac{5.00\times10^{-5}}{5-2}} = \sqrt{1.67\times10^{-5}} = 4.08\times10^{-3}

The scatter about the line is about 0.004 absorbance units — small compared to the signal range (0.05 to 0.40), consistent with a good instrumental calibration. As a limiting-case check: if every point fell exactly on the line, all residuals would be zero, sr→0s_r \to 0, and the fit would be perfect — the formula correctly degenerates to that limit since the numerator sum vanishes term by term.

Example 2 — Applied: chromatographic peak-area calibration, and the effect of a suspect point. A gas-chromatography calibration for a pesticide residue uses six standards (concentration in ng/mL, peak area in arbitrary detector units):

xix_iyiy_i
0.501,180
1.002,350
2.004,900
3.007,010
4.009,430
5.0015,200

Before fitting blindly, plot the data mentally: the first five points rise roughly linearly with a slope near 2350 area units per ng/mL, but the sixth point (5.00 ng/mL, 15,200) is far above where that trend would predict — extrapolating from the first five points, 5.00 ng/mL should give roughly 2350×5.00≈11,7502350 \times 5.00 \approx 11{,}750, not 15,200. This is a strong signal of a possible outlier (e.g., a co-eluting interference, a syringe error, or detector saturation behaving non-linearly at high concentration), and it should be flagged before fitting, not simply thrown into the same automatic least-squares machinery as the rest. Fitting all six points anyway, with n=6n=6:

∑xi=0.50+1.00+2.00+3.00+4.00+5.00=15.50\sum x_i = 0.50+1.00+2.00+3.00+4.00+5.00 = 15.50
∑yi=1180+2350+4900+7010+9430+15200=40,070\sum y_i = 1180+2350+4900+7010+9430+15200 = 40{,}070
∑xiyi=590.0+2350.0+9800.0+21,030.0+37,720.0+76,000.0=147,490.0\sum x_i y_i = 590.0+2350.0+9800.0+21{,}030.0+37{,}720.0+76{,}000.0 = 147{,}490.0
∑xi2=0.25+1.00+4.00+9.00+16.00+25.00=55.25\sum x_i^2 = 0.25+1.00+4.00+9.00+16.00+25.00 = 55.25
m=6(147,490)−(15.50)(40,070)6(55.25)−(15.50)2=884,940−621,085331.5−240.25=263,85591.25=2892m = \frac{6(147{,}490) - (15.50)(40{,}070)}{6(55.25) - (15.50)^2} = \frac{884{,}940 - 621{,}085}{331.5 - 240.25} = \frac{263{,}855}{91.25} = 2892
b=yˉ−mxˉ=40,0706−2892(15.506)=6678.3−7471.7=−793.3b = \bar y - m\bar x = \frac{40{,}070}{6} - 2892\left(\frac{15.50}{6}\right) = 6678.3 - 7471.7 = -793.3

Now refit using only the first five, well-behaved points (n=5n=5):

∑xi=10.50,∑yi=24,870,∑xiyi=590+2350+9800+21,030+37,720=71,490,∑xi2=30.25\sum x_i = 10.50,\quad \sum y_i = 24{,}870,\quad \sum x_i y_i = 590+2350+9800+21{,}030+37{,}720 = 71{,}490,\quad \sum x_i^2 = 30.25
m=5(71,490)−(10.50)(24,870)5(30.25)−(10.50)2=357,450−261,135151.25−110.25=96,31541.0=2349.1m = \frac{5(71{,}490) - (10.50)(24{,}870)}{5(30.25) - (10.50)^2} = \frac{357{,}450 - 261{,}135}{151.25 - 110.25} = \frac{96{,}315}{41.0} = 2349.1
b=24,8705−2349.1(10.505)=4974.0−4933.1=40.9b = \frac{24{,}870}{5} - 2349.1\left(\frac{10.50}{5}\right) = 4974.0 - 4933.1 = 40.9

Removing the suspect point changes the slope from 2892 to 2349 — a 19% shift — and flips the intercept from strongly negative to nearly zero, which is the physically expected behavior (near-zero blank signal). This is a striking demonstration of leverage: because the point at x=5.00x = 5.00 sits at the extreme edge of the concentration range, it has outsized influence on the fitted line (the third term inside the square root of sxus_{x_u} above shows exactly why extreme-xx points carry more statistical weight in a least-squares fit). Before discarding the point permanently, the analyst should re-inject that standard, check for detector nonlinearity or saturation at high concentration, or apply a formal outlier test (such as the Grubbs test) rather than removing it purely because it "looks wrong" — but the numerical comparison here demonstrates precisely why a single anomalous point deserves scrutiny before it is allowed to set the working sensitivity of an entire assay.

Example 3 — Exam-level: full confidence interval on an unknown's concentration. Using the five well-behaved GC points from Example 2 (m=2349.1m = 2349.1, b=40.9b = 40.9 area units, n=5n = 5), an unknown sample is injected in triplicate (M=3M = 3) and gives a mean peak area of yˉu=5,560\bar y_u = 5{,}560 area units. Report the concentration with a 95% confidence interval. First compute the residual standard deviation for the five-point fit. The predicted values y^i=2349.1xi+40.9\hat y_i = 2349.1 x_i + 40.9 are:

xix_iyiy_iy^i\hat y_iyi−y^iy_i - \hat y_i
0.5011801215.5−35.5
1.0023502390.0−40.0
2.0049004739.1+160.9
3.0070107088.2−78.2
4.0094309437.3−7.3
∑(yi−y^i)2=35.52+40.02+160.92+78.22+7.32\sum(y_i-\hat y_i)^2 = 35.5^2+40.0^2+160.9^2+78.2^2+7.3^2
=1260.3+1600.0+25,888.8+6115.2+53.3=34,917.6= 1260.3+1600.0+25{,}888.8+6115.2+53.3 = 34{,}917.6
sr=34,917.65−2=11,639.2=107.9 area unitss_r = \sqrt{\frac{34{,}917.6}{5-2}} = \sqrt{11{,}639.2} = 107.9 \text{ area units}

Next, find the unknown's concentration from the inverted calibration line:

xu=yˉu−bm=5560−40.92349.1=5519.12349.1=2.349 ng/mLx_u = \frac{\bar y_u - b}{m} = \frac{5560 - 40.9}{2349.1} = \frac{5519.1}{2349.1} = 2.349 \text{ ng/mL}

Now compute ∑(xi−xˉ)2\sum(x_i - \bar x)^2 for the five standards, with xˉ=10.50/5=2.10\bar x = 10.50/5 = 2.10:

∑(xi−xˉ)2=(0.50−2.10)2+(1.00−2.10)2+(2.00−2.10)2+(3.00−2.10)2+(4.00−2.10)2\sum(x_i-\bar x)^2 = (0.50-2.10)^2+(1.00-2.10)^2+(2.00-2.10)^2+(3.00-2.10)^2+(4.00-2.10)^2
=(−1.60)2+(−1.10)2+(−0.10)2+(0.90)2+(1.90)2=2.56+1.21+0.01+0.81+3.61=8.20= (-1.60)^2+(-1.10)^2+(-0.10)^2+(0.90)^2+(1.90)^2 = 2.56+1.21+0.01+0.81+3.61 = 8.20

Apply the standard-error formula from the second derivation, with M=3M = 3 replicate unknown readings, n=5n = 5 standards, and yˉ=4974.0\bar y = 4974.0:

sxu=srm1M+1n+(yˉu−yˉ)2m2∑(xi−xˉ)2s_{x_u} = \frac{s_r}{m}\sqrt{\frac{1}{M}+\frac{1}{n}+\frac{(\bar y_u - \bar y)^2}{m^2\sum(x_i-\bar x)^2}}

Compute the third term inside the root first:

(yˉu−yˉ)2=(5560−4974.0)2=(586.0)2=343,396(\bar y_u - \bar y)^2 = (5560 - 4974.0)^2 = (586.0)^2 = 343{,}396
m2∑(xi−xˉ)2=(2349.1)2(8.20)=5,518,271×8.20=45,249,822m^2\sum(x_i-\bar x)^2 = (2349.1)^2(8.20) = 5{,}518{,}271 \times 8.20 = 45{,}249{,}822
343,39645,249,822=0.00759\frac{343{,}396}{45{,}249{,}822} = 0.00759

Add the three terms:

13+15+0.00759=0.3333+0.2000+0.0076=0.5409\frac{1}{3}+\frac{1}{5}+0.00759 = 0.3333+0.2000+0.0076 = 0.5409
0.5409=0.7355\sqrt{0.5409} = 0.7355

Finally,

sxu=107.92349.1(0.7355)=(0.04593)(0.7355)=0.03378 ng/mLs_{x_u} = \frac{107.9}{2349.1}(0.7355) = (0.04593)(0.7355) = 0.03378 \text{ ng/mL}

For a 95% confidence interval with n−2=3n-2 = 3 degrees of freedom, t3,0.025=3.182t_{3,0.025} = 3.182:

xu±t sxu=2.349±(3.182)(0.03378)=2.349±0.1075 ng/mLx_u \pm t\,s_{x_u} = 2.349 \pm (3.182)(0.03378) = 2.349 \pm 0.1075 \text{ ng/mL}

The reported result is xu=2.35±0.11x_u = 2.35 \pm 0.11 ng/mL (95% confidence, 3 degrees of freedom). Notice the interval is dominated by the small number of degrees of freedom (only 3, giving a large tt-multiplier) rather than by sxus_{x_u} itself — a direct illustration of why calibration curves built from more than five or six standards give tighter, more defensible confidence intervals, since tt shrinks toward 1.96 as n−2n-2 grows large. As a limiting-case check: if the unknown's signal had exactly equaled yˉ=4974.0\bar y = 4974.0 (the calibration centroid), the third term under the root would vanish entirely, leaving the smallest possible sxus_{x_u} — precisely confirming that predictions are most precise at the center of the calibration range and degrade toward the edges.

Limiting cases, scope & common traps

SituationWhat happens to the fitCorrect practice
xx-values have negligible uncertainty, yy is noisyStandard (unweighted) least squares applies exactly as derivedUse ordinary least squares as shown above
Variance in yy grows with concentration (common in chromatography, heteroscedastic detectors)Unweighted fit over-weights the high-concentration points, biasing the low endUse weighted least squares, weighting each point by 1/σi21/\sigma_i^2
Only 2 calibration pointssrs_r is undefined (n−2=0n-2 = 0); no way to estimate residual scatterAlways use at least 3, and typically 5–8, standards
Working range spans several orders of magnitude with a curved response near saturationForcing a straight line through curved data gives a deceptively high rr but systematic residual trendsRestrict the range, or fit an explicit nonlinear (e.g., quadratic) calibration model
Both xx and yy carry comparable random error (e.g., two independently measured quantities, not a true calibration)Ordinary least squares slope is biased toward zero (attenuated)Use Deming regression or orthogonal regression instead
Unknown's signal falls near the edge, or beyond, the calibration rangesxus_{x_u} grows sharply (third term in the confidence-interval formula)Bracket unknowns within the calibrated range; never extrapolate for quantitative work

The chemist behind it

The method of least squares was not invented for chemistry at all — it emerged from a fierce priority dispute in celestial mechanics at the turn of the nineteenth century, and analytical chemistry only adopted it wholesale once instrumental methods (spectrophotometry, chromatography) began generating enough calibration data to make manual curve-fitting by eye unacceptably subjective.

Origins · 1 minCarl Friedrich Gauss and how this was discovered
CF
Carl Friedrich Gauss
1777–1855 · Göttingen, German Empire

Gauss developed and used the method of least squares as early as 1795, applying it to reconcile noisy astronomical observations of planetary and asteroid orbits — most famously using it in 1801 to relocate the "lost" dwarf planet Ceres from a handful of scattered position measurements. He justified the method probabilistically, showing that if observational errors follow what is now called the Gaussian (normal) distribution, the least-squares estimate is also the maximum-likelihood estimate — the value most consistent with the observed data under that error model. Gauss did not publish this work until 1809, in Theoria Motus Corporum Coelestium, by which time Adrien-Marie Legendre had already published the method explicitly in 1805, sparking a long and unresolved priority dispute between the two. Whatever the precedence, it was Gauss's probabilistic justification — tying the arithmetic procedure of minimizing squared errors to the physical assumption of normally distributed measurement noise — that transformed least squares from a convenient curve-smoothing trick into a rigorously justified statistical estimator, the same justification that underlies its use in every calibration curve fit in a modern analytical laboratory.

History
- 1795 — Gauss privately develops and applies the method of least squares to astronomical data, though he does not publish it.
- 1801 — Gauss uses least-squares fitting to successfully predict the recovery position of the asteroid Ceres, dramatically demonstrating the method's power.
- 1805 — Legendre publishes the method of least squares explicitly, as an appendix to a work on cometary orbits, becoming the first public description.
- 1809 — Gauss publishes his own probabilistic derivation in Theoria Motus, connecting least squares to the normal distribution of errors and igniting the priority dispute with Legendre.
- Mid-20th century — as spectrophotometric, chromatographic, and electrochemical instruments proliferate, least-squares calibration curves become the routine standard in analytical chemistry, eventually codified in official method validation guidelines (e.g., IUPAC, ICH).
Why does least-squares regression minimize vertical distances rather than perpendicular distances to the line?

Because the underlying statistical model assumes the concentrations xix_i of the standards are known essentially exactly (they were prepared by careful volumetric dilution from a certified stock), while all the random scatter lives in the measured signal yiy_i. Under that assumption, the correct quantity to minimize is the squared vertical distance between each observed yiy_i and the line's predicted value at that xix_i, since that vertical gap is precisely the measurement error the model is trying to describe. Perpendicular-distance minimization (orthogonal or "total least squares" regression) is the right choice only when both variables carry comparable random error — for example, when comparing two different analytical methods against each other, where neither axis can be treated as an error-free reference.

What does it mean physically if the fitted intercept b is significantly different from zero?

The intercept represents the predicted signal at zero concentration — ideally this should be close to zero, since a truly blank sample should give no analytical signal. A nonzero intercept commonly reflects a reagent blank absorbance, background scattering or fluorescence, baseline drift, or a small systematic offset in the instrument's zero setting. Some methods (spectrophotometry with turbid samples, or chromatography with a co-eluting matrix peak) can show intercepts that are statistically significant but analytically expected and correctable. A large or unexplained nonzero intercept, however, is a warning sign worth investigating rather than ignoring, since it can bias every concentration computed from the calibration curve by a roughly constant additive amount.

Can I just eyeball a "best fit" line through calibration points instead of computing least squares?

You could, but you would lose reproducibility and quantitative uncertainty estimates. Two different analysts drawing a line "by eye" through the same five points will typically produce noticeably different slopes and intercepts, especially if the points have visible scatter, and neither can attach a rigorous confidence interval to their by-eye line. Least squares removes this subjectivity: given the same data, every analyst (or every software package) computes exactly the same mm, bb, and srs_r, because the procedure is a fully determined algebraic minimization. This reproducibility is precisely why regulatory guidelines for method validation require least-squares (or weighted least-squares) fitting rather than graphical estimation.

Is a correlation coefficient of r = 1.000 ever achievable in a real calibration?

In principle only if every single point falls exactly on a straight line, which essentially never happens with real instrumental noise. In practice, values like r=0.9999r = 0.9999 are achievable with very clean, low-noise instrumental methods (careful UV-Vis work, well-controlled chromatography) over a modest concentration range, but even these fits have nonzero residuals when examined closely. Regulatory guidance documents (such as those from ICH or USP) commonly require r≥0.995r \geq 0.995 or r2≥0.99r^2 \geq 0.99 as a minimum acceptance criterion for calibration linearity, but as emphasized throughout, this threshold should always be paired with a residual plot inspection, since rr alone cannot detect systematic curvature.

Why does the confidence interval on a predicted concentration get wider near the edges of the calibration range?

The third term inside the square root of the standard-error formula for xux_u contains (yu−yˉ)2(y_u - \bar y)^2 in the numerator — it grows as the unknown's signal moves away from the calibration centroid yˉ\bar y. Geometrically, this reflects the fact that the fitted line is "anchored" most firmly at its centroid (where it is forced to pass through (xˉ,yˉ)(\bar x,\bar y) by construction) and is progressively less well-determined toward its extremes, since small errors in the estimated slope translate into larger absolute deviations in the predicted line the farther you extrapolate along it. This is the same geometric effect that makes extrapolating a calibration curve beyond its calibrated range statistically risky and generally discouraged in quantitative analytical work.

What is weighted least squares, and when is it needed?

Weighted least squares generalizes the ordinary least-squares objective function to S=∑iwi(yi−mxi−b)2S = \sum_i w_i (y_i - mx_i - b)^2, where each point's contribution is scaled by a weight wiw_i, typically chosen as wi=1/σi2w_i = 1/\sigma_i^2 (the inverse of that point's variance). It becomes necessary whenever the variance of yy is not constant across the calibration range — most commonly when the absolute noise grows roughly proportionally to signal size, a pattern common in chromatographic peak-area measurements spanning a wide concentration range. Fitting such data with ordinary (unweighted) least squares still gives an unbiased slope and intercept on average, but it inefficiently over-weights the noisiest, highest-concentration points and understates the true uncertainty at low concentrations — precisely where accurate quantification (and detection-limit estimation) matters most.

How many calibration standards should a real analytical method use?

Most validated analytical methods use five to eight standards spanning the intended working range, often including a low-level standard near the anticipated limit of quantitation and a high-level standard near the top of the expected sample range, with the rest spaced roughly evenly (or logarithmically, for wide dynamic ranges) in between. Using only two or three points makes srs_r poorly determined (or, at exactly two points, undefined, since n−2=0n - 2 = 0 degrees of freedom remain) and gives a large Student's tt multiplier that inflates the final confidence interval. Regulatory method-validation guidance typically specifies a minimum number of concentration levels (often five) precisely to ensure the regression statistics — slope, intercept, srs_r, and the resulting confidence intervals — are estimated with reasonable reliability.

Before this

Where this leads