Can you explain the mathematical foundation behind gradient descent and how learning rates affect convergence?