clear all;
clc;
%Question 2: The two equations to be solved are x+2y=3 and 2x+4y=6
%we can convert these in a form AW=U
A = [[1 2]; [2 4]];
U = [3;6];
%Hence our solution would be
%We need to check that inv(A) exists. Else if det(A) =0, it won't exist, and hence we can't find a unique solution.
disp('The determinant value is'); disp(det(A));
%Here the det(A) = 0; Hence we have more than one solution. In this case
%the solution would be a straight line. the solution would be x = 3-2*y
% Another approach is to use plots.
% We can plot two functions y1 = f(x) = (3-x)/2 and y2 = g(x) = (6-2x)/4;
x = -10:10;
y1 = (3-x)/2;
y2 = (6-2*x)/4;
plot(y1,x,y2,x);
grid on;
% Here the lines turn out to be the same. So the solution is the line
% x+2y=3