%------------------------------------------------------------
% Problem 10
%------------------------------------------------------------
A = [1 0 0; 2 1 3; 0 0 1];
b = [1 2 3]';

Ai = inv(A);
% Ai =
% 
%      1     0     0
%     -2     1    -3
%      0     0     1

x = Ai*b;
% x =
% 
%      1
%     -9
%      3

%------------------------------------------------------------
% Problem 11
%------------------------------------------------------------
sizes = [100 200 400 800 1600]';
N = length(sizes);
times = zeros(N,1);
for k = 1:N
    A = rand(sizes(k),sizes(k));
    b = rand(sizes(k),1);
    tic; 
    x = A \ b; 
    t = toc;
    times(k) = t;
end

% times =
% 
%     0.0020
%     0.0122
%     0.0858
%     0.5264
%     4.2722
