input: Write a function to perform linear regression for predicting the numbers in a given dataset. The function should take two arrays X and Y as input, fit a linear regression model, and then predict the value of Y for a new value of X.
  assert linear_regression([1, 2, 3, 4, 5], [3, 5, 7, 9, 13], 7) == 15.0
  assert linear_regression([1, 2, 3, 4], [2, 4, 6, 8], 5) == 10.0
  assert linear_regression([0, 1, 2, 3], [1, 3, 5, 7], 4) == 9.0
  assert linear_regression([1, 2, 3], [1, 4, 9], 4) == 16.0
  assert linear_regression([], [], 2) == None
output: def linear_regression(X, Y, new_X):
      if not X or not Y:
          return None
      n = len(X)
      sum_X = sum(X)
      sum_Y = sum(Y)
      sum_XY = sum(x * y for x, y in zip(X, Y))
      sum_X2 = sum(x ** 2 for x in X)
      slope = (n * sum_XY - sum_X * sum_Y) / (n * sum_X2 - sum_X ** 2)
      intercept = (sum_Y - slope * sum_X) / n
      return slope * new_X + intercept