# Course 2 - Week 1 - Exercise 3 - Gradient_check

The Backprop is too large… Printed out the values for the variables… I thought I had them right… I may not have understood the math formulas… any ideas as to what I need to look at?

theta_plus 4.0000001
theta_minus 3.9999999
J_plus 48.0000012
J_minus 47.9999988
numerator 8.999999998124622
denominator 14.999999998124622
difference 0.5999999999499899
There is a mistake in the backward propagation! difference = 0.5999999999499899

thanks,

rick

I think I should be squaring the individual values where I take the norm in the numerator and both parts of the denominator… still tooo large for the back Prop…

Since J is not a param… I computed it as x*theta from previous exercises… then multiplied by theta_plus and minus respectively…

theta_plus 4.0000001
theta_minus 3.9999999
J_plus 48.0000012
J_minus 47.9999988
numerator 80.9999999662432
denominator 152.99999995499093
difference 0.5294117646409904
There is a mistake in the backward propagation! difference = 0.5294117646409904

thanks,

rick

Hello Rick @rws7349,

From your description, there was a problem with how J_plus & J_minus were computed.

In Ex 3:

In Sect 4:

See the problem from the above equations?

Then, you can re-use the function you developed for Ex 1.

Cheers,
Raymond

Raymond,

I think I corrected the J+ by multiplying x * theta + (and the corresponding values for the minus)… The values below… says it works, but not the right value for the difference… is this right? trying to ensure it’s correct before tackling the n dimension exercise…

theta_plus 4.0000001
theta_minus 3.9999999
J_plus 12.0000003
J_minus 11.9999997
numerator 2.198151827749947e-19
denominator 17.999999997186933
difference 1.221195460051932e-20
Your backward propagation works perfectly fine! difference = 1.221195460051932e-20

thanks,

rick

1 Like

Raymond,

Got it… I should not have squared the numerator and the two components of the denominator…

thanks,

rick

2 Likes

It’s great that you figured it out, Rick!

Cheers,
Raymond