code refactoring, added Combination function and linearSystemError function