We expand the quadratic expression as
When the function is written in this form, it is easy to differentiate term by term,