Added comments to explain the linear solution