Class 12 Statistics Notes · GSEB

Method of Least Squares

Regression — learn the normal equations, procedure for fitting the regression line, and worked example. GSEB Class 12 Statistics notes.

Last updated: 22 Sep 2026

Notes

Method of Least Squares

Linear Regression — Chapter 2, GSEB Class 12 Statistics

The Principle

The method of least squares finds the straight line that minimizes the sum of squared vertical errors between the actual data points and the line.

Error = Actual Y − Predicted Y

Minimize

Σ(Y − Ŷ)²

Get

Best-fit line

The line that minimizes Σ(Y − Ŷ)² is the best-fit line — it is closer to all points than any other straight line.

Normal Equations

To find a (intercept) and b (slope), solve two simultaneous equations:

Normal Equation 1

Y=na+bX\sum Y = na + b \sum X

Normal Equation 2

XY=aX+bX2\sum XY = a \sum X + b \sum X^2

How to solve

  • Step 1: Compute ΣX, ΣY, ΣXY, ΣX² from the data
  • Step 2: Substitute into the two normal equations
  • Step 3: Solve simultaneously for a and b
  • Step 4: Write the equation Y = a + bX

Worked Example

Fit a regression line Y on X for the given data

XYXY
1221
2484
35159
441616
552525
15206655

Substitute: 20 = 5a + 15b ... (1)

                66 = 15a + 55b ... (2)

Solving: b = (5 × 6615 × 20) / (5 × 5515²) = 0.60

a = 40.60 × 3 = 2.20

Ŷ = 2.20 + 0.60X

Understanding Slope (b)

The slope b tells us: for every 1-unit increase in X, how much does Y change?Drag the slider to see how changing b affects the line.

0.7
00112233445566XYΔX = 1ΔY = 0.7

When X increases by 1 unit, Y changes by 0.7 units (Y increases)

b is the steepness of the line. A larger |b| means a steeper line — Y changes more for each unit change in X. b = 0 means a horizontal line — X has no effect on Y.

Understanding Intercept (a)

The intercept a is where the regression line crosses the Y-axis (when X = 0). Drag the slider to see how changing a shifts the entire line up or down.

1.5
00112233445566XYa

When X = 0, Y = 1.5 — the line crosses the Y-axis at this point.

Changing a shifts the entire line up or down without changing its steepness.

Think of a as the starting point. If study hours (X) = 0, the predicted marks (Y) would be a. In practice, a may not have a real-world meaning if X = 0 is outside the data range.

Key Takeaways

Key Takeaways

  • Method of least squares minimizes Σ(Y − Ŷ)² — the sum of squared vertical errors.
  • Normal equations: ΣY = na + bΣX and ΣXY = aΣX + bΣX².
  • Slope b = change in Y for 1-unit increase in X. Larger |b| = steeper line.
  • Intercept a = value of Y when X = 0 — where the line crosses the Y-axis.
  • Changing b rotates the line (steeper/flatter); changing a shifts the line up/down.
  • The resulting line Y = a + bX is the best-fit line through the data.