Hello @Naren_babu_R
I just want to add that having the “subtraction” term in the cost function isn’t a necessary condition to have the “subtraction” term in the gradient of the cost function. We need to be clear about this. I would also like to draw your attention to this post which will tell us that the “subtraction” term shows up after taking the derivative.
Raymond