Hi can someone help me on this question,my teacher gave me two methods but both are confusing when I look back 😵😵😵

4.find the value of a and the value b in each of the following.
a)x^2 +3x -10 is a factor of x^3 +ax +bx +40
b) 2x^2-11x+5 is a factor of ax^3 -17x^2 +bx -15

Since the leading coefficient of both is 1,

x^3+ax+bx+40 = (x^2+3x-10)(x+c)
= x^3 + (c+3)x^2 + (3c-10)x - 10c
So, since -10c = 40, c = -4
That means that c+3 = -1, so a = -1
3c-10 = -22, so b = -22
check: (x^2+3x-10)(x-4) = x^3 - x^2 -22x + 40

So do the other in like wise. Note that you will have
a=2, giving (2x^2-11x+5)(x+c)