I don’t know if it is already pointed out, but there is an error in the formula given for exercise 9 of assignment 1 in Week4 of DLS course 1.
There should be a + sign instead of the - before the second term. Having some knowledge about the math, I identified the error and corrected it, hence my code worked perfectly, but for someone with less knowledge about calculus and if you’re program isn’t working, this might be the issue.
You can have an idea from this thread, where the entire chain rule has been discussed in detail. If you fail to get any of the details, then do let us know. We can have it discuss here.