function y = dettd(A)
% Computes the determinant of A recursively
% from the linear algebra definition.
% T. DeLillo, Math 451, Fall 2001.
[m,n]=size(A);
if m ~= n
    disp('A is not a square matrix');
%    break
elseif n == 1
    y=A(1,1);
elseif n > 1    
    y=0;
    for j=1:n
        B=A;
        B(:,j)=[];
        B(1,:)=[];
        y=y + (-1)^(1+j)*A(1,j)*dettd(B);
    end
end   
    