Q:

how to solve this question of polynomials

Given the polynmial is exactly divided by $x+1$, when it is divided by
  $3x-1$, the remainder is $4$. The polynomial leaves remainder $hx+k$ when divided by
  $3x^2+2x-1$. Find $h$ and $k$.

This is the question which is confusing me.. i have done this question like this:
$p(x) = g1(x)(x+1) +0 $
$p(x) = g2(x)(3x-1) +4 $
$p(x) = g3(x)(3x+2x-1)+hx+k $
$=> p(x) = g3(x)(x+1)(3x-1) + hx+k $ 
now putting the value of $x$ in each $p(x) $
$p(-1) = 0 \tag{1}$
$p(1/3) = 4 \tag{2}$
$p(-1,1/3) = hx+k \tag{3}$
from equation $(2)$ and $(3)$
$4=hx+k\tag{4}$
now putting the value of $x$ in equation $(4)$.
$h(-1)+k=4 => -h+k=4 \tag{5}$
$h(1/3)+k=4 => h+3k=12 \tag{6}$
now adding equations $(5)$ and $(6)$
$ h+3k-h+k = 4+12 =>4k=16 => k=4$
now puting the value of of $k$ in equation $(5)$
$h=0$ 
therefore my answer is $h=0,k=4$ but the answers are$ h=3, k=3$. please help me to sort out my problem

A:

The error is that $\,p(-1) = 0\,\Rightarrow\, h(-1) + k = \color{#c00}0,\,$ not $\,\color{#c00}4.\,$ Fixing that yields the given answer.
Remark $\ $ This is a special case of the Chinese Remainder Theorem (CRT) or, equivalently, Lagrange interpolation. Either of these methods can be applied to solve the general case.

