Second derivative formula and substitution