input: Write a function to perform linear regression for predicting the numbers in a given dataset. The function should take two lists, X and Y, as input, where X contains the independent variables and Y contains the dependent variables. The function should return the predicted value for a new X value after performing the regression.
  assert linear_regression([1, 2, 3, 4, 5], [3, 5, 7, 9, 13], 7) == 15.0
  assert linear_regression([1, 2, 3, 4, 5], [3, 5, 7, 9, 13], 9) == 20.0
  assert linear_regression([1, 3, 5, 7, 9], [4, 8, 12, 16, 21], 11) == 25.0
  assert linear_regression([1, 3, 5, 7, 9], [4, 8, 12, 16, 21], 13) == 30.0
  assert linear_regression([1, 3, 5, 7, 9], [4, 8, 12, 16, 21], 15) == 35.0
output: def linear_regression(X, Y, new_X):
      n = len(X)
      sum_X = sum(X)
      sum_Y = sum(Y)
      sum_XY = sum([X[i] * Y[i] for i in range(n)])
      sum_X_squared = sum([x ** 2 for x in X])
      
      m = (n * sum_XY - sum_X * sum_Y) / (n * sum_X_squared - sum_X ** 2)
      b = (sum_Y - m * sum_X) / n
      
      return m * new_X + b