# Course 1 Week 4 L_model_backward

I was wondering if both statements below mean the same or have any difference in functionality. This is for the calculation of gradient of cost function.

``````dAL = -1 * (np.divide(Y,AL) - np.divide((1-Y),(1-AL)))
dAL = -1 * ((Y/AL) - ((1-Y)/(1-AL)))
``````

Both seem to give me correct answers but I just wanted to know if any difference. I understand the difference between np.dot and *, as well as + and np.sum. I understand how we get different answers.

I also am unsure if np.multiply and * give us the same result. Could anyone please give me feedback? Thank you.

Regards,
Deepak.

I think numpy.divide and / is equivalent to the divide broadcast operation. Same with * and numpy.multiply. This is explicitely mentioned in the documentation:

https://numpy.org/doc/stable/reference/generated/numpy.multiply.html

Hello,

Yes ok, thank you for letting me know. I was confused since the Assignment specifically calls out to use np.divide. Makes sense that both represent the same.

Thank you.

Regards,
Deepak.