add delta to cost function, d^2 is added when taking a recursive step