%% find rref of the augmented matrices
%% then solve associated system
A=[1 1 1 1; 0 0 -1 4; 2 -1 2 5; 1 0 1 -2]
B=[1 2 -1 1 5; -1 1 -2 6 -1; 2 3 4 -5 2]
C=[1 2 4 8 0; 1 3 9 27 0; 1 4 16 64 0; 1 5 25 125 0]

