I have finished week2 assignment and in that I have calculated cost function as `-1/m * (np.sum(Y * np.log(A) + (1-Y) * np.log(1-A)))`

where we do a normal multiplication of Y and log(A) but in week3 assignment while calculating cost function why is it that we use `np.multiply followed by np.sum`

or `np.dot`

instead of normal multiplication?

The input and output in both assignments are array then what makes the difference here?

*np.multiply* is the same as “*”. They are two ways to say the same thing. By analogy *np.dot* can be abbreviated as “@”, although Prof Ng chooses not to use that notation.

For the cost computation, the fundamental operation is multiplying the corresponding elements of two vectors and then adding up the products to get a scalar. You can do that in two steps with *np.multiply* followed by *np.sum* or you can do it in one step using *np.dot*. Well, I guess you could say *np.dot* requires two steps also, because you need a transpose on one of the vectors first.

The cost value is a scalar, but some of the methods will produce a 1 x 1 array. The grader seems not to care about this difference.