Investment Studio > Expressions > Functions > Matrix > MSOLVE

float array[n][1] msolve(float array[n][n] a, float array[n][1] b)

Returns the column vector x containing the solution to the system of equations a * x = b (if any). The coefficient matrix a must be square and have the same number of rows as the column vector b.

If no solution is found, the result is #N/A.

Examples

=msolve({{1, 2}, {3, 4}}, {{1}, {2}})

equals {{0}, {0.5}}. You can verify that {{1, 2}, {3, 4}} * {{0}, {0.5}} = {{1}, {2}}.

=msolve({{1, 1}, {1, 1}}, {{1}, {2}})

returns #N/A since no solution exists for this system of equations.

See also mdeterm, minverse.