%% Doğrusal Denklem Sistemleri
% 3x-9=0 denklem x=\frac{9}{3}=3
%
% \begin{array}{l}
% 3x-9y=-42\\
% 6x-18y=-84
% \end{array}
%
%
% \begin{array}{l}
% 3x-9y=-42\\
% 2x+4y=2
% \end{array}
% \mathrm{Ax}=b
% \left\lbrack \begin{array}{cc}
% 3 & -9\\
% 2 & 4
% \end{array}\right\rbrack \left\lbrack \begin{array}{c}
% x\\
% y
% \end{array}\right\rbrack =\left\lbrack \begin{array}{c}
% -42\\
% 2
% \end{array}\right\rbrack
% A^{-1} \text{Ax}=A^{-1} b
% \left\lbrack \begin{array}{c}
% x\\
% y
% \end{array}\right\rbrack=A^{-1} b
%

A = [ 3 -9 ; 2 4 ]; 
b=[ -42 ; 2 ];
x = A^-1*b
x=inv(A)*b

%% mldivide, \
% Solve systems of linear equations Ax = B for x
%% Syntax
% x = A\B
% x = mldivide(A,B)

x=A\b
A*x-b

%
% Sembolik Hesaplamalarla Denklem Çözümü

syms a b c d 
M = [ a b ; c d]
inv(M)
dst = [ 2 ; -1]
x= inv(M) * dst

%
% 3 bilinmeyenli Denklem Sistemi
% \begin{array}{l}
% x-2y-z=6\\
% 2x+2y+z=1\\
% 2z-y+x=-1
% \end{array}

kat = [ 1 -2 -1 ; 
        2  2  1 ; 
        1 -1  2 ; ];
b= [ 6; 1 ; -1 ] 
x = kat \ b 

% \begin{array}{l}
% x-2y-z=6\\
% 2x+2y=z+1\\
% 2z-1\text{ }=\text{ }y+x
% \end{array}

kat = [ 1  -2  -1 ; 
        2   2  -1 ; 
        1   1  -2 ];
b= [ 6; 1 ; -1 ];
x = kat \ b 
%x*kat-b
kat*x-b


%
% Sembolik Denklem çözümü
%
% solve('3*x==5*y-1')