Matrices and Linear Programming
Mathematics
Matrices and Linear Programming
Syllabus tag: KASNEB CPA | Foundation Level | CA15 Quantitative Analysis | Topic 4 Matrices and Linear Programming
Lesson objectives
By the end of this topic, you will be able to:
- Add, subtract and multiply matrices
- Compute a determinant and an inverse for a 2×2 matrix
- Solve simultaneous equations by matrix methods
- Formulate a linear programming problem
- Interpret the solution and the shadow price
Why this matters
Matrices handle several equations at once, and linear programming answers the question every constrained business faces: what is the best use of a limited resource?
Matrix arithmetic
Addition and subtraction require matrices of the same order and work element by element.
Multiplication requires the number of columns in the first to equal the number of rows in the second. An m×n matrix times an n×p matrix gives an m×p result.
Note that matrix multiplication is not commutative: AB and BA are generally different, and one may not even be defined. That is unlike ordinary arithmetic and is regularly tested.
Determinant and inverse
For a 2×2 matrix with elements a, b, c, d:
Determinant = ad − bc
For elements 4, 3, 2, 5: (4 × 5) − (3 × 2) = 14
The inverse swaps a and d, negates b and c, and divides by the determinant:
| Inverse element [1,1] | 5 / 14 = 0.3571 |
| Inverse element [1,2] | −3 / 14 = −0.2143 |
| Inverse element [2,1] | −2 / 14 = −0.1429 |
| Inverse element [2,2] | 4 / 14 = 0.2857 |
Where the determinant is zero the inverse does not exist. The matrix is described as singular, and the corresponding equations either have no solution or infinitely many — because one equation is a multiple of the other and adds no information.
Solving simultaneous equations
4x + 3y = 29 and 2x + 5y = 27
Using Cramer's rule, replacing each column in turn with the constants:
x = [(29 × 5) − (3 × 27)] / 14 = (145 − 81) / 14 = 4.5714 y = [(4 × 27) − (2 × 29)] / 14 = (108 − 58) / 14 = 3.5714
Check by substitution: 4(4.5714) + 3(3.5714) = 29 ✓ and 2(4.5714) + 5(3.5714) = 27 ✓
Substituting back is the check that catches an arithmetic slip, and takes seconds.
Linear programming: formulation
Three components, and formulation is where most marks are lost:
- Define the variables precisely — "let x be the number of units of Product A produced per week"
- State the objective function — maximise contribution, or minimise cost
- State every constraint, including the non-negativity constraints x ≥ 0 and y ≥ 0
A worked formulation. Products A and B earn contribution of KES 400 and 300. A needs 4 machine hours and 2 labour hours; B needs 2 and 3. Available: 240 machine hours and 180 labour hours.
Maximise: 400x + 300y Subject to: 4x + 2y ≤ 240 (machine); 2x + 3y ≤ 180 (labour); x, y ≥ 0
Note the constraint is contribution, not profit. Fixed costs do not vary with the decision, so including them would not change the optimum but would misstate the objective.
Solving graphically
Plot each constraint as a line, shade the feasible region satisfying all of them, and evaluate the objective at each corner point. The optimum is always at a corner — which is why only the corners need testing.
Where the objective function is parallel to a constraint, every point along that edge is optimal and there are multiple solutions.
:::checkpoint A student formulates a linear programme but omits the non-negativity constraints. Explain what the solution might then suggest and why the omission matters. :::
Slack and shadow prices
Slack is unused capacity in a constraint. A constraint with slack is not binding — more of that resource is worthless.
A shadow price is the extra contribution from one more unit of a scarce resource. It applies only to binding constraints, and it is the maximum premium worth paying for extra capacity.
Both ideas connect directly to CA25. The shadow price is what a limiting factor is worth at the margin, and it answers a question the contribution per limiting factor ranking cannot: how much would you pay for more?
The shadow price holds only within a range. Acquire enough extra resource and a different constraint becomes binding, and the shadow price changes.
:::checkpoint A factory has a shadow price of KES 90 per machine hour and can hire extra capacity at KES 70 an hour. State whether it should, and name the circumstance in which the answer would change. :::