The total fixed cost and variable cost per unit are determined mathematically through a series of computations.

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

**y = a + bx**

where: y = total cost; a = total fixed costs; b = variable cost per level of activity (or units); x = level of activity (or number of units).

## 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 |

n |

## Example

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 |

**Solution:**

Batch |
Units (x) |
Total Cost (y) |
xy |
x² |

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.6741 ≈ $26.67 per unit**

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

a = | ∑y – b∑x |

n |

a = | 152,200 – (26.67)(3,480) |

5 |

**a = $11,877.68**

The cost function for this particular set using the method of least squares is:

*y = $11,887.68 + $26.67x*.