private double recursiveDeterminant(Matrix matrix) {
		int n = matrix.getHeight();
		if (n == 1) {
			return matrix.get(0, 0);
		}
		double res = 0.;
		for (int i = 0; i < n; i++) {
			Matrix newMatrix = new Matrix(n - 1, n - 1);
			for (int j = 0; j < n; j++) {
				for (int k = 1; k < n; k++) {
					if (j != i) {
						newMatrix.set(j < i ? j : j - 1, k - 1, matrix.get(j, k));
					}
				}
			}
			res += ((i % 2 == 0 ? 1 : -1) * matrix.get(i, 0) * recursiveDeterminant(newMatrix));
		}
		return res;
	}