input: Write a function to train a Linear Regression model that predicts housing prices based on living area and number of rooms. The function should take in a 2D list of data where each sublist contains the living area and number of rooms, and a corresponding list of housing prices. It should then train the model and return the trained model. If provided with new data points, the function should also be able to predict housing prices using the trained model.
  assert train_predict_housing_prices([[2000, 3], [1600, 2.5], [2400, 3.5], [1400, 2], [3000, 4]], [75000, 43000, 59000, 32000, 85000], [[2200, 3]]) == [67000.0]
  assert train_predict_housing_prices([[1800, 3], [2100, 4], [1500, 2], [2200, 4]], [45000, 70000, 38000, 75000], [[1900, 3]]) == [50000.0]
  assert train_predict_housing_prices([], [], [[2000, 3]]) == [0.0]
output: 
  def train_predict_housing_prices(data, prices, new_data):
      if not data:
          return [0.0] * len(new_data)
      
      X = [[1] + d for d in data]
      y = prices
      
      X_transpose = list(zip(*X))
      X_transpose_X = [[sum(a * b for a, b in zip(X_row, X_col)) for X_col in X_transpose] for X_row in X]
      X_transpose_X_inv = [[1 / (X_transpose_X[0][0] * X_transpose_X[1][1] - X_transpose_X[0][1] * X_transpose_X[1][0]) * X_transpose_X[1][1], -1 / (X_transpose_X[0][0] * X_transpose_X[1][1] - X_transpose_X[0][1] * X_transpose_X[1][0]) * X_transpose_X[0][1]],
                           [-1 / (X_transpose_X[0][0] * X_transpose_X[1][1] - X_transpose_X[0][1] * X_transpose_X[1][0]) * X_transpose_X[1][0], 1 / (X_transpose_X[0][0] * X_transpose_X[1][1] - X_transpose_X[0][1] * X_transpose_X[1][0]) * X_transpose_X[0][0]]]
      
      X_transpose_y = [sum(a * b for a, b in zip(X_row, y)) for X_row in X_transpose]
      
      theta = [sum(a * b for a, b in zip(X_transpose_X_inv_row, X_transpose_y)) for X_transpose_X_inv_row in X_transpose_X_inv]
      
      predictions = [theta[0] + theta[1] * d[0] + theta[2] * d[1] for d in new_data]
      
      return predictions
  