Why derivative of w turns out to have x(i) why that of b does not

So basically I see the J function of w and b is the same, then why taking its derivative results differently.

Thank you

Hello @Hi_u_H,

The best answer is that, it is the result from taking the derivative. If you know how to do the derivative, you get the x(i) term.

On the other hand, although the cost function is the same, you are taking derivative with respect to different variables, so this is the first reason you can’t expect for necessarily the same result. Second, x(i) attaches to w not to b, so you also can’t expect for the same result.

Raymond

Thank you @rmwkwok. I am fully aware of that difference is due to properly derivative taking technique. But since I don’t know how to do that properly, I remains confused haha.
Tbh, I can simply take the formulas for granted and move on. But if someone can explain how proper derivative taking of the J function with respect to w and b leads to the difference of x(i), that would be awesome.

Hi @Hi_u_H,

In the video associated with the slide you shared, Andrew had gone through the steps. If you are not familiar with them, perhaps you want to google some videos like this one which explains how to take derivative?

When I learnt it, I watched how my teachers did it, and practiced myself with hundreds of exercise questions. It’s like practicing how to do add and minus.

Cheers,
Raymond

Thank you @rmwkwok for the recommendation. I will work on that and help myself :wink:

I am happy to hear that @Hi_u_H. It’s a useful skill to gather information on the internet and self-learn!

If you are taking derivatives, it all depends on the function in question, right? Look at how the w and b values figure in the formula:

z = \displaystyle \sum_{i = 1}^n w_i * x_i + b

So if you take the partial derivative of that w.r.t w_i, then you get x_i. If you take the partial derivative of that w.r.t. b, x is not involved, right? Of course we’re doing the Chain Rule here to get derivatives of the cost J and there are lots more factors, but that one is the key point at which w and b are involved.

1 Like

Thank you @paulinpaloalto. Sorry for the late reply, I was busy last week and almost forgot your advice. Thanks to you, I am able to go through the whole process of taking derivative again and figure out why it is so. Have a nice day.

I hope I don’t annoy anyone, but I had the same question and problems to understand which rules and principles of differentiation apply here.
Luckily there is a blog post that answers this exact question so maybe its helpful for future learners to put it here:

Long story short: It’s the chain rule.

1 Like