For All Things Accounting.

Least squares method
Linear regression

Checked for updates, April 2022.


The use of linear regression (least squares method) is the most accurate method in segregating total costs into fixed and variable components. Fixed costs and variable costs are determined mathematically through a series of computations.

Cost Function

Like the other methods of cost segregation, the least squares method follows the same cost function:

y = a + bx

y = total cost;
a = total fixed costs;
b = variable cost per level of activity;
x = level of activity

The Normal Equations in Differential Calculus

∑y = na + b∑x
∑xy = ∑xa + b∑x²

Note that through the process of elimination, these equations can be used to determine the values of a and b. Nonetheless, formulas for total fixed costs (a) and variable cost per unit (b) can be derived from the above equations.

Variable Cost per Unit (b)

Using the normal equations above, a formula for b can be derived. The variable cost per unit or slope is computed using the following formula:

b = n∑xy – (∑x)(∑y)
  n∑x² – (∑x)²

Total Fixed Costs (a)

Once b has been determined, the total fixed cost or a can be computed using the formula:

a = ȳ - bx̄

where: ȳ = ∑y and x̄ = ∑x
    n     n

Or, it is the same as:

a = ∑y – b∑x


The following data was gathered for five production runs of ABC Company. Determine the cost function using the least squares method.

Batch Units (x) Total Cost (y)
1 680 $29,800
2 820 $34,000
3 570 $27,500
4 660 $29,000
5 750 $31,900


Batch Units (x) Total Cost (y) xy
1 680 29,800 20,264,000 462,400
2 820 34,000 27,880,000 672,400
3 570 27,500 15,675,000 324,900
4 660 29,000 19,140,000 435,600
5 750 31,900 23,925,000 562,500
3,480 152,200 106,884,000 2,457,800

Substituting the computed values in the formula, we can compute for b.

b = n∑xy – (∑x)(∑y)
  n∑x² – (∑x)²
b = (5)(106,884,000) – (3,480)(152,200)
  (5)(2,457,800) – (3,480)²

b = $26.67 per unit

Total fixed cost (a) can then be computed by substituting the computed b.

a = ∑y – b∑x
a = 152,200 – (26.67)(3,480)

a = $11,877.68

The cost function for this particular set using the least squares method is:
y = $11,887.68 + $26.67x.

Key Takeaways

In this lesson, we took a look at the least squares method, its formula, and illustrate how to use it in segregating mixed costs.

Scientific calculators and spreadsheets have the capability to calculate the above, without going through the lengthy formula. But keep the above formulae just for base knowledge.

Like and share!
Web link
APA format
Least squares method / Linear regression (2022). Accountingverse.
Next Chapter
Previous Lesson
Chapter Outline
> <
A c c o u n t i n g v e r s e
Your Online Resource For All Things Accounting
Based on international financial reporting standards,
and with references to US or local GAAP as needed
Copyright © 2010-2022