Solving linear equations using matrices
In the previous section, we looked at solving a system of linear equations with inequality constraints. If a set of systematic linear equations has constraints that are deterministic, we can represent the problem as matrices and apply matrix algebra. Matrix methods represent multiple linear equations in a compact manner while using the existing matrix library functions.
Suppose we would like to build a portfolio consisting of 3 securities, , and . The allocation of the portfolio must meet certain constraints: it must consist of 6 units of a long position in security a. With every 2 units of security a, 1 unit of security b, and 1 unit of security c invested, the net position must be 4 units long. With every 1 unit of security a, 3 units of security b, and 2 units of security c invested, the net position must be long 5 units.
To find out the number of securities to invest in, we can frame the problem mathematically as follows:
With all of the coefficients...