polynomial : remainder theorem

when f(x) is divided by x-1 and x+2, the remainders are 4 and -2 respectively.hence find the remainder when f(x) is divided by (x^2)+x-2.
please help :) thanks 

notice that x2 + x - 2 = (x+2)(x-1). so, dividing by x2 + x - 2 is the same as dividing by (x-1) and then (x-2). this is just like noticing that 30/10 = 3 is the same as 30/(5×2) = (30/5)/2 = 6/2 = 3.
 
 
 
let's work through a similar problem with actual numbers first just so you get an idea of the process:
 
what is the remainder of 37 divided by (3×5)?
 
you know the answer is 7, since 37/(3×5) = 37/15 = 2 r7. but let's say we wanted to divide by 3 and then 5. how can we get that remainder of 7, using only the fact that 37/3 has a remainder of 1 and 37/5 has a remainder of 2?
 
start by dividing by 3, which results in some number plus the remainder of 1 over 3:
 
37/3 = 12 + 1/3
 
now, divide that by 5:
 
(12 + 1/3)/5 = 12/5 + 1/15
 
since 3 and 5 have no factors in common, 12/5 has the same remainder as 37/5. so, replace 12/5 with some number plus the remainder of 2 over 5:
 
12/5 + 1/15 = 2 + 2/5 + 1/15
 
we don't care about that first 2. we just care about those two fractions. let's use the common denominator of 15 to combine them:
 
2/5 + 1/15 = 6/15 + 1/15 = 7/15
 
so, the remainder when dividing by 15 is 7, just like we wanted. we'll use this same process to solve your problem.
 
 
 
divide f(x) by (x-1) and you'll get some polynomial p(x) plus the remainder of 4 over (x-1):
 
f(x)/(x-1) = p(x) + 4/(x-1)
 
 
 
now, divide that by (x+2):
 
f(x)/((x-1)(x+2)) = (p(x) + 4/(x-1))/(x+2)
f(x)/(x2 + x - 2) = p(x)/(x+2) + 4/((x-1)(x+2))
 
 
 
like in our example, p(x)/(x+2) has the same remainder as f(x)/(x+2). so, replace that with some other polynomial q(x) plus the remainder of -2 over (x+2):
 
f(x)/(x2 + x - 2) = q(x) + -2/(x+2) + 4/((x-1)(x+2))
 
 
 
we don't care about q(x), we just care about the fractions. so, let's give them a common denominator of (x-1)(x+2):
 
(-2(x-1)) / ((x-1)(x+2)) + 4 / ((x-1)(x+2)) = (-2(x-1) + 4) / ((x-1)(x+2)) = (-2x + 2 + 4) / ((x-1)(x+2))
 
that's (-2x + 6) / (x2 + x - 2), which means you have a remainder of -2x + 6 when dividing f(x) by x2 + x - 2.