How can the following set of equations be solved using matrices?
A+ B + F = 16
B + C + D = 15
D+ E = 13
H+ I = 14
F+G+H+I = 20
F+ G = 6
A, B,C,D, E, F, G and H are limited to having a unique value. and the values are 1 though 9
The given set of equations can be written in matrix form as:
and then using the MATLAB operator, we can solve the system as:
MATLAB Code:
close all
clear
clc
X = [1 1 0 0 0 1 0 0 0;
0 1 1 1 0 0 0 0 0;
0 0 0 1 1 0 0 0 0;
0 0 0 0 0 0 0 1 1;
0 0 0 0 0 1 1 1 1;
0 0 0 0 0 1 1 0 0]
Z = [16 15 13 14 20 6]'
Y = XZ
disp('X*Y = ')
disp(X*Y) % For verification
Output:
X =
1 1 0 0 0 1 0 0 0
0 1 1 1 0 0 0 0 0
0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1
0 0 0 0 0 1 1 1 1
0 0 0 0 0 1 1 0 0
Z =
16
15
13
14
20
6
Warning: Rank deficient, rank = 5, tol = 3.461333e-15.
> In script_164 (line 12)
Y =
0
10.0000
-8.0000
13.0000
0
6.0000
0
14.0000
0
X*Y =
16.0000
15.0000
13.0000
14.0000
20.0000
6.0000
Hence, the solution is:
Get Answers For Free
Most questions answered within 1 hours.