What’s the problem here? Can you please write the code for dw and db?

{moderator edit: removed assignment code}

I dont remember the formulas if they are rights but I would suggest you to you numpy transpose and numpy dot instead of python operators.

Hi, did you mean to use the following code ? Well, it’s not working.
dw = (np.dot(X, np.transpose(A-Y)))/m

The syntax error in your first post was probably because the line that computed `cost` had imbalanced parentheses.

Btw, which course or specialization does this assignment belong to? You posted this in the Machine Learning Specialization category but I can move it to the right specialization for you if you tell me the name of it.

Cheers,
Raymond

@rmwkwok, hi thank you for your reply. The specialization is Neural Networks and Deep Learning. from DeepLearning.Ai. This is a Coursera Course.

I moved it to the DLS category for you. Please post your question here next time.

Good luck with the assignments!

Raymond

@rmwkwok @gent.spah thank you fro your answer. I am stuck in this assignment.

Please see the error for “Cost”
### Exercise 5 - propagate;

`np.dot` is matrix multiply (dot product style, not “elementwise”). So it does not work to multiply a 1 x 3 matrix (vector) with a 1 x 3 matrix (vector), right? If you don’t know how matrix multiply works, you are in trouble here. A knowledge of basic Linear Algebra is a prerequisite for this course. There are two ways to implement the two terms of the cost there:

1. You can use “elementwise” multiply of the two vectors (* or `np.multiply`) and then you can sum the results with `np.sum`.
2. You can do both the multiply and the sum in one operation by using “real” matrix multiply (`np.dot`). But to get the dimensions to work right, you have to transpose the second operand. If you dot 1 x 3 with 3 x 1, you get 1 x 1, which is a scalar and that’s what we need here, right?

If you use option 2), then you don’t need that `np.sum` that you show in your code.