function identity(n) {
    if (n < 1) return "Not defined";
    else if (n == 1) return 1;
    else {
        var idMatrix:number[][];
        for (var i: number = 0; i < n; i++) {
            for (var j: number = 0; j < n; j++) {
                if (i!= j) idMatrix[i][j] = 0;
                else idMatrix[i][j] = 1;
            }            
        }
        return idMatrix;
    }
}